Plot Phase Planes ODEs Mathematica

Click For Summary

Discussion Overview

The discussion revolves around plotting phase planes for a system of ordinary differential equations (ODEs) using Mathematica. Participants explore methods for visualizing the system, including plotting null clines and stream plots, while addressing issues related to the equations' structure and variable assignments.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant asks how to plot different phase planes for a system of ODEs in Mathematica.
  • Another participant presents a system of ODEs and suggests using specific values for parameters.
  • Several participants propose using StreamPlot and Plot commands to visualize the system and null clines, discussing the syntax and structure of the commands.
  • There is confusion regarding the correct formulation of the ODEs, with one participant questioning the subscripts used in the equations.
  • Participants discuss the need for actual values for parameters to generate plots and suggest using specific numerical values.
  • One participant emphasizes that null clines correspond to specific points in the phase plane, not lines, and discusses the implications for plotting.
  • There are multiple suggestions on how to combine plots and clarify the representation of null clines.

Areas of Agreement / Disagreement

Participants express uncertainty about the correct formulation of the ODEs and the nature of null clines. There is no consensus on the best approach to plotting, as different methods and interpretations are proposed.

Contextual Notes

Participants mention various cases for the parameters and the need for clarity in plotting points versus lines. There is an ongoing discussion about the implications of the equations' structure on the plotting process.

Dustinsfl
Messages
2,217
Reaction score
5
How can I plot the different phase planes for a system of ODEs in Mathematica?
 
Last edited:
Physics news on Phys.org
$$
\displaystyle\begin{array}{lcl}
\displaystyle \frac{du_1}{d\tau} & \displaystyle = & \displaystyle u_1\left(1 - u_1 - a_{12}u_2\right)\\
\frac{du_1}{d\tau} & \displaystyle = & \displaystyle\rho u_1\left(1 - a_{21}u_1\right)
\end{array}
$$

Where $\rho,a_{12},a_{21}$ are constants.
 
Last edited:
I am pretty sure this works:

Show[StreamPlot[{(1 - x - 2 y), (1 - 2 x)}, {x, 0, 2}, {y, 0, 2},
Axes -> True]]

How can I plot the null clines simultaneously?

For the above phase plane, I used the case $a_{12},a_{21}>1$
 
dwsmith said:
I am pretty sure this works:

Show[StreamPlot[{(1 - x - 2 y), (1 - 2 x)}, {x, 0, 2}, {y, 0, 2},
Axes -> True]]

How can I plot the null clines simultaneously?

For the above phase plane, I used the case $a_{12},a_{21}>1$

Any time you want to plot multiple plots simultaneously, you can assign a Plot command to a variable like this:

PlotOne = Plot[x^2,{x,-2,2}]
PlotTwo = Plot[Sin[x],{x,-Pi,Pi}]

Then you show them simultaneously by doing

Show[PlotOne, PlotTwo]

So, if you can plot everything you need separately, this is a way to combine it all.
 
Ackbach said:
Any time you want to plot multiple plots simultaneously, you can assign a Plot command to a variable like this:

PlotOne = Plot[x^2,{x,-2,2}]
PlotTwo = Plot[Sin[x],{x,-Pi,Pi}]

Then you show them simultaneously by doing

Show[PlotOne, PlotTwo]

So, if you can plot everything you need separately, this is a way to combine it all.

Plotting the nullclines for these plots don't work the same since I have y and x terms. Do you know how to overcome that?
 
dwsmith said:
Plotting the nullclines for these plots don't work the same since I have y and x terms. Do you know how to overcome that?

It doesn't matter how you generate a plot, you can still assign it to a variable like PlotOne, PlotTwo. You could say

PlotThree = ImplicitPlot[...]

or

PlotFour = ContourGraphics[...]

etc.

Let's back up a bit and ask this question: is your problem the problem of showing multiple plots simultaneously, or is the problem plotting one thing in the first place?
 
Ackbach said:
It doesn't matter how you generate a plot, you can still assign it to a variable like PlotOne, PlotTwo. You could say

PlotThree = ImplicitPlot[...]

or

PlotFour = ContourGraphics[...]

etc.

Let's back up a bit and ask this question: is your problem the problem of showing multiple plots simultaneously, or is the problem plotting one thing in the first place?

plotting the null cline for

$
\frac{du_1}{d\tau}
$
 
Ah. So, is your system in Post # 2 correct? I'm a bit confused, since the subscripts appear to be the same everywhere. Should it be, rather,

\begin{align*}
\frac{du_1}{d\tau} & = u_1\left(1 - u_1 - a_{12}u_2\right)\\
\frac{du_2}{d\tau} & = \rho u_1\left(1 - a_{21}u_1\right)?
\end{align*}
 
Ackbach said:
Ah. So, is your system in Post # 2 correct? I'm a bit confused, since the subscripts appear to be the same everywhere. Should it be, rather,

\begin{align*}
\frac{du_1}{d\tau} & = u_1\left(1 - u_1 - a_{12}u_2\right)\\
\frac{du_2}{d\tau} & = \rho u_1\left(1 - a_{21}u_1\right)?
\end{align*}

the second one should be rho u_2
 
  • #10
dwsmith said:
the second one should be rho u_2

And what are $\rho, a_{21}$, and $a_{12}$?
 
  • #11
Ackbach said:
And what are $\rho, a_{21}$, and $a_{12}$?

a_{12} and a_{21} have 4 cases. Both greater than 1, less than 1, and then one less and greater. Rho positive.
 
  • #12
Well, ok, but you're going to have to have actual values in order to plot anything in Mathematica. Perhaps, if you're allowed to pick values, you could show me what commands you've used so far. The way I see it, you've got the two axes, and two other straight lines.
 
Last edited:
  • #13
Ackbach said:
Well, ok, but you're going to have to have actual values in order to plot anything in Mathematica. Perhaps, if you're allowed to pick values, you could show me what commands you've used so far. The way I see it, you've got the two axes, and two other straight lines.

For all my cases, I just used 2 and 1/2
 
Last edited by a moderator:
  • #14
dwsmith said:
For all my cases, I just used 2 and 1/2

So, using those values, what commands have you used so far?
 
  • #15
Ackbach said:
So, using those values, what commands have you used so far?
Here are my phase planes and one null cline since I can't get mathematica to graph a vertical line

View attachment 25https://www.physicsforums.com/attachments/26
 
  • #16
Try this sort of thing:

Code:
PlotOne = StreamPlot[{x(1-x-2y),y(1-2x)},{x,0,2},{y,0,2}];
PlotTwo = Plot[{(1-x)/2,{x,0,2}];
<< Graphics`ImplicitPlot`
PlotThree = ImplicitPlot[x==1,{x,0,2},{y,0,2}];
Show[PlotOne,PlotTwo,PlotThree]

My PlotThree line probably does not have the right equation in there. You might need x == 0, or whatever. Does this solve your problem?
 
  • #17
Ackbach said:
Try this sort of thing:

Code:
PlotOne = StreamPlot[{x(1-x-2y),y(1-2x)},{x,0,2},{y,0,2}];
PlotTwo = Plot[{(1-x)/2,{x,0,2}];
<< Graphics`ImplicitPlot`
PlotThree = ImplicitPlot[x==1,{x,0,2},{y,0,2}];
Show[PlotOne,PlotTwo,PlotThree]

My PlotThree line probably does not have the right equation in there. You might need x == 0, or whatever. Does this solve your problem?

Was the phase plan and null clines correct for that system of DEs?

That worked too thanks.
 
  • #18
dwsmith said:
Was the phase plan and null clines correct for that system of DEs?

That worked too thanks.

The first two lines of code in Post # 16 were taken directly from your first .jpg. To be honest, the version of Mathematica I have doesn't support the StreamPlot command, so I don't know much about it. One thing that puzzles me is what are the axes on these plots corresponding to? That is, what variables in your system of DE's are being plotted against which variables?

Your system is
\begin{align*}
\frac{du_{1}}{d\tau}&=u_{1}(1-u_{1}-a_{12}u_{2})\\
\frac{du_{2}}{d\tau}&=\rho u_{2}(1-a_{21}u_{1}).
\end{align*}

Null clines are by definition regions in the $u_{1}-u_{2}$ plane where the derivatives of the system are zero simultaneously. That is, we must have
\begin{align*}
0&=u_{1}(1-u_{1}-a_{12}u_{2})\\
0&=\rho u_{2}(1-a_{21}u_{1}).
\end{align*}
The $\rho$ disappears. The logic goes like this:

(Either $u_{1}=0$ OR $1-u_{1}-a_{12}u_{2}=0$) AND (Either $u_{2}=0$ OR $1-a_{21}u_{1}=0$).

There are four possibilities:

1. $u_{1}=0$ and $u_{2}=0$
2. $u_{1}=0$ and $1-a_{21}u_{1}=0$ (this one seems unlikely)
3. $1-u_{1}-a_{12}u_{2}=0$ and $u_{2}=0$
4. $1-u_{1}-a_{12}u_{2}=0$ and $1-a_{21}u_{1}=0$.

Each of these possibilities describe a single point in the $u_{1}-u_{2}$ plane. So, if the goal of your problem is to plot the null clines, then I'd say you need to plot the three points described by 1, 3, and 4.
 
  • #19
I let x = u_1 and y = u_2.

I just set rho to 1 since Mathematica won't graph with an unknown parameter.
 
Last edited:
  • #20
Have you been able to plot the three points described in Post # 18? Those ARE the null clines. If you're supposed to plot the null clines simultaneously with the stream plot, then you need to figure out how to plot individual points clearly (marked with an "x" or something).
 
  • #21
Ackbach said:
Have you been able to plot the three points described in Post # 18? Those ARE the null clines. If you're supposed to plot the null clines simultaneously with the stream plot, then you need to figure out how to plot individual points clearly (marked with an "x" or something).
Those lines are plotted already plotted. You sent the syntax to include them all prior.
 
  • #22
dwsmith said:
Those lines are plotted already plotted. You sent the syntax to include them all prior.

Ah, but the null clines for your system are three POINTS, not lines. Now, if you think it's clearer to just plot lines so that people can see the intersection, I suppose that'd be one way to present your solution. However, not all of the line represented by $1-a_{21}u_{1}=0$ is a null cline. Only one point on that line is a null cline.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K