]>
gitweb.michael.orlitzky.com - sage.d.git/blob - mjo/misc.py
2 Stuff that doesn't fit anywhere else.
6 from functools
import reduce
11 Return the LaTeX representation of ``obj``, but wrap it in dollar
12 ($) signs so that we can pass it directly to plot() et al. as a
15 return '$%s$' % latex(obj
)
20 Returns the product of the elements in the list ``factors``. If
21 the list is empty, we return 1.
25 Normal integer multiplication::
27 sage: product([1,2,3])
30 And with symbolic variables::
32 sage: x,y,z = SR.var('x,y,z')
33 sage: product([x,y,z])
38 The empty product is the multiplicative identity (one)::
44 return reduce(operator
.mul
, factors
, 1)