BEGIN_DOC_POLY_version_3.5 (Not sure of which version you have? Hit REVIEW once you are in the LIBRARY menu !) Hello everybody! Gothenburg , January 93 First, I would like you to appologize all linguistical errors in this doc or any of the previous. English is not my native language ! :) Changes with respect to versions 2.0 -> 2.3 : ============================================= 1) PMULT completelly rewritten (2 - 3 times faster) 2) PADD partially rewritten 3) bug in PDER (wouldn't work for complex polys) fixed. Changes with respect to versions 2.0 -> 2.5 : ============================================= 1) Error checking of PEVAL bettered. 2) ROOTS is a completely different sampling of algoritms now, mostly much faster than before, but specially, much safer. It will ALWAYS converge to the roots, no matter how ill-conditioned the polynom is :-) Changes with respect to version 3.0 : ===================================== 1) ROOTS accepts complex polynomials of any size 2) ROOTS much faster for all kinds of polynomials, specially ill-conditioned. Now faster than the famous PROOT for almost all 3rd degree poly's and even for many of any degre :) 3) PDIV even faster 4) "exact mode" now avaliable (see below) Changes with respect to version 3.1 : ===================================== Internal changes done by me and by Detlef Mueller in order to speed it up a little more, and reducing the size. Also Detlef pointed out a non- abandoned environement, now fixed :) Changes with respect to version 3.3 -> 3.4: =========================================== A process aimed to prevent a "zero divison" made ROOTS "hang" for some extremely ill-conditioned polynoms, specially those having multiple complex roots. Now fixed :) ________________________________________________________________________________ Copyright 1993 Carlos Ferraro All Rights Reserved DISCLAIM : POLY and this manual are presented as is, without warranties, expressed or implied. The author makes no guarantee as to the fitness of this software. POLY can be copied freely, provided the software, including this manual, is copied in its entirety. The user cannot be charged, in whole or in part, except for the cost of reproduction. No part of this package may be used for commercial purposes without written permission from the author. I tryed - and hopfully managed - to use only Supported Entries. ________________________________________________________________________________ This is a small (2089 bytes) and very fast (full sys-rpl !) xlib to deal with the fundamental polynom necessities: ROOTS (all roots of poly), PDIV (poly div.), PMULT (poly mult.), PADD (poly add.), PEVAL (poly eval. at a point), PDER (poly deriv.). IMPORTANT : Unlike other polynom utilities I use vectors instead of lists to represent polynoms. For those who aren't familiar with non-symbolic polynom representation: Example: x^4 + 2*x^3 - 4*x = [ 1 2 0 -4 0 ] Example: 7*x^3 - 5*x^2*i + 3 + 2*i = [ (7,0) (0,-5) (0,0) (3,2) ] 1) ROOTS takes all the roots (real or complex) of real or complex polynoms. A trial to round every element of the resulting polynoms, as well as every root - taking the real and imaginary parts of the complex numbers separatelly - is made. If a complex root is found to have a (rounded) imaginary part equal zero, it will be simply be displayed as real ! Yet this could be not desired when looking for roots known to be close to (but not exact) integers. (example: (x + 000.1)^3 ) Simply set UserFlag 4 and no rounding will be performed at any stage of the calculations. EXAMPLE: Taking the roots of [ 4 33 68 15 ] : the answer { -5 -.25 -3 } comes in ~ 0,44 seconds !!! (faster than PROOT) EXAMPLE: Taking the roots of [ 1 3 2 -1 -3 -2 ] gives the answer { -1 -2 (-.5 , .866025403784) (.5 , .866025403784) 1 } in ~ 4.72 seconds ! EXAMPLE: Taking the roots of [ (4,0) (33,1) (76,5) (57,0) (10,0) ] gives the answer { -5 (-.89280613717,.252602578668) (-2.10855823447,-.490913020553) (-.248635628398,-.011689558116) } after ~ 7.35 seconds !! Observe that the coefitients of the poly are complex !! EXAMPLE: Taking the roots of [ 1 21 183 847 2196 3024 1728 ] : the answer { -4 -4 -4 -3 -3 -3 } comes in 5.63 seconds - faster than PROOT ! EXAMPLE: Taking the roots of [ 1 1.533333333333 -3.15 -1.933333333333 -.25 ] : the answer { -2.5 -.2 -.3333333333337 1.5 } comes in 2.17 seconds - faster than PROOT ! 2) PDIV checks for 2 vectors at level 1 and 2 and if not found, dispatches to the usual / (division). It will give the (eventual) rest at level 2. If it's found to be close to zero, it won't appear - unless UserFlag 4 is set . 3) PMULT checks for 2 vectors at level 1 and 2 and if not found, dispatches to the usual * (multiplication) 4) PADD checks for 2 vectors at level 1 and 2. 5) PEVAL takes a vector from level 2 and a number or a symbol (to aloud you to transform it into a symbolic polynom, if you whish), from level 1. 6) PDER takes a vector from level 1. In the next coming versions I may include a partial fraction "solver" in PDIV and a prog taking derivation of rational poly's as well. FOR YOU WHO AREN'T USED TO LIBRARIES : - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSTRUCTIONS FOR DOWNLOADING: ( This time I don't include the nice GROB-label, since almost everybody has it already. If you don't have it and want it, give me a call. ) 1) uudecode or ASC-> the corresponding versions and send it to the 48 2) call the contents of POLYLIB to the stack 3) purge POLYLIB (optional) 4) enter 0 or 1 or 2 (corresponding to the desired port) and hit STO 5) turn the calculator OFF 6) turn the calculator ON The library is now installed ! If (3) wasn't done, do it now (to save bytes) INSTRUCCIONS TO PURGE THE LIBRARIES: Althought I can't imagine why anybody would like to purge this beauty, here it is: :&:1224 DUP DETACH PURGE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Once the lib is installed, the values are : Library POLY , LID 1224 , bytes 2089 , chksum # 5C92 h . (Observe that this values are from taking "bytes" when the stack shows : Library 1224 : POLY ) Thanks to ... ... Detlef Mueller for his friendship, <-LIB-> and <-RPL-> , as well as for revising version 3.2 giving many suggestions ! ... Mika Heiskanen for entries.Z and suggestions ... Joergen Stenarson for finding me easy-to-understand important papers about Laguerre's iteration Any questions? Feel free to mail me! END_DOC Here's the beef uuencoded: begin 644 poly M2%!(4#0X+45 *] $ 1503TQ9(" Z,RXU("AC*4,N1BXG.3,5R"3T ,.X M!0#0V0(1*8!, EWL!(#G2V0105M+A# ]"$%EV[0Y@(!3!M]L!(#G2V & -B M-6#28YTM@!@#>&*S$@.KT)$(!78"I4QCFP^FSAC;&EP4YMX:":W1 MV!PX%.;>&F>K,9," 0 0 4%K^% 83,I !70 AL%K_%R&^ 5 MMCDJ#A1&-QONK8$8 _ 59CMA\Z)2\!H%M>'>&FP4-B\J!:^!& ,U%I;0&I(N M@$P)<#YAMA,V1"J(,4"7*F>K,2\J!:]14!ONK<%&80FM(>D"R)0 YQ-F.V%# MI((P*KRI'>&FP4EM :EW0@Z0+(E -0"#I LCD "LQT-D" M%T" =U,[&I868I,9)ND"R+0 +%T@Z0+(M C,B#I LBT ",R<LYMX:(S*0T!ITLR$L Y6I(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 +38K,4#. QLO%A1C03'V_@.7;@#3-"% M #=>Y'20_P,X%-9Q T0RP$5AW&*S"AU$,G ^8>\], $]W,0(@ 5)AH'MA-6,@.V$_;F PX^4#(#9ZMA.V%O/N#D YXS M8#MA&B@&7F$#0$#. \AQ0#,'#A1V/F$(.'9)![^-P0(=*S'P_@/NK;$2 XA, M =#9 M^.(=+1 B!^(R$"('7!36<0-$ M,N#>&@FML1(#-',0(@?G$S;8 RIQT-D"^3_ 16$=-T D P6OL1(#-'-@.V&_ MC<$"'8@QL)PV,RE F0 $&"+*E@:UMD"YQ,V-6$K,7 ^8;^-<4D'+-"Q M$@/O/U#P&BLQ@,@$ )TMX.P8%T#0V0*(,2!6 R8])LH8B#& >C4?&2;+&$0R M +D<"*,2C"J%0# B ]@:5G)353>57@5T*M#F @%,*S$ 30=[0%!U4Y(N@$P& M8$MCA4!0=5,K,; 2 TXJ 4 0O]/UO^Y^T^O_ZGZ[Z?_A_A_7O\K]4],_YWR M?R3_K/%?$O_P\.^D LP !& ( & M ) % 101$E6 4 %41$- $4$1%4@50(/7T1#4% 50355, ;5 )0 %5D%<1$ "T D 4 * !@!0 C # % $1B end +-----------------------------------------------------------------------------+ | carlos@fy.chalmers.se ~ Computer Logics ~ University of Gothenburg ~ Sweden | +-----------------------------------------------------------------------------+