Here is an example of problem, the program is self-explanatory:
from sympy import Symbol,cos,sqrt,simplify,cosh
m=Symbol("m",positive=True)
e=Symbol("e",real=True,negative=False)
a1=4*cos(e)**2-4*cos(e)**4-1+4*(cos(e)-cosh(m))**2+cos(2*e)**2
b1=4*(cos(e)-cosh(m))**2
print simplify(a1)-b1 # a1 is equal to b1, so the result is zero
# however, the original version and the simplified version yield
# different results in the following two identical expressions
# the first result is wrong, it is not -2, but +2 because cosh(m) > cos(e),
# the second result is true
# it looks that sqrt(a1) results in 2*(cos(e)-cosh(m)), which is wrong,
# it must be 2*Abs(cos(e)-cosh(m))
print simplify(sqrt(a1)/(cosh(m)-cos(e)))
print simplify(sqrt(simplify(a1))/(cosh(m)-cos(e)))
"""
Python 2.7.8 (default, Sep 30 2014, 15:34:38) [GCC] on linux2
output:
0
-2
-2*Abs(cos(e) - cosh(m))/(cos(e) - cosh(m))
"""
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
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/b0dd0cef-36fc-4c17-bd88-6e6d85c46f9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.