Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



prgmNEWT
Posted:
Nov 1, 1997 12:34 PM


Greetings to ALL members of the ListServs:
Thank you all for you kind words and suggestions wrt Newton's Method to find Roots. Due to popular demand, what follows are the programs my students and I came up with in class.
Method 1: On the TI 82/83 one can do recursive functions right on the home screen. STEP 1: let y1=f(x) on the y= screen STEP 2: enter the following store commands on the home screen 1 > G G  y1(G)/nDeriv(y1,x,G) > G where the '1' is your initial guess (good for the y1 = x^3 + x  1 example) STEP 3: Hit <Enter> to get the first recursion STEP 4: Continue hitting <Enter> until you get the desired convergence or you've demonstrated divergence making for a pathological f(x).
Method 2: The method above will not work on the TI 85/86 as y1(G) does not mean f(G) but f(x)*G for the last value of x stored in RAM! Hence, the following program.
prgmNEWT :Disp "Guess?" :Input G :Disp "Number of Tangents?" :Input N :ClrHome :For(I,1,N,1) : Disp G : G  y1(G)/nDeriv(y1,x,G) > G :End
This program requires that you define y1=f(x), the function whose root you are estimating, in the y= screen before you run it. The program will generate a table of values converging to the root in question (closest to your initial guess) or divergent values for pathological f(x).
Method 3: This is the final program (finessing prgmNEWT with graphics). After you define y1 in the y= screen and get an appropriate viewing window showing the root in question, this program displays the convergence table, as prgmNEWT does, then displays a graph of f(x) with all the tangent lines also demonstrating convergence or divergence of the tangent line roots to the root of f(x). We acomplish this by storing all the xn's in L1 as an array of values to plot the tangent lines after the table loop has completed.
prgmNEWTG :{0} > L1 :Disp "Guess?" :Input G :Disp "Nunber of Tangents?" :Input N :ClrHome :For(I,1,N,1) : Disp G : G > L1(I) : G  y1(G)/nDeriv(y1,x,G) > G : If int (I/7) = I/7 : Then : Pause : ClrHome : End :End :Pause :"nDeriv(y1,x,L1)(xL1)+y1(L1)" > y2 :DispGraph
For these programs to work on the TI 85/86, simply change G  y1(G)/nDeriv(y1,x,G) > G to G  y1/nDeriv(y1,x,G) > G and add G > x right before the same line of code.
Enjoy!
Regards, A. Jorge Garcia  Teacher/Professor AppliedMathematics/ComputerScience BaldwinSHS/NassauCC http://freenet.buffalo.edu/~aj317 mailto:aj317@freenet.buffalo.edu 



