Euler's Method of Numerical IntegrationThis program for HP 39gs (HP 40gs) 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 Function Aplet "F1(X)". To key in the program, Press [SHIFT] [PROGRAM] and give it a name - Type in EU, for example, and press [ENTER] key. 
Type in the following program sequence: (B-A)/N Press {STO>} H: Press [ENTER] key Y Press {STO>} Z:1 Press {STO>} I:E Press {STO>} X: Press [ENTER] key FOR I=1 TO N STEP 1; Press [ENTER] key Z+F1(X)*H Press {STO>} Z: Press [ENTER] key X+H Press {STO>} X: Press [ENTER] key END: Press [ENTER] key MSGBOX Z: Press [ENTER] key The screen should look like this:
 Press [SHIFT] [PROGRAM] to return to the program list. You can download this Euler Aplet for HP39g+, HP39gs or HP40gs. Go to [SHIFT] [PROGRAM] and {RECV} to upload into your calculator. --- How the Euler program work? Following are variables used... A = x0 (First value). B = Final Estimate for Y. Y = y0 (Initial value of Y). N = Steps. H = Size of each step. X = Increment (of H) after each step. F1(X) = Differential Equation stored in Symbolic Function. Z = Result User provide A, B, Y and N. User provide the Differential Equation. Calculate H. Loop through the steps to calculate Z. --- To check that you have enter the program correctly. Enter Y into F1(x), so the differential equation in questionis Y'= Y, with solution Y = e^(X)+1. Run the program with A=0, B=0.5,Y=1, N=5. Press [SYMB] Enter the following into F1(X):
 Press the [Home] Enter the following variables:
 And Press [ENTER]. Where A=0, B=0.5,Y=1, N=5. Type RUN EU and press [ENTER].
 The result will be prompted. The result should be 2.1168.
|