<text>step size constant... how far in the x direction do we go each iteration.</text>
<val>0.05</val>
<form>0.05</form></cell>
<cell>
<cname>home</cname>
<text>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 go to cell y, and choose Evaluate 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:
h:= (const value of step size)
a:= (const coefficient of restitution)
k1:=h*yp
k1p:=-a*h*y
k2:=h*(yp+k1p!/2)
k2p:=-a*h*(y+k1!/2)
k3:=h*(yp+2*k2p!-k1p!)
k3p:=-a*h*(y+2*k2!-k1!)
y:=y+(k1!+4*k2!+k3!)/6
yp:=yp+(k1p!+4*k2p!+k3p!)/6
</text></cell>
<cell>
<cname>k1</cname>
<val>0.25</val>
<form>h*yp</form></cell>
<cell>
<cname>k1p</cname>
<val>0.43</val>
<form>-a*h*y</form></cell>
<cell>
<cname>k2</cname>
<val>0.26</val>
<form>h*(yp+k1p!/2)</form></cell>
<cell>
<cname>k2p</cname>
<val>0.43</val>
<form>-a*h*(y+k1!/2)</form></cell>
<cell>
<cname>k3</cname>
<val>0.27</val>
<form>h*(yp+2*k2p!-k1p!)</form></cell>
<cell>
<cname>k3p</cname>
<val>0.42</val>
<form>-a*h*(y+2*k2!-k1!)</form></cell>
<cell>
<cname>y</cname>
<text>y is the displacement variable in the simple harmonic motion.</text>