Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: NDSolve and InterpolatingFunction

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56129] Re: NDSolve and InterpolatingFunction
  • From: Peter Pein <petsie at arcor.de>
  • Date: Sat, 16 Apr 2005 03:52:12 -0400 (EDT)
  • References: <d3o06i$blo$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Virgil Stokes wrote:
> I am solving the following system of ODE's
> 
>    g = 9.81 ; (* acceleration of gravity [m/s^2] *)
>    d = 0.063; (* diameter of ball [m] *)
>    m = 0.05; (* mass in kg *)
>    \[Rho] = 1.29; (* air density, [kg/m^3] *)
>    \[Alpha] = \[Rho]  Pi  d^2/(8  m)
> 
>    h = 1; (* initial height [m] *)
>    v0 = 25; (* magnitude of ball velocity [m/s] *)
>    \[Theta] = 15  (* initial angle of release [15 degrees] *)
> 
>    vars = {x[t], vx[t], z[t], vz[t]}
> 
>    initc = {x[0] == 0, vx[0] == v0*Cos[\[Theta] Degree], z[0] == h,
>     vz[0] == v0*Sin[\[Theta] Degree]}
> 
>    v[t] = Sqrt[vx[t]^2 + vz[t]^2];
> 
>    eq1  = x'[t] == vx[t];
>    eq2 = vx'[t] == -0.508 \[Alpha] vx[t] v[t];
>    eq3 = z'[t] == vz[t];
>    eq4 = vz'[t] == -g - 0.508 \[Alpha] vz[t] v[t];
>    eqns = {eq1, eq2, eq3, eq4}
> 
>    sol = NDSolve[Join[eqns, initc], vars, {t, 0, 25}]
> 
> which works fine; but how can I find (e.g. using Solve) the value of t 
> such that z[t] is 0; i.e, where, z[t] (in the
> form of an InterpolatingFunction) is zero.
> 
> --V. Stokes
> 
Add the following lines:

zz[t_?NumericQ] := Evaluate[z[t] /. First[sol]]

FindRoot[zz[t], {t, 1.5}]

-- 
Peter Pein
Berlin


  • Prev by Date: Re: NDSolve and InterpolatingFunction
  • Next by Date: Re: removing subelements
  • Previous by thread: Re: NDSolve and InterpolatingFunction
  • Next by thread: Re: NDSolve and InterpolatingFunction