2
$\begingroup$

Is this way correct to plot system of difference equation. For example

 StreamPlot[{(.2 (x^2) - x*y - .01 (y^2)), -.1 (y^2) + .9 x*
y + .02 (x^2)}, {x, -5, 5}, {y, -5, 5}, Axes -> True, 

enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

As far as I know, stream plot is for continuous time system (system of first order ode's) and not for difference equations (discrete system).

The system you posted is actually 2 ODE's and not difference equations. To show this, here is what you have

Clear["Global`*"];
StreamPlot[{(2 (x^2) - x*y - 1/100 (y^2)), -1/10 (y^2) + 9/10 x*y + 2/100 (x^2)}, 
        {x, -.1, 2}, {y, -.1, 3}, 
        Axes -> True, 
        StreamPoints -> {{{{1, 2}, Red}, Automatic}}]

enter image description here

The red trajectory above, is specific solution which passes through initial conditions $x(0)=1,y(0)=2$. To show this, here are the two ODE's, solved using NDSolve with initial conditions $x(0)=1,y(0)=2$ and the phase plot is given using ParametricPlot, which gives the same exact red solution curve above.

ode1 = x'[t] == (2 (x[t]^2) - x[t]*y[t] - 1/100 (y[t]^2));
ode2 = y'[t] == -1/10 (y[t]^2) + 9/10 x[t]*y[t] + 2/100 (x[t]^2);
{solX, solY} = NDSolveValue[{ode1, ode2, x[0] == 1, y[0] == 2}, {x, y}, {t, -10, 10}]

ParametricPlot[{solX[t], solY[t]}, {t, -10, 10}, 
   PlotStyle -> Red,  GridLines -> Automatic, GridLinesStyle -> LightGray]

enter image description here

Which gives the same solution from StreamPlot. This shows what you plotted is phase plot for 2 ODE's and not for difference equations.

It might be possible to do phase plot for difference equations ofcourse, but I do not think you can use StreamPlot for that. I do not know if Mathematica has special command for that, you might have to do it "manually". i.e. solve the two coupled difference equations, and do similar thing as ParametricPlot but for the discrete solutions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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