# TITLE: Laguerre's Method for Solving Polynomials # AUTHOR: Roy F.A. Maclean # EMAIL: rfamgm at gmail # DATE: 24Oct2006 # MAKE: CASIO # MODEL: 9860 (Graph 85) # NOTES: # # (The program uses complex numbers in lists, complex powers and list 7, and appending new entries to the end of a list, # so won't work on the 9850) # # Laguerre's Method is an iterative method to get approximate solutions for polynomials. # It can be used for polynomials of any degree and even ones with complex coefficients. # It almost always converges, unlike the newton-rhapson method. # # This program uses synthetic division with each solution to reduce the degree of the polynomial # so that the Laguerre's Method can be applied again each time, until all the solutions are found. # # There are problems with rounding errors. # For more details on this method see: # http://en.wikipedia.org/wiki/Laguerre%27s_method # http://ftp.nag.co.uk/numeric/cl/nagdoc_cl08/xhtml/C02/c02_intro.xml # # --------------------------------------------------------------------------------------------- # USING: To use the program, store the coefficients of the polynomial in List 1, starting with the coeff # of the term of highest degree. Using zero for terms which aren't there. # # example: x^5+(-11-14i)x^4+(-21+92i)x^3+(157-74i)x^2-82-76i # # would be stored in List 1 as {1, -11-14i, -21+92i, 157-74i, -82-76i} # # When you run the program it will display each solution one by one. # It may take some time to calculate. The higher the degree, the longer it takes. # # When the program ends, the set of solutions is stored in List 7, to be used elsewhere if desired. # # \sqrt square root function # \i complex i # \exp the 'EXP' button ( on french models the button appears as '*10x' ) # (-) the unary minus sign # a+bi the complex mode set-up # -> the assignment arrow # => the implies sign # _ underscore is the triangle display symbol on the pgrm menu # / division @@ Program "LAGUERRE" a+bi {0}->List 7 List 1->List 2 Dim List 1-1->N:N->E For 1->B To E-1 0->K:100->X ' List 2->List 6 Prog "DIFFPOLY" List 6->List 3 Prog "DIFFPOLY" List 6->List 4 ' Do ' List 2->List 6 Prog "EVALPOLY" Ans->U:U=0=>Break List 3->List 6 Prog "EVALPOLY" Ans->V List 4->List 6 Prog "EVALPOLY" Ans->W ' V/U->G:G^2-W/U->H \sqrt((N-1)(NH-G^2))->S G-S->I:G+S->J If Abs I>Abs J Then N/I->A Else N/J->A IfEnd X-A->X 1+K->K LpWhile (Abs A>1\exp(-)3) And K<10 Abs ReP X<1\exp(-)10=>X-ReP X->X Abs ImP X<1\exp(-)10=>X-\iImP X->X X_ X->List 7[B] ' 0->D For 1->C To N List 2[C]+D Ans->List 3[C] XAns->D:Next List 3->List 2 ' N-1->N Next -List 2[2]/List 2[1]->X Abs ReP X<1\exp(-)10=>X-ReP X->X Abs ImP X<1\exp(-)10=>X-\iImP X->X X->List 7[B+1] X @@ Program "DIFFPOLYS" Dim List 6 Ans-1->Dim List 5 For 1->M To Ans-1 (Ans-M)List 6[M]->List 5[M] Next List 5->List 6 @@ Program "EVALPOLYS" Dim List 6 If X<>0 Then 0->D For 1->M To Ans List 6[M]X^(Ans-M)+D->D Next D Else List 6[Ans]