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 YTo 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.