4th-order Runge-Kutta Method for numerically approximating solutions of the IVP:
dy/dx=f(x,y), y(x0)=y0

/* User input comes first */
dydx: -1.2*y-9.8   $/* dy/dx = f(x,y) */
x0: 0   $/* Initial x-value */
y0: 20   $/* Initial y-value */
h: 0.1   $/* Ending x-value */
steps: 10   $/* Number of steps --- Ending x-value will be x0 + steps*h */
/* End of user input */

xx: float(x0)$ yy: float(y0)$
print("Step size = ", h)$
print("x",0,"=", xx, ", y",0,"=", yy)$
for i: 1 thru steps do
   (
   k1: h * ev( dydx, numer, [x=xx,y=yy] ),
   ww: yy + k1/2,
   k2: h * ev( dydx, numer, [x=xx+h/2,y=ww] ),
   ww: yy + k2/2,
   k3: h * ev( dydx, numer, [x=xx+h/2,y=ww] ),
   ww: yy + k3,
   k4: h * ev( dydx, numer, [x=xx+h,y=ww] ),
   yy: yy + ( k1 + 2*k2 + 2*k3 + k4 ) / 6.0,
   xx: xx + h,
   print("x", i, "=", xx, ", y", i, "=", yy)
   );