From: Michael Orlitzky Date: Wed, 5 Dec 2012 00:15:32 +0000 (-0500) Subject: Define product = prod, which is provided by Sage. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=e15316c191095ad432b6e28148bee01df6ffebc5;p=sage.d.git Define product = prod, which is provided by Sage. --- diff --git a/mjo/interpolation.py b/mjo/interpolation.py index fa784dd..cbba68e 100644 --- a/mjo/interpolation.py +++ b/mjo/interpolation.py @@ -1,5 +1,5 @@ from sage.all import * -from misc import product +product = prod def lagrange_denominator(k, xs): diff --git a/mjo/misc.py b/mjo/misc.py index 061a509..1b3a5a9 100644 --- a/mjo/misc.py +++ b/mjo/misc.py @@ -3,7 +3,6 @@ Stuff that doesn't fit anywhere else. """ from sage.all import * -from functools import reduce def legend_latex(obj): @@ -13,32 +12,3 @@ def legend_latex(obj): legend label. """ return '$%s$' % latex(obj) - - -def product(factors): - """ - Returns the product of the elements in the list ``factors``. If - the list is empty, we return 1. - - EXAMPLES: - - Normal integer multiplication:: - - sage: product([1,2,3]) - 6 - - And with symbolic variables:: - - sage: x,y,z = SR.var('x,y,z') - sage: product([x,y,z]) - x*y*z - - TESTS: - - The empty product is the multiplicative identity (one):: - - sage: product([]) - 1 - - """ - return reduce(operator.mul, factors, 1)