This program was written by Walter Gray and is used here by permission.
This program is supplied without representation or warranty of any kind. The author and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.
This program integrates first order DEs by the 4th-order Runge-Kutta method. This shows what can be achieved in 49 steps! Equations are of the form dy/dx = f(x,y)
Step | Instructions | Input Data/Units | Keys | Output Data/Units |
1 | Enter program | |||
2 | Enter equation between steps 4 and 15 inclusive. | |||
3 | Initialize | 1 | STO 6 | |
Note: This step clears the Last X register | 0 | × | ||
STO 7 | ||||
4 | Enter data | X(init) | STO 0 | |
Y(init) | STO 1 | |||
5 | Enter step size (h) divided by 2 | h | ENTER↑ 2 ÷ | |
STO 2 | ||||
6 | Run | f PRGM, R/S | Y (after advancing X by one h step) | |
7 | Repeat 5 as required (Register values may be inspected between each step, but the last-x register must not be changed) |
y' = 1 - x + 4×y
Add this program fragment to evaluate y' starting at line 4:
04 4 must use Y value found in x register 05 × 06 1 07 + 08 RCL 0 get X 09 - 10 GTO 16 x reg. now contains dy/dx
initialize:
X(init)=0, Y(init)=1.0, h=0.1 (enter 0.05 in reg 2)
result:
after 1st step, Y=1.608 933 333
after 2nd step, Y=2.505 006 151
etc.
LINE KEYS 00 01 RCL 1 02 f LAST x 03 + x reg holds working value of Y Enter equation between steps 04 and 15 inclusive. Use Y from x reg and X from reg 0. Can use registers 3,4,5. If equation uses less than 12 steps, last step must be GTO 16 16 RCL 2 17 × 18 STO + 7 19 × 20 1 21 STO + 6 22 RCL 6 23 f x=y 24 GTO 42 25 2 26 f x=y 27 GTO 39 28 f LAST x 29 STO + 7 30 RCL 6 31 4 32 f x≠y 33 GTO 01 34 STO - 6 35 f LAST x 36 2 37 × 38 × 39 RCL 2 40 STO + 0 41 GTO 01 42 RCL 7 43 3 44 ÷ 45 STO + 1 46 cl x 47 × 48 STO 7 49 RCL 1 display Y
R0 initial X value, working value of X R1 initial Y value, latest Y R2 half step size h/2 R3-R5 free R6 control integer R7 accumulator
Go back to the software library
Go back to the main exhibit hall