# Phase space vector field [duplicate]

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.

-

## marked as duplicate by Szabolcs, Michael E2, whuber, s0rce, JensMar 27 '13 at 4:23

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. –  Jagra Mar 26 '13 at 21:02
–  chris Mar 26 '13 at 21:18
@chris You're right, I think it's a duplicate. Should have checked before I posted the answer. –  Szabolcs Mar 26 '13 at 23:13

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:

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}]


-

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 *)
`

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

-

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

-
Suba, if you provide an example it will be more a useful answer. –  Verbeia Mar 26 '13 at 21:38
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. –  Suba Thomas Mar 26 '13 at 21:45
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. –  Verbeia Mar 26 '13 at 21:59