PROGRAMMING NEWTON'S METHOD
|You can use the programming capability of your graphing calculator to quickly and easily perform the iterations in Newton's Method.
First, recall Newton's Method is for finding roots (or zeros) of functions. In order to use Newton's Method, you need to (1) make a first "guess" as to what you think the root is and (2) find the derivative of the function. You then use the following, easily-derived formula (where is your first guess) to arrive at your second guess, called :
Example: . Again, we are trying to find when .
A good first guess is , since , and .
We can then continue this process iteratively, using as our next "guess":
This repetitive, calculation-heavy process is exactly what a calculator program would be appropriate for. To program this example into your graphing calculator, follow these steps:
Press the key on your calculator. You should get the following screen:
Use the right arrow key to move over to "NEW" to get the following screen:
Press to create a new program. You should now see this screen:
At this point, you must name your program. You may use a combination of up to eight letters and numbers, but the first character must be a letter. Note that the Alpha Lock is on so that you will automatically get letters when you press the calculator's keys (to tun off Alpha Lock, press ).
After naming the program NEWT and pressing , we get the following screen:
We are now ready to enter the steps in our program. The colon ( : ) indicates the beginning of a line of code. The first thing we want to happen when we run or "execute" the program is for the calculator to ask us for our initial guess. We do this by putting an "INPUT" line in the program. To do this, press again and use the right arrow key to move over to I / O, at which point you should see the following screen:
Since Input is what we want, simply press , and you should see the following screen:
We now need to name the variable that we want to input when we run the program. We can use any single letter we like, but X is an obvious, easy choice, so press the key, followed by to get:
Next, we want the program to apply Newton's Rule and perform the calculation . Eventually we will store in Y1 and in Y2 (the same Y1 and Y2 we use when graphing functions), so we need to enter our calculation in the next step of the program, namely:
X-Y1 / Y2
We begin by entering "X-" in the next line of the program:
To access the "Y Variables," press the key, the right arrow key to move over to the "Y-VARS" menu:
Press to go to the standard key to get the "Function" screen:
Since we want Y1 , just press to select it, taking us back to the program screen:
We next enter the division sign ( / ), and then go back to the "Function" screen to select Y2:
.Before leaving this line of the program, we need to store this value in another variable, call it Z. We do this by pressing and then the letter Z (don't forget to press the Alpha key first). After pressing , you should see the following screen:
We're almost finished! The calculator now knows the result of Newton's Method, so we just have to instruct the program to tell us. Once again, press , and move over to I / O, and press for Disp (short for Display). Your screen should look like this:
Since the result of our calculation is what we want to display, enter Z to get:
That's it! To quit the programming mode, press .
Now, the only thing remaining is to do before we run the program is to tell it what Y1 and Y2 are. To do this, press and enter the function in Y1 and its derivative in Y2 in the usual way:
To run the program, press . Since EXEC is already selected and NEWT is the only program in our list, press to begin executing or running the program. The screen will now show prgmNEWT. Press again to start. You should get a ? mark prompt. This is the program's way of asking you to enter your first guess. In our example, our first guess was 1. Press 1 followed by to get the following:
You should recall that 0.8 was our first answer when we did it manually.
To do a second iteration, since we are still in the execute mode, simply press again. You should get the ? prompt again. We could type in .8, but we can use the ANS key () to easily input 0.8 for X. After pressing again, you should see the following:
We can continue this process iteratively as long as we want, but after just a few times, we'll discover that the answer (to 10 decimal places) stops changing (see screen below). Newton's Method is that good (and fast!).
To do this process for a different function, all we need to do is change Y1 (the function) and Y2 (its derivative, and then simply run the program again.