How to plot the result of NDSolve?

  • Thread starter Thread starter panzer7910
  • Start date Start date
  • Tags Tags
    Plot
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 replies · 3K views
panzer7910
Messages
2
Reaction score
0
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]
 
on Phys.org
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