SUNY at Stony Brook -- Mathematics Department

Euler's Method for linear homogeneous second-order equations on the Texas Instruments TI-82 and TI-83 Calculators

This program applies Euler's method to the solution of the differential equation Y'' + c1Y' + c0Y = 0 on the X-interval [A,B]. The program prompts for input of A, B, initial values Y = Y(A), V = Y'(A)and the number N of steps. It displays the graph of the solution.

The program treats Y'' + c1Y' + c0Y = 0 as a set of two coupled first-order equations:
Y' = V
V' = -c1V - c0Y
The function -c1V - c0Y is stored in the Y= register as Y3.

For a readable display, you must first set the window size with Xmin = A, Xmax = B, and Ymin and Ymax appropriate for your problem.

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 EULER2, 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
:ClrDraw                     Clears the screen. DRAW (2nd PRGM), 1.
:FnOff                       Turns off the function graphing. Y-VARS
                             (2nd VARS),5,2.

:Prompt A,B,Y,V,N            Asks you to input A,B,Y,V,N. The Prompt
                             command is 2 on the PRGM --> 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 9 on the CTL menu: PRGM --> CTL,9
:Y + V*H -> Y
:V + Y3*H -> V               The new Y value is computed from the
:X+H->X                      current V value. The new V value is
                             computed from the equation. Then X is
                             updated. The symbol Y3 is selected from
                             the Y-VARS Function... menu.

:X->K:Y->L                   Pt-On(X,Y) draws a point at coordinates
:Pt-On(X,Y)                  (X,Y). The other two instructions work
:K->X:L->Y                   around the Pt-On's tendency to erase X and Y.
                             Pt-On is DRAW -> POINTS, 1.

:IS>(I,N)                    IS>( is on the PRGM --> 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 executes
                             the following instruction.
:Goto P                      Cycle back to location P. Goto is 0 
                             on the CTL menu.
:DispGraph                   Displays the graph. PRGM --> I/O,4.

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

Check: Enter -4Y in Y3, so the differential equation in question is Y''+ 4Y = 0, with general solution Y = A cos(2X) + B sin(2X). Prepare the window with Xmin = 0, Xmax = 10, and Ymin = -1.5, Ymax = 1.5 Run the program with A=0, B=10, Y=1, V=0, N=100. The window should display a good likeness of Y = cos(2X). Run it with A=0, B=10, Y=0, V=1, N=100. The window should display a good likeness of Y = (1/2)sin(2X).

Note: This program can also be used for more general second-order equations.

Anthony Phillips
Math Dept SUNY Stony Brook
March 26 2003