' File XVIIISpringB- -  Spring-Pendulum System

g = 9.801 :  pi = 3.14159
d = .5	                             ' Length of one meter.
m = 1                                     ' 1 kg mass.
k = 100                                  ' Restoring force in N/m
th = 10 pi / 180                  ' 10 degrees off center.

xo = d * Cos[th]                    ' xo
zo = d * Sin[th]                     ' yo 
	
uo = 0                                    ' Set Vx = 0.
wo = 1                                   ' Set Vy = 1    
to = 0  :  tf = 2.2                   ' Set time for pendulum motion.
V{a,b} = Sqrt[a^2 + b^2]

F{t,x,u,z,w} = u
G{t,x,u,z,w} = -k * x * (1 - d / V{x,z}) / m

H{t,x,u,z,w} =w
R{t,x,u,z,w} =  g - k * z * (1 - d / V{x,z}) / m

IVP[F,G,H,R,{to,tf, xo,uo,zo,wo} {1, 0.005, 2}]

' NOTE: Check out the phase plot. The model was derived with the downward motion (y-axis)
'  as positive.  Hence, the arc trace will appear upside down for the spring-pendulum motion.
' See File XVIIISpring for additional information.


