# Plot 2-D system difference equations

If I have 2-D system difference equations x(n+1)=x(n)-5y(n) , y(n+1)= 2x(n)+y(n) I need to plot this system. I did :

StreamPlot[{x - 5 y , 2 x + y} == {x, y}, {x, -1, 1}, {y, -1, 1}]


Is this code correct ? Thank you so much

• What about just solving that system with RSolve?
– Alx
Mar 18 '20 at 2:09

I don't think this is quite correct. To test my hypothesis, I created this:

NextXY[{x_, y_}] := {x - 5 y, 2 x + y}


Then, I created some points:

somePoints = {#, NextXY[#]} & /@
Flatten[Table[{x, y}, {x, -1, 1, .2}, {y, -1, 1, .2}], 1];


And plotted them with arrows:

Graphics[Arrow[#] & /@ somePoints]


This looks a whole lot more like this stream plot:

StreamPlot[{x - 5 y, 2 x + y}, {x, -1, 1}, {y, -1, 1}]


• Interesting, seems like my (now deleted) comment wasn't right. But this doesn't exactly match up a trajectory either. Try pts = NestList[NextXY, {0.002, 0}, 5]; ListLinePlot[pts, PlotRange -> All]. Maybe a StreamPlot just isn't a good idea for a discrete-time system. Mar 18 '20 at 1:56
• Hi guys, solving by hands, i got the eigenvalues are complex. {1 + I Sqrt[10], 1 - I Sqrt[10]}. so it looks spiral unstable?
– S A
Mar 19 '20 at 3:13