From e15316c191095ad432b6e28148bee01df6ffebc5 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 4 Dec 2012 19:15:32 -0500 Subject: [PATCH] Define product = prod, which is provided by Sage. --- mjo/interpolation.py | 2 +- mjo/misc.py | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) 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) -- 2.44.2