Re: NDSolve problem

*To*: mathgroup at christensen.cybernetics.net*Subject*: [mg921] Re: NDSolve problem*From*: withoff (David Withoff)*Date*: Wed, 3 May 1995 00:00:07 -0400*Organization*: Wolfram Research, Inc.

In article <3nkcth$n02 at news0.cybernetics.net> pitts at mayo.EDU (Todd Pitts) writes: >I have been using NDSolve[] to investigate the solutions to some large, >sets of simple, ordinary differential equations. It is most convenient >to use subscripted variables/functions and parameters to represent the large number >of solution functions and system characteristics. For certain values >of coefficients the solution proceeds nicely, however, for others I obtain > > eq={4.0*D[x[1][t],{t,2}]==x[1][t]-Sin[t]}; > bc={Evaluate[D[x[1][t],t] /. t->0]==0,x[1][0]==0}; > sys=Join[eq,bc]; > NDSolve[sys,x[1],{t,0,10}] > >NDSolve::ndnum: Differential equation does not evaluate to a number at t = 0.. > >Out[32]= {{x[1] -> InterpolatingFunction[{0., 0.}, <>]}} > >Thanks in Advance, > >Todd Pitts Try using SetAttributes[x, NProtectedAll] so that NDSolve doesn't try to convert the index in x[1] into an inexact number. This should fix the problem. In the process of computing numerical values of the derivatives, the index in an indexed variable like x[1] will sometimes (depending on the form of the equations) be converted to an inexact number, and the new variable x[1.] is not recognized as being the same as the original one. This problem has been fixed for the next version. Dave Withoff Research and Development Wolfram Research