RE: inverse square law attraction
- To: mathgroup at smc.vnet.net
- Subject: [mg34898] RE: [mg34884] inverse square law attraction
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 12 Jun 2002 02:15:28 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dick, Here are your equations... Clear[x, y]; eqns = {y''[t] == -y[t]/(x[t]^2 + y[t]^2)^(3/2), x''[t] == -x[t]/(x[t]^2 + y[t]^2)^(3/2), x'[0] == 0, y'[0] == 1.2, y[0] == 0, x[0] == 1} This solves them. Solve for x and y, not x[t] anmd y[t]. sols = NDSolve[eqns, {x, y}, {t, 0, 15}][[1]] {x -> InterpolatingFunction[], y -> InterpolatingFunction[]} This uses the solutions to create a parametrization... {x[t_], y[t_]} = {x[t], y[t]} /. sols {InterpolatingFunction[{{0., 15.}}, "<>"][t], InterpolatingFunction[{{0., 15.}}, "<>"][t]} This plots the orbit... ParametricPlot[{x[t], y[t]}, {t, 0, 15}]; You can do calculus on InterpolatingFunctions, so this plots the hodograph... ParametricPlot[{x'[t], y'[t]}, {t, 0, 15}]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > From: Dick Boardman [mailto:boardman at onetel.net.uk] To: mathgroup at smc.vnet.net > > I have a question I would be pleased if someone would answer. > > I am studying planetary motion under the inverse square law attraction. > > I use NDSolve to find the numerical solution to > > y''[t]====-y[t]/(x[t]^2+y[t]^2)^(3/2) > x''[t]====-x[t]/(x[t]^2+y[t]^2)^93/2) > x'[0]==0 > y'[0]==1.2 > y[0]==0 > x[0]==1 > > And get a very satisfactory ellipse. However, I would like to > check the hodograph > ( a parametric plot of x'[t] and y'[t] > against time. NDSolve must have calculated values for x'[t] and > y'[t] but I > cannot find them. Where are they please? > > R.M.Boardman >