Comment #25 on issue 51 by mattpap: RootOf for polynomial equations
http://code.google.com/p/sympy/issues/detail?id=51
1. All "simple" roots (those which can be obtained via factorization over
rationals) are returned immediately. Also some special classes of roots
(e.g. binomial roots) are also returned in explicit form. All other roots,
those which require heroic measures to compute, or those which don't have
closed form are returned as RootOf. The plan is to implement doit() in
RootOf. It will apply those "heroic measures" to transform a RootOf into a
radical expression, if possible. I'm convinced that returning simple roots
is the way to go (it's handy in certain situations), but I'm not sure if
those special classes should be returned as RootOf or not. Also, for
convenience (and to make old tests pass), simple univariate polynomials
with non number coefficients are also allowed.
RootOf has evalf() implemented. It uses interval refinement (real or
complex) and mpmath's findroot() to find a root (mixed symbolic-numeric
approach). This is slow but always successful, i.e. you find good setup for
numeric root finder and then converge quickly (if we would like to converge
symbolically, it would take ages, especially in the complex case).
2. Actually, you can give any subset of indices. If you don't specify any,
real roots are returned. You can't get all roots, unless you specify every
index, e.g. RootOf(poly, (0,1,2,3, ..., n)). I think that I will extend
RootOf syntax to allow:
- RootOf(poly, i)
- RootOf(poly, (i, j, k))
- RootOf(poly, 'real')
- RootOf(poly) (shorter form of RootOf(poly, 'all'))
Note that there is also Poly.real_roots() for obtaining all real roots in
terms of RootOf (if necessary) of a polynomial (currently uses
RootOf(poly), but allows for returning root multiplicity instead of
multiple roots).
3. You can always write RootOf(Poly(...)). Secondly, if we finally update
roots() to take advantage of RootOf, then you will be able to get all roots
with roots(poly, x) syntax.
If we allow RootOf(poly, x, index) syntax then it will be tempting to use
RootOf for things like RootOf(exp(abs(x)) - 1). I'm not sure if this should
be allowed, because right now, RootOf has very nice properties, e.g.
symbolic root isolation, which we won't be able to achieve in
non-polynomial cases.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.