Try the most recent git version of SymPy in which I get
>>> from sympy import *
>>> 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
>>> sqrt(a1)/(cosh(m)-cos(e))
sqrt(4*(cos(e) - cosh(m))**2 - 4*cos(e)**4 + 4*cos(e)**2 + cos(2*e)**2 - 1
)/(-co
s(e) + cosh(m))
>>> simplify(_)
-2*Abs(cos(e) - cosh(m))/(cos(e) - cosh(m))
On Friday, February 13, 2015 at 7:15:50 AM UTC-6, [email protected] wrote:
>
> 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/a05be526-3636-4b5c-953c-067f7f2a71f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.