# Plot linear difference equations

How can I plot an unstable node, saddle, and center in linear two-dimensional difference equations? I can plot the stable node, please see the code. Thank you in advance.

Clear[A, pts1, pts2, pts]

A = {{.80, 0}, {0, .64}};

pts1 = Table[NestList[A.# &, {k, 3}, 20], {k, -3, 3}];

pts2 = Table[NestList[A.# &, {k, -3}, 20], {k, -3, 3}];

p1 = ListLinePlot[pts1, PlotStyle -> PointSize[Medium],
PlotRange -> {{-3.1, 3.1}, {-3.1, 3.1}},

AspectRatio -> Automatic] /.

Line[x_] :> {Arrowheads[{0, 0.04, 0}], Arrow[x]};

p2 = ListLinePlot[pts2, PlotStyle -> PointSize[Medium],

PlotRange -> {{-3.1, 3.1}, {-3.1, 3.1}},

AspectRatio -> Automatic] /.

Line[x_] :> {Arrowheads[{0, 0.04, 0}], Arrow[x]};

Show[p1, p2]

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign Commented Sep 7, 2020 at 3:25
• For completeness can you also add images of your plots? Commented Sep 7, 2020 at 3:29

It is easy to draw this with complex numbers: Exp[I x] will deliver the rotation and f[x] or Exp[f[x]] the distance from the origin.

pts = Table[
x Exp[I (k + x)], {k, 0, 5}, {x, 0,
10, .1}] /. {Complex[a_, b_] -> List[a, b], a_Real -> {a, 0}};
ListLinePlot[pts, PlotStyle -> PointSize[Medium],
AspectRatio -> Automatic] /.
Line[x_] :> {Arrowheads[{0, 0.04, 0}], Arrow[x]}


Along the same lines we may draw a center:

pts = Table[
x Exp[I k ], {k, 0, 2 Pi, Pi/5}, {x, 0,
10, .1}] /. {Complex[a_, b_] -> List[a, b], a_Real -> {a, 0}};
ListLinePlot[pts, PlotStyle -> PointSize[Medium],
AspectRatio -> Automatic] /.
Line[x_] :> {Arrowheads[{0, 0.04, 0}], Arrow[x]}


• ReIm can be used in lieu of /. {Complex[a_, b_] -> List[a, b], a_Real -> {a, 0}}. Commented Sep 7, 2020 at 14:48

Simply reverse the direction of the arrowhead:

Clear[A, pts1, pts2, pts]

A = {{.80, 0}, {0, .64}};

pts1 = Table[NestList[A.# &, {k, 3}, 20], {k, -3, 3}];

pts2 = Table[NestList[A.# &, {k, -3}, 20], {k, -3, 3}];

p1 = ListLinePlot[pts1, PlotStyle -> PointSize[Medium],
PlotRange -> {{-3.1, 3.1}, {-3.1, 3.1}},
AspectRatio -> Automatic] /.
Line[x_] :> {Arrowheads[{0, -0.04, 0}], Arrow[x]};

p2 = ListLinePlot[pts2, PlotStyle -> PointSize[Medium],
PlotRange -> {{-3.1, 3.1}, {-3.1, 3.1}},
AspectRatio -> Automatic] /.
Line[x_] :> {Arrowheads[{0, -0.04, 0}], Arrow[x]};

Show[p1, p2]


• Thank you so much @Daniel Huber. How can I find the center and spiral? Commented Sep 7, 2020 at 11:07
• Which center and spiral? Commented Sep 7, 2020 at 11:22
• i mean how can i change this example to get center and spiral. I try to change A = {{.80, 0}, {0, .64}}; to be A = {{1, 3}, {-1, -1}}; to get spiral .. but looks not spiral Commented Sep 7, 2020 at 11:48
• You can update the answers that you give. I think it would be a lot better for future users if you combined your answers into one instead of the two you have now. Regardless, good answers! Commented Sep 7, 2020 at 21:03
• Thank u so much Daniel Huber Commented Sep 8, 2020 at 4:19