2
$\begingroup$

I have a system of non linear equations and from NDSolve I get the solution. I plot the phase space with ParametricPlot[{y1[t],y2[t]}/.solution,{t,0,10}]. I want to plot the vector field and I want your help.

To be more specific, I want to see whether the fixed points are stable or unstable. I know how to do it by watching them from nonlinear dynamics, but the vector field is a much more faster way to figure out about the stability of the fixed points.

$\endgroup$
3
  • 2
    $\begingroup$ Can you post more of your work up to this point? If you can, it will make for a much more interesting question and will likely get lots of interesting answers. $\endgroup$
    – Jagra
    Mar 26, 2013 at 21:02
  • $\begingroup$ related?[mathematica.stackexchange.com/questions/14160/… $\endgroup$
    – chris
    Mar 26, 2013 at 21:18
  • $\begingroup$ @chris You're right, I think it's a duplicate. Should have checked before I posted the answer. $\endgroup$
    – Szabolcs
    Mar 26, 2013 at 23:13

3 Answers 3

4
$\begingroup$

For an autonomous 2D system $$\begin{align} y_1'(t) &= P(y_1, y_2) \cr y_2'(t) &= Q(y_1, y_2) \cr \end{align}$$ the phase space is the flow of the vector field $(P, Q)$. This can be plotted with VectorPlot or StreamPlot:

{P, Q} = RotationMatrix[π/2].D[y2^2 - y1^3 + y1, {{y1, y2}}];
StreamPlot[{P, Q}, {y1, -2, 2}, {y2, -2, 2}]
(* P == -2 y2; Q == 1 - 3 y1^2 *)

StreamPlot

I'm only guessing that you have such a system, since the question did not specify.

$\endgroup$
2
$\begingroup$

To show a vector field, you can use VectorPlot or SreamPlot. You can also use the convenient EquationTrekker package to analyse the stability of a fixed point. It has a nice GUI.

As an example let's take the following simple differential equation: $x'(t) = (1 - x(t))$. It clearly has 1 as a stable fixed point.

With the EquationTrekker package, you can bring up the GUI like this:

<< EquationTrekker`

EquationTrekker[x'[t] == (1 - x[t]), x, {t, 0, 10}]

Then you can set several initial conditions with the mouse, and the trajectories will be automatically plotted:

enter image description here

I used a one-dimensional system for simplicity (= laziness), but EquationTrekker works with two-dimensonal ones as well.

With StreamPlot or VectorPlot, we can plot the vector field $\frac{d}{dt} (t, x(t)) = (1, \,x'(t))$ to find the same stable fixed point:

StreamPlot[{1, 1 - x}, {t, 0, 10}, {x, -1, 3}]
VectorPlot[{1, 1 - x}, {t, 0, 10}, {x, -1, 3}]

Mathematica graphics Mathematica graphics

$\endgroup$
0
$\begingroup$

VectorPlot will show the vector field, and StreamPlot will show the streamlines.

$\endgroup$
3
  • 1
    $\begingroup$ Suba, if you provide an example it will be more a useful answer. $\endgroup$
    – Verbeia
    Mar 26, 2013 at 21:38
  • $\begingroup$ Verbeia, I kind of agree. But don't you think it is really the question that dictates how specific the answer should be. I thought a generic answer would be more fitting for a generic question. $\endgroup$ Mar 26, 2013 at 21:45
  • $\begingroup$ Suba, even a generic answer benefits from an example of usage of the referenced functions. I am hinting that a more expansive answer might get you more upvotes. But it's up to you. $\endgroup$
    – Verbeia
    Mar 26, 2013 at 21:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.