Tutorial file 7. MA530. Phase portraits of linear systems

Examples in this file correspond to O'Neil "Advanced Engineering Mathematics" 6th ed.
	Compare the analytical solutions in the book  with the computer solutions in this file. Here we will consider the linear system
	X'=AX
	in which A is a 2x2 real matrix and X={x,y}. We assume that A is nonsingular, so the equation AX=0 has only the trivial solution.

The function PlotVectorField, which we have already seen in Tutorial 5, can be used to generate direction fields. We should load the package before we can use this function:

<< Graphics`PlotField`

Nodal sink. Example 11.6 p. 415

Consider the system X'=AX, in which

A  =  {{-6, -2}, {5, 1}}; MatrixForm[A]

A has eigenvalues and corresponding eigenvectors:

Eigensystem[A]

Therefore the origin in this case is a nodal sink.

The following parametric plot shows some trajectories of this system:

plot1 = 
        ParametricPlot[
          Evaluate[
            Table[{x[t], 
                  y[t]} /. DSolve[{x'[
                          t] == A[[1]][[1]]*
                            x[t] + A[[1]][[2]]*y[t], y'[
                          t] == A[[2]][[1]]* 
                            x[t] + A[[2]][[2]]*y[t], 
                      x[0] == 1.2*c, y[0] == 0}, {x[t], y[t]}, 
                    t][[1]], {c, -10, 10}]], {t, -5, 5}, 
          AspectRatio -> 1, 
          PlotStyle -> {{Thickness[0.005], 
                Hue[1]}}, 
AxesLabel -> {x, ""}, 
          PlotLabel -> 
            StyleForm["Nodal sink", FontFamily -> "Times", 
              FontSize -> 14],  ImageSize -> {576, 576}, 
          PlotRange -> {{-10, 10}, {-10, 
                10}}];

This is the directional plot of the system:

plot2  =  
        PlotVectorField[{(A[[1]][[1]]* 
                  x + A[[1]][[2]]*
                  y),  (A[[2]][[1]]*
                  x + A[[2]][[2]]*y)}, {x, -10.01, 
            10.01}, {y, -9.01, 9.01}, ScaleFunction -> (0.5 &), 
          ScaleFactor -> 1, HeadWidth -> 0.5, 
          AspectRatio -> 1, PlotPoints -> 15, Axes -> True,  
          ImageSize -> {576, 576}];

Finally, we combine these two plots to get the phase portrait similar to the Figure 11.9 p 416:

Show[{plot1,  plot2}];

ClearAll[A, plot1, plot2]

Nodal source. Example 11.7 p. 416

Consider the system X'=AX, in which

A  =  {{3, 3}, {1, 5}}; MatrixForm[A]

A has eigenvalues and corresponding eigenvectors:

Eigensystem[A]

Therefore the origin in this case is a nodal source.

The following parametric plot shows some trajectories of this system:

plot1 = 
        ParametricPlot[
          Evaluate[
            Table[{x[t], 
                  y[t]} /. DSolve[{x'[
                          t] == A[[1]][[1]]*
                            x[t] + A[[1]][[2]]*y[t], y'[
                          t] == A[[2]][[1]]* 
                            x[t] + A[[2]][[2]]*y[t], 
                      x[0] == -2.7*c, y[0] == c}, {x[t], 
                      y[t]}, t][[1]], {c, -10.1, 
                10.1}]], {t, -0.3, 2}, AspectRatio -> 1, 
          PlotStyle -> {{Thickness[0.005], 
                Hue[1]}}, 
AxesLabel -> {x, ""}, 
          PlotLabel -> 
            StyleForm["Nodal source", FontFamily -> "Times", 
              FontSize -> 14],  ImageSize -> {576, 576}, 
          PlotRange -> {{-80, 80}, {-190, 
                190}}];

This is the directional plot of the system:

plot2  =  
        PlotVectorField[{(A[[1]][[1]]* 
                  x + A[[1]][[2]]*
                  y),  (A[[2]][[1]]*
                  x + A[[2]][[2]]*y)}, {x, -80.01, 
            80.01}, {y, -190.01, 190.01}, 
          ScaleFunction -> (0.5 &), PlotPoints -> 20, 
          Axes -> True,  ImageSize -> {576, 576}];

Finally, we combine these two plots to get the following phase portrait. Now compare this plot with the Figure 11.10 p 417. Also please compare the options of which we used to draw this plot and the plot in the previous example.

Show[{plot1,  plot2}];

ClearAll[A, plot1, plot2]

Saddle point. Example 11.8 p. 418

Consider the system X'=AX, in which

A  =  {{-1, 3}, {2, -2}}; MatrixForm[A]

A has eigenvalues and corresponding eigenvectors:

Eigensystem[A]

Therefore the origin in this case is a saddle point.

The following two parametric plots (plot1 and plot2) shows some trajectories of this system:

plot1 = 
        ParametricPlot[
          Evaluate[
            Table[{x[t], 
                  y[t]} /. DSolve[{x'[
                          t] == A[[1]][[1]]*
                            x[t] + A[[1]][[2]]*y[t], y'[
                          t] == A[[2]][[1]]* 
                            x[t] + A[[2]][[2]]*y[t], 
                      x[0] == -4 c, y[0] == 2  c}, {x[t], 
                      y[t]}, t][[1]], {c, -10.1, 
                10.1}]], {t, -1, 1}, AspectRatio -> 1, 
          PlotStyle -> {{Thickness[0.005], 
                Hue[1]}}, 
AxesLabel -> {x, ""}, 
          PlotLabel -> 
            StyleForm["Saddle point", FontFamily -> "Times", 
              FontSize -> 14],  ImageSize -> {576, 576}, 
          PlotRange -> {{-20, 20}, {-10, 
                10}}];

plot2 = 
        ParametricPlot[
          Evaluate[
            Table[{x[t], 
                  y[t]} /. DSolve[{x'[
                          t] == A[[1]][[1]]*
                            x[t] + A[[1]][[2]]*y[t], y'[
                          t] == A[[2]][[1]]* 
                            x[t] + A[[2]][[2]]*y[t], 
                      x[0] == 0, y[0] == 2  c}, {x[t], y[t]}, 
                    t][[1]], {c, -10.1, 10.1}]], {t, -2, 4}, 
          AspectRatio -> 1, 
          PlotStyle -> {{Thickness[0.005], 
                Hue[1]}}, 
AxesLabel -> {x, ""},  
          ImageSize -> {576, 576}, 
          PlotRange -> {{-20, 20}, {-10, 
                10}}];

This plot shows trajectories around this saddle point, the trajectories do not enter or leave the origin, but asymptotically approach the lines determined by the eigenvectors:

plot3 = Show[{plot1,  plot2}];

This is the directional plot of the system:

plot4  =  
        PlotVectorField[{(A[[1]][[1]]* 
                  x + A[[1]][[2]]*
                  y),  (A[[2]][[1]]*
                  x + A[[2]][[2]]*y)}, {x, -20.01, 
            20.01}, {y, -10.01, 10.01}, 
          ScaleFunction -> (0.5 &), PlotPoints -> 15, 
          Axes -> True,  ImageSize -> {576, 576}];

Finally, we combine these two plots to get the following phase portrait. Please, compare this plot with the plot given in Figure 11.12 p 418.

Show[{plot3,  plot4}];

ClearAll[A, plot1,  plot2,  plot3, plot4]

Improper node. Example 11.9 p. 420

Consider the system X'=AX, in which

A  =  {{-10, 6}, {-6, 2}}; MatrixForm[A]

A has two the eigenvalue with multiplicity 2 and does not have two linearly independent eigenvectors:

Eigensystem[A]

Therefore the origin in this case is an improper node.

The following parametric plot shows some trajectories of this system:

plot1 = 
        ParametricPlot[
          Evaluate[
            Table[{x[t], 
                  y[t]} /. DSolve[{x'[
                          t] == A[[1]][[1]]*
                            x[t] + A[[1]][[2]]*y[t], y'[
                          t] == A[[2]][[1]]* 
                            x[t] + A[[2]][[2]]*y[t], 
                      x[0] == -7*c, y[0] == 0}, {x[t], y[t]}, 
                    t][[1]], {c, -10.1, 10.1}]], {t, -0.3, 2}, 
          AspectRatio -> 1, 
          PlotStyle -> {{Thickness[0.005], 
                Hue[1]}}, 
AxesLabel -> {x, ""}, 
          PlotLabel -> 
            StyleForm["Improper node", FontFamily -> "Times", 
              FontSize -> 14],  ImageSize -> {576, 576}, 
          PlotRange -> {{-40, 40}, {-40, 
                40}}];

This is the directional plot of the system:

plot2  =  
        PlotVectorField[{(A[[1]][[1]]* 
                  x + A[[1]][[2]]*
                  y),  (A[[2]][[1]]*
                  x + A[[2]][[2]]*y)}, {x, -40.01, 
            40.01}, {y, -40.01, 40.01}, 
          ScaleFunction -> (0.5 &), PlotPoints -> 20, 
          Axes -> True,  ImageSize -> {576, 576}];

Finally, we combine these two plots to get the following phase portrait. Now compare this plot with the Figure 11.16  p. 421. Also please compare the options of which we used to draw this plot and the plot in the previous example.

Show[{plot1,  plot2}];

ClearAll[A, plot1, plot2]

Spiral source. Example 11.10 p. 422

Consider the system X'=AX, in which

A  =  {{-1, -2}, {4, 3}}; MatrixForm[A]

A has two different complex eigenvalues and eigenvectors. Please note that both the eigenvalues and eigenvectors are complex conjugates.

Eigensystem[A]

Therefore the origin in this case is a spiral source.

The following parametric plot shows some trajectories of this system:

plot1 = 
        ParametricPlot[
          Evaluate[
            Table[{x[t], 
                  y[t]} /. DSolve[{x'[
                          t] == A[[1]][[1]]*
                            x[t] + A[[1]][[2]]*y[t], y'[
                          t] == A[[2]][[1]]* 
                            x[t] + A[[2]][[2]]*y[t], 
                      x[0] == c, y[0] == 0}, {x[t], y[t]}, 
                    t][[1]], {c, -9.1, 9.1}]], {t, -2, 20}, 
          AspectRatio -> 1, 
          PlotStyle -> {{Thickness[0.005], 
                Hue[1]}}, 
AxesLabel -> {x, ""}, 
          PlotLabel -> 
            StyleForm["Spiral source", FontFamily -> "Times", 
              FontSize -> 14],  ImageSize -> {576, 576}, 
          PlotRange -> {{-60, 60}, {-60, 
                60}}];

This is the directional plot of the system:

plot2  =  
        PlotVectorField[{(A[[1]][[1]]* 
                  x + A[[1]][[2]]*
                  y),  (A[[2]][[1]]*
                  x + A[[2]][[2]]*y)}, {x, -60.01, 
            60.01}, {y, -60.01, 60.01}, 
          ScaleFunction -> (0.5 &), PlotPoints -> 20, 
          Axes -> True,  ImageSize -> {576, 576}];

Finally, we combine these two plots to get the following phase portrait. Now compare this plot with the Figure 11.16  p. 421. Also please compare the options of which we used to draw this plot and the plot in the previous example.

Show[{plot1,  plot2}];

ClearAll[A, plot1, plot2]

Center. Example 11.11 p. 423

Consider the system X'=AX, in which

A  =  {{3, 18}, {-1, -3}}; MatrixForm[A]

A has two different complex eigenvalues and eigenvectors. Please note that both the eigenvalues and eigenvectors are complex conjugates.

Eigensystem[A]

Therefore the origin in this case is a spiral source.

The following parametric plot shows some trajectories of this system:

plot1 = 
        ParametricPlot[
          Evaluate[
            Table[{x[t], 
                  y[t]} /. DSolve[{x'[
                          t] == A[[1]][[1]]*
                            x[t] + A[[1]][[2]]*y[t], y'[
                          t] == A[[2]][[1]]* 
                            x[t] + A[[2]][[2]]*y[t], 
                      x[0] == c, y[0] == 0}, {x[t], y[t]}, 
                    t][[1]], {c, 0, 10}]], {t, -1, 1.5}, 
          AspectRatio -> 1, 
          PlotStyle -> {{Thickness[0.005], 
                Hue[1]}}, 
AxesLabel -> {x, ""}, 
          PlotLabel -> 
            StyleForm["Spiral source", FontFamily -> "Times", 
              FontSize -> 14],  ImageSize -> {576, 576}, 
          PlotRange -> {{-15, 15}, {-4.5, 
                4.5}}];

This is the directional plot of the system:

plot2  =  
        PlotVectorField[{(A[[1]][[1]]* 
                  x + A[[1]][[2]]*
                  y),  (A[[2]][[1]]*
                  x + A[[2]][[2]]*y)}, {x, -15, 
            15}, {y, -4.5, 4.5}, ScaleFunction -> (0.5 &), 
          PlotPoints -> 12, Axes -> True,  
          ImageSize -> {576, 576}];

Finally, we combine these two plots to get the following phase portrait. Now compare this plot with the Figure 11.16  p. 421. Also please compare the options of which we used to draw this plot and the plot in the previous example.

Show[{plot1,  plot2}];

ClearAll[A, plot1, plot2]