keybd
INPUT
yes
screen
home
lf
swiss13
on
%j,%y
100
nolist
fmt
\n\N:=\F\n
yes
1
yes
fixed
2
degrees
off
27520.00
27500.00
10.00
-10.12
10
10
j,y
a
1 |
h
step size constant... how far in the x direction do we go each iteration.
0.05
|
home
This is the home cell for a demonstration of a numerical solution to the differential equation describing simple harmonic motion:
y''= -a*y
To execute the demonstration, put initial values into cells y and yp, then position to the home cell, and choose Execute from the Special menu.
This example computes successive values of y and yp (y') with third order accuracy. The Runge-Kutta formulae come from "Advanced Calulus For Engineers", by F.B. Hildebrandt, Prentice Hall, 1949.
These formulae are summarized below:
a:=
h:=0.05
home:=j! yold! ypold! y! yp!
j:=j+1
k1:=h*ypold
k1p:=-a*h*yold
k2:=h*(ypold+k1p!/2)
k2p:=-a*h*(yold+k1!/2)
k3:=h*(ypold+2*k2p!-k1p!)
k3p:=-a*h*(yold+2*k2!-k1!)
y:=yold+(k1!+4*k2!+k3!)/6
yold:=y
yp:=ypold+(k1p!+4*k2p!+k3p!)/6
ypold:=yp
9.93
|
j
27520.00
|
k1
0.49
|
k1p
0.08
|
k2
0.50
|
k2p
0.07
|
k3
0.50
|
k3p
0.06
|
y
y is the displacement variable in the simple harmonic motion.
-1.11
|
yold
-1.60
|
yp
9.93
|
ypold
9.86
|