Re: How NDSolve counts Conditions

*To*: mathgroup at smc.vnet.net*Subject*: [mg18805] Re: [mg18782] How NDSolve counts Conditions*From*: David Withoff <withoff at wolfram.com>*Date*: Thu, 22 Jul 1999 08:19:24 -0400*Sender*: owner-wri-mathgroup at wolfram.com

> 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: > > fullsol = orbitsolution[7 10^5, 0 , 0 , 100] > > NDSolve::"ndnef": > "The number of differential equations (\!\(4\)) is not equal to the \ > number of initial conditions (\!\(2\))." > > How is M counting equations and conditions? > > Thanks. > > Jay Replace {x[t] , y[t]} by {x[t] , y[t], vx[t], vy[t]} so that all of the functions are included. NDSolve needs to know the names of functions for which it is to solve. Only equations that include derivatives of the listed functions are counted as differential equations. Dave Withoff Wolfram Research