Re: How NDSolve counts Conditions
- To: mathgroup at smc.vnet.net
- Subject: [mg18800] Re: [mg18782] How NDSolve counts Conditions
- From: "Richard Finley" <rfinley at medicine.umsmed.edu>
- Date: Thu, 22 Jul 1999 08:19:22 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Jay, Try adding the two missing solutions to your solution set: {x[t],vx[t],y[t] ,vy[t]} rather than just the {x[t],y[t]} and I think you will find it works OK. RF >>> "jay nospam beatty" <nhi at nospam_netaxis.com> 07/19/99 11:33PM >>> I've been trying to build a simple earth orbit model: orbitsolution[x0_, vx0_, y0_ , vy0_] := NDSolve[ {x'[t] == vx[t], vx'[t] == -gravParam /(dis[t]^2) * Cos[\[Phi][t]] , y'[t] == vy[t], vy'[t] == -gravParam /(dis[t]^2) * Sin[\[Phi][t]] , x[0] == x0, vx[0] == vx0, y[0] == y0, vy[0] == vy0 } , {x[t] , y[t]} , { t,0,10^8} ] As far as I can see, I have 4 diff equations and 4 conditions. Yet when I try for an altitude of 700,000 km and y velocity of 100 km/sec, I get: fullsolorbitsolution[7 10^5, 0 , 0 , 100] NDSolve::"ndnef": "The number of differential equations (\!\(4\)) is not equal to the \ number of initial conditions (\!\(2\))." I get the same result if I reduce my conditions - even to none! On the other hand it does not have the same problem if I don't define velocity, but only acceleration: torbitsolution[x0_, vx0_, y0_ , vy0_] := NDSolve[ {x''[t] == -gravParam /(dis[t]^2) * Cos[\[Phi][t]] , y''[t] == -gravParam /(dis[t]^2) * Sin[\[Phi][t]] , x[0] == x0, x'[0] == vx0, y[0] == y0, y'[0] == vy0 } , {x[t] , y[t]} , { t,0,10^8}] fullsoltorbitsolution[7 10^5, 0 , 0 , 100] which gives me a list of interpolating functions I can't seem to copy. How is M counting equations and conditions? Thanks. Jay