MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Projectile motion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79869] Projectile motion
  • From: Mike <mjp.1 at comcast.net>
  • Date: Tue, 7 Aug 2007 01:33:58 -0400 (EDT)

All:

I'd like to be able to stop the "disk" when it arrives at xmax. Can anyone give me a hint?

Thx,

Mike


Manipulate[
 Module[{eqns, soln, x, y, t}, 
  eqns = {x'[t] == v Cos[Theta], x[0] == 0, 
    y'[t] == -g t + v Sin[Theta], y[0] == 0}; 
  soln = Flatten[NDSolve[eqns, {x, y}, {t, 0, p}]]; 
  With[{d = x[p] /. soln, h = y[p] /. soln}, 
   Graphics[{Blue, Disk[{d, h}, .2]}, 
    PlotRange -> {{-.5, 12}, {-.5, 6}}, Frame -> True, 
    PlotLabel -> 
     TableForm[{"Theta =" <> 
        ToString[NumberForm[Theta 180/Pi , {2, 0}]], 
       "vx =" <> 
        ToString[NumberForm[Chop[N[v Cos[Theta]]] , {2, 1}]], 
       "vy =" <> 
        ToString[NumberForm[Chop[N[v Sin[Theta]]] , {2, 1}]], 
       "xmax =" <> 
        ToString[NumberForm[N[(v^2 Sin[2 Theta])/g] , {3, 2}]], 
       "ymax =" <> 
        ToString[
         NumberForm[N[(v Sin[Theta])^2/(2 g)] , {3, 2}]]}]]]], {{v,
    5, "Initial Velocity"}, 1, 
  10}, {{g, 9.8, "Gravitational Constant"}, 0, 
  30}, {{Theta, Pi/4 , "Theta"}, 0, Pi/
  2}, {{p, 0, "Animate"}, 0, 2, ControlType -> Trigger}]


  • Prev by Date: Re: Integro-differential analog of Love's equation via power
  • Next by Date: Re: ndsolve ndsv problem
  • Previous by thread: Re: Integro-differential analog of Love's equation via power
  • Next by thread: Re: Projectile motion