On Fri, Sep 7, 2012 at 1:40 AM, Larry Wigton <lbw9...@aol.com> wrote:
> Python code using cse from sympy:
>
> from sympy import *
> x=Symbol('x')
> y=Symbol('y')
> eq1 = 5*x**3*y**2 + y**3
> eq2 = 4*x**2*y**3 + y**2
> eq = [eq1,eq2]
> print eq
> (red,rep) = cse(eq)
> print red
> print rep
> eq = [eq2,eq1]
> print eq
> (red,rep) = cse(eq)
> print red
> print rep
>
> ***********************************************
>
> Output from the code:
>
> [5*x**3*y**2 + y**3, 4*x**2*y**3 + y**2]
> [(x0, y**3), (x1, x0**(2/3))]
> [5*x**3*x1 + x0, 4*x**2*x0 + x1]
>
> [4*x**2*y**3 + y**2, 5*x**3*y**2 + y**3]
> [(x0, y**2), (x1, x0**(3/2))]
> [4*x**2*x1 + x0, 5*x**3*x0 + x1]
>
> **********************************************

Current master gives

[5*x**3*y**2 + y**3, 4*x**2*y**3 + y**2]
[(x0, y**2)]
[x0*(5*x**3 + y), x0*(4*x**2*y + 1)]
[4*x**2*y**3 + y**2, 5*x**3*y**2 + y**3]
[(x0, y**2)]
[x0*(4*x**2*y + 1), x0*(5*x**3 + y)]

googling sympy bleeding edge if you would like to get the most
up-to-date (and soon to be released) 0.7.2 version.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to