How to plot the result of NDSolve?

  • Thread starter panzer7910
  • Start date
  • #1
1) I solved 9 coupled non linear differential equation and Mathematica give me the result like this.

{{y1[t]->InterpolatingFunction[{{0.001,0.01}},<>][t],
y2[t]->InterpolatingFunction[{{0.001,0.01}},<>][t],
y3[t]->InterpolatingFunction[{{0.001,0.01}},<>][t],
y4[t]->InterpolatingFunction[{{0.001,0.01}},<>][t],
y5[t]->InterpolatingFunction[{{0.001,0.01}},<>][t],
y6[t]->InterpolatingFunction[{{0.001,0.01}},<>][t],
y7[t]->InterpolatingFunction[{{0.001,0.01}},<>][t],
y8[t]->InterpolatingFunction[{{0.001,0.01}},<>][t],
y9[t]->InterpolatingFunction[{{0.001,0.01}},<>][t]}}


How can I plot each of the function (y1 to y9) separately?

2) To solve a single differential equation (refer to the Mathematica NDSolve Help) and plot it, why we must divide by the answer itself? I mean, in this case, why should I divide by " .s " ?

s = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}]

Plot[Evaluate[y[x] /. s], {x, 0, 30}, PlotRange -> All]
 

Answers and Replies

  • #2
chiro
Science Advisor
4,790
132
Hey panzer7910 and welcome to the forums.

Upon looking into the documentation, the expression with the s has to do with expression simplification. Remember that you have an Evaluate command nested within, and this will evaluate an expression with your ./ s parameter.

What looks to be happening is that it is making a substitution so that the function actually gets evaluated instead of having a purely symbolic representation, but I would double check.

http://reference.wolfram.com/mathematica/guide/Expressions.html

http://reference.wolfram.com/mathematica/ref/ReplaceAll.html

http://reference.wolfram.com/mathematica/guide/Rules.html

http://reference.wolfram.com/mathematica/ref/ReplaceAll.html
 

Related Threads on How to plot the result of NDSolve?

Replies
6
Views
7K
  • Last Post
Replies
2
Views
2K
Replies
1
Views
2K
Replies
2
Views
972
  • Last Post
Replies
3
Views
854
  • Last Post
Replies
3
Views
876
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
1
Views
52K
Replies
2
Views
42K
Top