Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Getting number out of NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24404] Getting number out of NDSolve
  • From: colton at socrates.berkeley.edu (John S. Colton)
  • Date: Tue, 18 Jul 2000 00:58:04 -0400 (EDT)
  • Organization: University of California at Berkeley
  • Sender: owner-wri-mathgroup at wolfram.com

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
this:
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},
 {x1,x2,x3},{t,0,tmax}]

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

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.

John


  • 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