Comment #4 on issue 2745 by asmeu...@gmail.com: should cancel expand exp?
http://code.google.com/p/sympy/issues/detail?id=2745
These functions are mostly targeted toward square roots, which are
basically roots of quadratics (or quartics). When the minimal polynomial
gets bigger, things become more complicated. For example:
In [229]: a = (2 + 3**(S(1)/3))
In [230]: solve(minpoly((2 + 3**(S(1)/3)), x))[2]
Out[230]:
⎛ ___ ⎞
3 ____ ⎜ 1 ╲╱ 3 ⋅ⅈ⎟
- ╲╱ -3 ⋅⎜- ─ + ───────⎟ + 2
⎝ 2 2 ⎠
In [231]: a.evalf()
Out[231]: 3.44224957030741
In [232]: solve(minpoly((2 + 3**(S(1)/3)), x))[2].evalf(chop=True)
Out[232]: 3.44224957030741
In [233]: simplify(a - solve(minpoly((2 + 3**(S(1)/3)), x))[2])
Out[233]:
⎛ ___ ⎞
3 ____ ⎜ 1 ╲╱ 3 ⋅ⅈ⎟ 3 ___
╲╱ -3 ⋅⎜- ─ + ───────⎟ + ╲╱ 3
⎝ 2 2 ⎠
Notice the potential to simplify things here using algebraic algorithms,
which use the minimal polynomials.
In [235]: minpoly(solve(minpoly((2 + 3**(S(1)/3)), x))[2])
Out[235]:
3 2
x - 6⋅x + 12⋅x - 11
In [236]: minpoly(a)
Out[236]:
3 2
x - 6⋅x + 12⋅x - 11
In [237]: minpoly(solve(minpoly((2 + 3**(S(1)/3)), x))[2] - a)
Out[237]: x
The last result means that the algebraic number is 0 (since the only root
of the polynomial x is 0). In general, we can use a routine that uses
minpoly(), solve, and I think the root isolation algorithm (to make sure we
have the same root) to simplify numerical radical expressions.
And the situation becomes much more complex when the radicals are
symbolic. For that, we don't even have the minimal polynomial algorithm
implemented (though I think Mateusz told me that it's easy to extend the
numerical one to do it).
--
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.