0
$\begingroup$

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]
$\endgroup$
2
  • $\begingroup$ 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 $\endgroup$
    – Dunlop
    Sep 7 '20 at 3:25
  • $\begingroup$ For completeness can you also add images of your plots? $\endgroup$
    – Dunlop
    Sep 7 '20 at 3:29
1
$\begingroup$

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

enter image description here

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

enter image description here

$\endgroup$
1
  • $\begingroup$ ReIm can be used in lieu of /. {Complex[a_, b_] -> List[a, b], a_Real -> {a, 0}}. $\endgroup$
    – evanb
    Sep 7 '20 at 14:48
0
$\begingroup$

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]

enter image description here

$\endgroup$
5
  • $\begingroup$ Thank you so much @Daniel Huber. How can I find the center and spiral? $\endgroup$
    – user74531
    Sep 7 '20 at 11:07
  • $\begingroup$ Which center and spiral? $\endgroup$ Sep 7 '20 at 11:22
  • $\begingroup$ 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 $\endgroup$
    – user74531
    Sep 7 '20 at 11:48
  • $\begingroup$ 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! $\endgroup$ Sep 7 '20 at 21:03
  • $\begingroup$ Thank u so much Daniel Huber $\endgroup$
    – user74531
    Sep 8 '20 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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