X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fmisc.py;h=1b3a5a94090bb2bfa7120d355d3f25683c2116f2;hb=HEAD;hp=f5a7bcf124d50cbc7c97d2b6628ce391679cbda5;hpb=d6c9163d4844d519559a1a35cd7094fc97572973;p=sage.d.git diff --git a/mjo/misc.py b/mjo/misc.py index f5a7bcf..1b3a5a9 100644 --- a/mjo/misc.py +++ b/mjo/misc.py @@ -3,33 +3,12 @@ Stuff that doesn't fit anywhere else. """ from sage.all import * -from functools import reduce + def legend_latex(obj): """ - Return the LaTeX representation of `obj`, but wrap it in dollar + Return the LaTeX representation of ``obj``, but wrap it in dollar ($) signs so that we can pass it directly to plot() et al. as a 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. - - TESTS: - - Normal integer multiplication:: - - sage: product([1,2,3]) - 6 - - And with symbolic variables:: - - sage: x,y,z = var('x,y,z') - sage: product([x,y,z]) - x*y*z - - """ - return reduce(operator.mul, factors, 1)