[SciPy-user] evaluating a really long, multiline expression
Ryan Krauss
ryanlists at gmail.com
Wed Nov 23 17:13:23 CST 2005
Robert,
Do you remember how to get the output of maxima's fortran command to
dump to a file? I can only get it to print to the screen, and that
isn't going to work for me.
Ryan
On 11/23/05, Robert Kern <robert.kern at gmail.com> wrote:
> David M. Cooke wrote:
>
> > Does Maxima have some method of rewriting expressions in terms of a
> > sequence of expressions, pulling out common subcomputations? Maple has
> > this:
> >
> >>ex := expand((x+y)^5);
> >
> > 5 4 3 2 2 3 4 5
> > ex := x + 5 x y + 10 x y + 10 x y + 5 x y + y
> >
> >>codegen[optimize](ex);
> >
> > 2 2 2 2
> > t1 = x , t2 = t1 , t7 = y , t13 = t7 ,
> >
> > t17 = t2 x + 5 t2 y + 10 t1 x t7 + 10 t1 t7 y + 5 x t13 + t13 y
> >
> > Something like that would *really* help. Also, speedwise, you might
> > think about putting it into a Pyrex file, and compiling it as a C module.
>
> I don't think Maxima has common subexpression elimination. At least, not
> two years ago when I last checked. However, it does have FORTRAN output,
> and cobbling up a small FORTRAN subroutine from that and a .pyf is quite
> easy. FORTRAN compilers generally *do* have common subexpression
> elimination.
>
> Here's the c.l.py thread where I asked a similar question:
>
> http://mail.python.org/pipermail/python-list/2003-October/189345.html
>
> --
> Robert Kern
> robert.kern at gmail.com
>
> "In the fields of hell where the grass grows high
> Are the graves of dreams allowed to die."
> -- Richard Harter
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>
More information about the SciPy-user
mailing list