(Comp.sources.hp48) Item: 37 by billw@hpcvra.cv.hp.com [William C Wickes] Subj: Polynomial Rootfinder Date: Wed Jan 15 1992 HP 48 Polynomial Rootfinder, for Real Coefficients The HP 48 object listed below in ->ASC form is a high-performance polynomial root finder. Those of you who remember the HP 71B Math Pac will recognize this as the same as the PROOT command from that Pac; it is in fact the same assembly-language code, given an RPL front end to operate in the HP 48. I will refer to the object as PROOT; you can, of course, give it any name you please by storing it in a global variable. PROOT takes a (real) vector of coefficients in descending order, and returns a complex vector containing the polynomial roots: [ An An-1 An-2 ... A0 ] PROOT -> [ R1 R2 ... Rn ] represents the determination of the n (complex) zeros R1 ... Rn of the nth-order polynomial An x^n + An-1 x^n-1 + ... + A0 There is no limit on n, other than available memory and execution time. The coefficients Ai must be real numbers, but this limitation is at least partially compensated for by the speed and accuracy of the algorithm. Also, no initial guess or stopping criterion is required. PROOT uses Laguerre's method for n>2, or the quadratic or linear formulas for n<=2. You are referred to the HP 71 Math Pac Owner's Manual for more information. The use of vectors rather than lists for the input and output derives from PROOT's HP71 origins. You can easily add list/vector conversion around this object to make a more versatile version. To be more fully compliant with HP 48 style you can write user-language programs to extract the polynomial coefficients from an arbitrary expression to use as a preliminary to PROOT, and to convert the result elements back into a factored expression (x-R1)(x-R2)...(x-Rn). Examples of such programs are listed in HP 48 Insights Part II (if you'll excuse the plug). Enjoy. Bill Wickes HP Corvallis Division