A Linear System with a parameter

Here is an example of a nonlinear, autonomous, homogeneous 2X2 systems of ordinary differential equations.

This notebook was created by T. Shelton, Southwestern University to supplement a handout for  Differential Equations II, updated for Mathematica 7.0.

reference  Differential Equations: Theory, Technique, and Practice, Simmons & Krantz, McGraw-Hill Co, Inc. 2007

Intro

Consider the one-parameter family of systems

(dx/dt)= a x  - y
(dy/dt)= x + a y

or, in matrix and vector form, 
(({{x'(t)}, {y'(t)}}))  =  (({{a, -1}, {1, a}})) (({{x(t)}, {y(t)}}))

Clear[a]

solve automatically

{{a,-1},{1,a}}.{x[t],y[t]}

DSolve[{x'[t]==a x[t]-y[t],y'[t]==x[t]+a y[t]},{x[t],y[t]},t]

{(E^(a t)) C[1] Cos[t]-(E^(a t)) C[2] Sin[t],(E^(a t)) C[2] Cos[t]+(E^(a t)) C[1] Sin[t]}/.{t->0}

solve more manually

Eigensystem[{{a,-1},{1,a}}]

our eigenvalues are 
            a ± 1 i
and the corresponding eigenvectors are
          (({{0}, {1}})) ± (({{1}, {0}}))  i
Thus, the linearly independent, real-valued solutions are

(e^(RealPartEval * t))(RealPartEvec *Cos[ImagPartEval * t] -ImagPartEvec * Sin[ImagPartEval * t])
(e^(RealPartEval * t))(RealPartEvec *Sin[ImagPartEval * t] +ImagPartEvec * Cos[ImagPartEval * t])

 or,
          (e^(a*t))  (  (({{0}, {1}})) cost - (({{1}, {0}})) sint  )  and      (e^(a*t))  (  (({{0}, {1}})) sint + (({{1}, {0}})) cost  )

define the two-parameter family of vector-valued functions based on the parameter a

to make ours match Mathematica's, B = C[1], which is x0,  and A = C[2], which is y0.

{(E^(a t)) C[1] Cos[t]-(E^(a t)) C[2] Sin[t],(E^(a t)) C[2] Cos[t]+(E^(a t)) C[1] Sin[t]}/.{C[1]->x0,C[2]->y0}

Expand[(E^(a*t))(A({0,1} Cos[t] - {1,0}Sin[t]) + B( {0,1}Sin[t] + {1,0} Cos[t]  ) )]
%/.{B->x0,A->y0}

Note that there is dramatically different behavior based on whether a < 0, a = 0, or a > 0.  We show some representative cases.

We'll have a different function of t for each value of the parameter "a" and for each pair of initial conditions {x0, y0}.  We define our solution as a vector-valued function.

Clear[vec2,t,x0,y0];
vec2[a_,t_,x0_,y0_]:={(E^(a t)) x0 Cos[t]-(E^(a t)) y0 Sin[t],(E^(a t)) y0 Cos[t]+(E^(a t)) x0 Sin[t]}

a = -1

Choose a value of the parameter.
Choose a set of initial conditions.  Show the list of them. 
	Show the first one, and the first coordinate of the second one.  This is so we can understand some of the code.
	Store them as graphics of ordered pairs.
Generate a table of vector-valued functions that have these initial conditions.
Show the initial values, solutions that begin there, and the vector field.

Clear[a]; a=-1;

Clear[tab]; tab ={};
Do[Do[AppendTo[tab,{x0,y0}],{x0,-9,9,9}],{y0,-9,9,9}]
tab
tab[[1]]
tab[[2,1]]
Clear[tabLen];
tabLen = Length[tab]

Clear[initialPts];
initialPts =  Graphics[{PointSize[Large],Point[tab]}];

Clear[tabVec];
tabVec={};
Do[AppendTo[tabVec,vec2[a,t,tab[[i,1]],tab[[i,2]] ] ],{i,1,tabLen}]
tabVec

Show[  {
ParametricPlot[%,{t,0,2},PlotStyle->Thick],
initialPts,
VectorPlot[{a x - y, x + a y},{x,-10,10},{y,-10,10}]},Axes->True  ]

a = 0

Choose a value of the parameter.
Choose a set of initial conditions; store them as graphics of ordered pairs.
Generate a table of vector-valued functions that have these initial conditions.
Show the initial values, solutions that begin there, and the vector field.

Clear[a]; a=0;

Clear[tab];tab ={};
Do[Do[AppendTo[tab,{x0,y0}],{x0,-8,y0,3.75}],{y0,-7,10,2.75}]
Clear[tabLen];
tabLen = Length[tab];

Clear[initialPts];
initialPts = Graphics[{PointSize[Large],Point[tab]}];

Clear[tabVec];
tabVec={};
Do[AppendTo[tabVec,vec2[a,t,tab[[i,1]],tab[[i,2]] ] ],{i,1,tabLen}]
tabVec

Show[  {
ParametricPlot[%,{t,0,2},PlotStyle->Thick],
initialPts,
VectorPlot[{a x - y, x + a y},{x,-10,10},{y,-10,10}]},Axes->True  ]

Clear[x,y,A,B]
x = B Cos[t] - A Sin[t]; y = A Cos[t] + B Sin[t];
TrigExpand[x^2 + y^2]
Clear[x,y]

a = 1

Choose a value of the parameter.
Choose a set of initial conditions; store them as graphics of ordered pairs.
Generate a table of vector-valued functions that have these initial conditions.
Show the initial values, solutions that begin there, and the vector field.

Clear[a]; a=1;

Clear[tab];tab ={};
Do[Do[AppendTo[tab,{x0,y0}],{x0,-1,y0,.75}],{y0,-1.5,3,.75}]
Clear[tabLen];
tabLen = Length[tab];

Clear[initialPts];
initialPts =  Graphics[{PointSize[Large],Point[tab]}];

Clear[tabVec];
tabVec={};
Do[AppendTo[tabVec,vec2[a,t,tab[[i,1]],tab[[i,2]] ] ],{i,1,tabLen}]
tabVec

Show[  {
ParametricPlot[%,{t,0,2},PlotStyle->Thick],
initialPts,
VectorPlot[{a x - y, x + a y},{x,-10,10},{y,-10,10}]},Axes->True  ]

shapes of the trajectories

Clear[a,x,y,A,B]
x =(E^(a*t)) (B Cos[t] - A Sin[t]); y =(E^(a*t))( A Cos[t] + B Sin[t]);
Factor[TrigExpand[x^2 + y^2]]
Clear[x,y]