Richard Fateman wrote:
> Rat() and ratcoef are so much faster, that I would suggest the user consider
> using rat() prior to calling this function, if the coefficients are in fact
> exact or floats and keepfloat:true is the case. If they are bigfloats or
> who knows what else (quad-double? ) that rat might not know about, maybe
> expand is better..
> list_of_poly_coeffs(p,x) := (if(ratp(p) then
> makelist(ratcoef(p,x,k),k,0,hipow(p,x)) else (p : expand(p),
> makelist(coeff(p,x,k),k,0,hipow(p,x)))$
With fixes and suggestions from Stavros, Barton, and Richard, I've fixed
up the root finder, and you can find a copy at
http://common-lisp.net/~rtoy/jtroot3.mac
polyroots(p,x) finds the roots of the polynomial p in the variable x.
poly_root_error(x, p, r) gives an estimate, if possible, of the
approximate error in the roots. r is a list of roots, p is the
polynomial, and x is the variable.
I've added 5 tests of some special polynomials given in TOMS 419. These
work. I also tested P(7), a 64-th order polynomial, from Adam Majewski.
This appears to work, and all roots have magnitude less than 2. (I
used fpprec = 64. 32 might work.)
I don't have any plans to really do anything else. It was a fun
project. If someone one wants to add this to maxima in some contrib or
share package, you have my permission. The code is public domain.
Ray