Hi,(adsbygoogle = window.adsbygoogle || []).push({});

So here's my latest problem as I get to grips with Mathematica. I will give a simpler version of the one I am actually doing.

I started with a closed set of differential equations. Consider the following equations

[tex]a'(t)=P*b(t)[/tex]

[tex]b'(t)=P^{2}*a(t)[/tex]

with known initial conditions and P is a constant. I solved it for a specific value of P using s=NDSolve[...] with the equations and initial conditions inside the NDSolve argument. I can get a plot of a(t) against t using Plot[Evaluate[a(t)/.s], {t, 0, Infinity}]. So far, so good.

Now, I want to get a feel for how the system behaves for an arbitrary P. I tried to upgrade s to a function that takes in argument p. That is, s[P_]=NDSolve[...] and this works as well. So now, I can input s[5] and get the solution of my DEs for P=5, say. Note that now, I have to use Plot[Evaluate[a(t)/.s[5], {t, 0, Infinity}] to get my plot of a(t) against t.

Similarly, I can get a plot of a[t] against P for a given t. That is, Plot[Evaluate[a(1)/.s[P], {P, 0, Infinity}] works too. But for some reason, this takes a very long time. It takes a good two or three minutes for each value of t. Why is it so slow?

I eventually want to get a 3D plot of a(t) against t and P. I'm not sure how to go about it and even if I did, if it takes two or three minutes for one value of t, it will never be able to do a 3D plot of all t and all P, will it?

Thank you for your help.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica plotting with a slightly complicated relationship between variables

Loading...

Similar Threads - Mathematica plotting slightly | Date |
---|---|

Mathematica Cannot Plot This Function in Mathematica | Feb 26, 2018 |

Is the integral for current correct? | Jul 7, 2017 |

Mathematica Plot Real Portion (Contour Plot) | Jun 21, 2017 |

Mathematica Add a rectangle to a plot to indicate range | Jun 15, 2017 |

Mathematica Part of complex plot disappears [mathematica] | Apr 19, 2017 |

**Physics Forums - The Fusion of Science and Community**