Retrieving some results out of an approximate solution of a ballistics
- To: mathgroup at smc.vnet.net
- Subject: [mg131979] Retrieving some results out of an approximate solution of a ballistics
- From: sigismond kmiecik <sigismond.kmiecik at wanadoo.fr>
- Date: Fri, 8 Nov 2013 16:24:25 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
I adapted and copied below a few lines of a notebook dealing with projectile motion seen on the Wolfram Demonstration Project. v = 10.; \[Theta] = Pi/4.; h = 0.; g = 9.8; \[Kappa] = 0.5; (* initial speed, \ angle, height, gravity constant, drag constant *) eqns = {x''[t] == -\[Kappa] x'[t], x'[0] == v*Cos[\[Theta]], x[0] == 0, y''[t] == -g - \[Kappa] y'[t], y'[0] == v*Sin[\[Theta]], y[0] == h}; soln = Flatten[ Quiet@NDSolve[eqns, {x, y}, {t, 0, Infinity}, Method -> {"EventLocator", "Event" -> y[t], "EventAction" :> Throw[tf = t, "StopIntegration"], "Direction" -> -1}, MaxSteps -> Infinity]]; (* soln : approximate solution *) Show[{ParametricPlot[{x[t], y[t]} /. soln, {t, 0, tf}, AxesOrigin -> {0, 0}, ImageSize -> {400, 400}, ImagePadding -> All, AxesLabel -> {Style["Range", Bold, "Label"], Style["Height", Italic, Bold, "Label"]}, ImagePadding -> 30]}] I would like to get other results than the ones obtained in that notebook, speed and angle of trajectory at time of maximum height (angle should then be zero ) and time of fall, using a method similar to the one below with the approximate ODE solution as input: ymax = Quiet@FindMaximum[{y[t] /. soln, 0 <= t <= tf}, {t, 0}] (* maximum height - time of max height *) xmax = Quiet@FindMaximum[{x[t] /. soln, 0 <= t <= tf}, {t, 0}] (* horizontal distance - time of fall *) And last question, how can I get a parametric plot speed versus range? Replacing in the Show expression above x[t] and y[t] by x'[t] and y'[t] produces a graphic with an incomprehensible line. Thanks Sigismond Kmiecik