MathGroup Archive 2000

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

Search the Archive

Getting number out of NDSolve

Hi, all,

I used Mathematica's function NDSolve to solve some coupled
differential equations. 

Following the example in the manual, the command was something like
sol = NDSolve[{ x1''[t] + eta x1'[t] + 2 Pi Sin[2 Pi x1[t]] - k
(x2[t]-x1[t]-a12[t]) == 0,
 x2''[t] + eta x2'[t] + 2 Pi Sin[2 Pi x2[t]] - k (x3[t]-x2[t]-a23[t])
+ k (x2[t]-x1[t]-a12[t]) == 0,
 x3''[t] + eta x3'[t] + 2 Pi Sin[2 Pi x3[t]] + k (x3[t]-x2[t]-a23[t])
== 0,
 x1[0] == 0, x2[0] == 1, x3[0] == 2, x1'[0] == x2'[0] == x3'[0] == 0},

(a12 and a23 functions were defined earlier, as well as the eta and k

Then, to plot the solutions, I used something like this:
Plot[{Evaluate[x1[t] /. sol],Evaluate[x2[t] /. sol],Evaluate[x3[t] /.
sol]}, {t,0,tmax}]

Worked just great! Solutions looked like what I expected.

However, when attempting to get a number for the functions x1,x2, or
x3, for a particular time, all my attempts fail short. 

I've tried things like N[x1[tmax]], or Evaluate[x1[tmax] /. sol, or
Evaluate[x1[t] /. sol /. t -> tmax, etc,etc. I can't get anything to
spit out a number.

I appreciate any help.


  • Prev by Date: Re: How to use BestFitParameters?
  • Next by Date: Re: Problem with antiderivtive of ArcSec
  • Previous by thread: two variable recurrence relations
  • Next by thread: Re: Need to reduce 2 lists so that only {x,y} pairs with same x remain