Newton's Method


This program searches for a root of a function. It converges for most functions, but in some cases goes into oscillation. To prevent the program from running indefinitely, you can specify a limit for the number of iterations.


Introduction

The Newton's method program uses the Newton-Raphson technique to search for a root of a function. For many functions, any initial guess leads quickly to a root. However, an initial guess near the desired root usually shortens execution time.

You must enter the function as a subroutine in program memory before running the program. When the program calls the subroutine, the value for the independent variable is available in both the display and data register A (000).

If the function is a polynomial, you can use the Q-D method to obtain an initial guess.

Reference

Handbook of Engineering Fundamentals, Ovid W. Eshbach, John Wiley & Sons, Inc., New York, 1954, pp. 2-16.

For the Beginning Programmer

Before using the Newton's method program, you must store the function as a subroutine in program memory.

If you are not familiar with keystroke programming, refer to the following chapters in the RPD-95 Programming Guide for instructions.
  • "Working with Programs on the RPD-95"
  • "Using Calculator Keystrokes in a Program"
  • "Controlling the Sequence of Operations"

Rules for Storing the Function

When you store the function as a subroutine, follow these rules.
The subroutine must be labeled fx (lowercase only).
  • Anytime the subroutine needs the independent variable, use a RCL A or RCL 000 instruction.
  • The subroutine must terminate with a RTN instruction.

Starting the Program

To start the program that uses Newton's method:
  1. Store the function as a subroutine, following the rules listed above.
  2. If the subroutine involves any of the trig functions, select the angle units you want to use.
  3. Select { ZRO } from the MATHEMATICS menu.
    The calculator displays the FUNCTION ZEROS menu.
  4. Press { NTN }.
    The program displays:
    D_rUM6Yp
  5. Enter the initial guess and press { xo }.
  6. Enter the allowable error and press { err }.
  7. Enter the maximum number of iterations and press { #it }.

Finding the Root

After you enter the parameters for the program, you can find the root of the function you have stored.
  1. Press { EOD }.
    If the program is able to find a root within the number of iterations you specified, it displays:
    D_v9vNC6where the value shown is the root found within the allowable error.
    If the program cannot find a root within the specified number of iterations, it displays:
    D_allfnI
    • To display delta, press { del }.
    • To perform additional iterations, press { #it }, and press { EOD }. The program continues the calculations for the number of iterations you specify.


Back