can't simplify a symbolic equation which should simply be C0**2*(expr)-1=0

39 views
Skip to first unread message

Junwei Huang

unread,
Jan 14, 2015, 5:44:28 PM1/14/15
to sy...@googlegroups.com
Hi all, I have a symbolic expression as in polyC

In [46]: polyC
Out[46]: -(sqrt(2035953389603699)*sqrt(-1/C0**12)/2000000 - 4849598923/(54000000*C0**6))**(1/3) - 1 + 3599/(300*C0**2) - 368417/(18000*C0**4*(sqrt(2035953389603699)*sqrt(-1/C0**12)/2000000 - 4849598923/(54000000*C0**6))**(1/3))

In [47]: N(polyC,2)
Out[47]: -(23.0*(-1/C0**12)**0.5 - 90.0/C0**6)**0.33 - 1.0 + 12.0/C0**2 - 20.0*(23.0*(-1/C0**12)**0.5 - 90.0/C0**6)**(-0.33)/C0**4

In [48]: polyC.simplify()
Out[48]: -1 - (54*sqrt(2035953389603699)*sqrt(-1/C0**12) - 9699197846/C0**6)**(2/3)/(600*(27*sqrt(2035953389603699)*sqrt(-1/C0**12) - 4849598923/C0**6)**(1/3)) + 3599/(300*C0**2) - 368417*2**(1/3)/(60*C0**4*(27*sqrt(2035953389603699)*sqrt(-1/C0**12) - 4849598923/C0**6)**(1/3))

In [49]: solve(polyC.simplify(),C0)
Out[49]: []

In [50]: solve_poly_system([polyC.simplify()],C0)
PolynomialError: C0**(-2) contains an element of the generators set


But if you exam Out[46], polyC seems to be something like C0**2*(expr)-1. then C0 can be solved with two roots. Anything I missed? Thank you.

Chris Smith

unread,
Jan 16, 2015, 2:06:18 PM1/16/15
to sy...@googlegroups.com
The expression is quadratic in C0 only if C0 is positive. Try replace C0 with var('x', positive=True); factor the result, *then* solve for your two values.

Chris Smith

unread,
Jan 16, 2015, 2:09:49 PM1/16/15
to sy...@googlegroups.com
(actually, you don't need to factor, but doing so shows the quadratic nature of the thing). I get for approx. solutions, +/- 2.6.

Junwei Huang

unread,
Jan 16, 2015, 2:20:49 PM1/16/15
to sy...@googlegroups.com
Thanks very much, Chris. That solves the problem.

--
You received this message because you are subscribed to a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/AI6kqPjhVkA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/53665b8e-973a-4a6e-be8f-dc14d973441b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Chris Smith

unread,
Jan 16, 2015, 2:51:36 PM1/16/15
to sy...@googlegroups.com
I believe the reason you are not getting a solution (originally) is related to https://github.com/sympy/sympy/issues/8789 .
Reply all
Reply to author
Forward
0 new messages