SUNY at Stony Brook -- Mathematics Department

Euler's Method on the Texas Instruments TI-82 and TI-83 Calculators


This program applies Euler's method to the solution of the differential equation Y'=f(X,Y) on the X-interval [A,B]. The program prompts for input of A, B, an initial value Y = Y(A) and the number N of steps. It displays the resulting approximate value for Y(B). The function f is stored in the ``Y='' register as Y3. To key in the program, start from the main screen (hit QUIT if you are somewhere else), hit PGRM and select NEW from the menu. The calculator goes into Alpha-lock mode and prompts you for the Name of the new program. Type in EULER, for example, and hit ENTER. Calculator will move to a new line and display a colon : which means the beginning of an instrction. Hit ENTER after each instruction has been keyed in. Calculator will move to a new line and display the colon.
Program                      Explanation and Keying instructions

:Prompt A,B,Y,N              Asks you to input A,B,Y,N. The Prompt
                             command is 2 on the I/O menu. The comma
                             key is just below SIN.
:(B-A)/N -> H                Calculate the step-size H. -> is one
                             character, obtained by pressing STO.
:A -> X
:1 -> I                      Initialize X and the counter I
:Lbl P                       Label this spot in the program as P.
                             Lbl is on the CTL menu.
:Y + Y3*H -> Y
:X + H -> X                  The new Y value is computed from the
                             current X and Y values. Then X is
                             updated. The symbol Y3 is selected from
                             the Y-VARS Function... menu.
:IS>(I,N)                    IS>( is on the CTL menu. This command
                             adds 1 to the counter I and then tests
                             if the new value is greater then N. If
                             it is, the following instruction is skipped
                             (so the program displays the current value 
                             Y and terminates). Otherwise it cycles back
                             back to location P.
:Goto P                      Goto from the CTL menu.
:Disp Y

To finish keying the program hit QUIT (2nd MODE). To run it, enter the expression for f(X,Y) in the Y3 position (use the Y= key). Then QUIT to get back to the main screen, PGRM and select EXEC EULER from the menu.

Check: Enter Y in Y3, so the differential equation in question is Y'= Y, with solution Y = C exp(X). Run the program with A=0, B=1, Y=1, N=10. The result should be 2.59374246.

Exercise: Show that if f(X,Y) (the expression entered in Y3) is a function of X alone, then the number this program gives with initial value Y=0 is the left-hand sum approximation to the integral of f from A to B with N equal subdivisions.



Anthony Phillips
Math Dept SUNY Stony Brook
tony@math.sunysb.edu
September 7 1997