Re: [sympy] Undesirable behavior from cse

2012-09-25 Thread Chris Smith
if not b.q % a.q or not a.q % b.q: AttributeError: 'Infinity' object has no attribute 'q' Infinity stopped inheriting from Rational a long time ago and this is one of those lurking areas where it causes problems. -- You received this message because you are subscribed to the Google Groups

Re: [sympy] Undesirable behavior from cse

2012-09-25 Thread Ondřej Čertík
On Mon, Sep 24, 2012 at 11:38 PM, Chris Smith smi...@gmail.com wrote: if not b.q % a.q or not a.q % b.q: AttributeError: 'Infinity' object has no attribute 'q' Infinity stopped inheriting from Rational a long time ago and this is one of those lurking areas where it causes problems. What

Re: [sympy] Undesirable behavior from cse

2012-09-25 Thread Chris Smith
I only looked at this very quickly: I get from sympy import * pg00 = Symbol('pg00') pg01 = Symbol('pg01') eq1 = sympify(pg01**2/pg00**2) eq2 = sympify(1.0 - 2*pg01/pg00) eq3 = sympify(pg01*(1.0 - pg01/pg00)) eq = [eq1,eq2,eq3] print eq [pg01**2/pg00**2, 1.0 - 2*pg01/pg00, pg01*(1.0 -

Re: [sympy] Undesirable behavior from cse

2012-09-24 Thread Ondřej Čertík
Larry, On Fri, Sep 7, 2012 at 2:50 PM, Larry Wigton lbw9...@aol.com wrote: On Thursday, September 6, 2012 6:26:38 PM UTC-7, smichr wrote: On Fri, Sep 7, 2012 at 1:40 AM, Larry Wigton lbw...@aol.com wrote: Python code using cse from sympy: from sympy import * x=Symbol('x')

Re: [sympy] Undesirable behavior from cse

2012-09-07 Thread Larry Wigton
On Thursday, September 6, 2012 6:26:38 PM UTC-7, smichr wrote: On Fri, Sep 7, 2012 at 1:40 AM, Larry Wigton lbw...@aol.com javascript: 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 +

[sympy] Undesirable behavior from cse

2012-09-06 Thread Larry Wigton
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

Re: [sympy] Undesirable behavior from cse

2012-09-06 Thread Chris Smith
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