' File: XVIII -- Golf Trajectory

'     X" = -k * V * (Cd * Vx  +  Cl * Vy)   and   Y" = k * V * (-Cd * Vy + Cl * Vx)  -g  where
cd = 0.21           '     drag coefficient
cl=0.2                 '     lift coefficient
k = 0.0181829  '      A constant dependent on the golf ball radius, mass, etc.
g = 9.801 : pi = 3.14159
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
V{a,b} = Sqrt[a^2 + b^2]       ' |V|

F{t,x,u,z,w} = u
G{t,x,u,z,w}  = -k * V{u,w} * (cd *u + cl * w)

H{t,x,u,z,w} = w
R{t,x,u,z,w} =  -k * V{u,w} * (cd *w - cl * u) - g

' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
v = 88 :  th = 11.5 * pi/180    ' Initial Conditions: |V| = 88 m/s at 11.5 degrees.
uo =  v * Cos[th]     ' Vxo
wo =  v * Sin[th]      ' Vyo
xo = 0 : zo = 0        ' (Parameter z is the y-variable in this coupled system.)
to = 0 :  tf = 7.5      ' Test trial time for Trajectory path.

IVP[F,G,H,R,{to,tf,xo,uo,zo,wo} {1, 0.05, 2}]           ' Mode 2 only for this model.

' Plot Y vs X and set scales: x = 20 and y = 5 units.

