Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium Simplify

New issue 3552 by ronan.l...@gmail.com: Expression with square root doesn't simplify well
http://code.google.com/p/sympy/issues/detail?id=3552

Consider the following expression:

In [39]: y = 1/(x-1) + 1/(x+1) + x + 1
In [40]: value = y.subs(x, sqrt(2 + sqrt(5))); str(value)
Out[40]: 1/(1 + sqrt(2 + sqrt(5))) + 1/(-1 + sqrt(2 + sqrt(5))) + 1 + sqrt(2 + sqrt(5))

Simplify() doesn't do much on it, even though it can be simplified, with some work.

In [41]: str(simplify(value))
Out[41]: 1/(1 + sqrt(2 + sqrt(5))) - 1/(-sqrt(2 + sqrt(5)) + 1) + 1 + sqrt(2 + sqrt(5))

In [42]: value.together().expand().together().simplify().simplify()
Out[42]:
       ___________      ______________
      ╱       ___      ╱          ___
    ╲╱  2 + ╲╱ 5     ╲╱  10 + 5⋅╲╱ 5
1 + ────────────── + ─────────────────
          2                  2

NB: sqrt(2 + sqrt(5)) is the location of a local minimum of the function, so this isn't an artificial case.


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

Reply via email to