Initialization Cells (Code Needed for Most Plot3D Statements)

ticks[min_,max_]:=Join[
Table[{i,If[i==0, ,Style[i,12]],{0.01,0}},{i,Ceiling[min],Floor[max], 2}],(* Numbered ticks *)
Table[{j, ,{0.01,0}},{j,Round[min],Round[max-1],1}]]         (* Un-numbered ticks *)


(* 2D Options *)
SetOptions[
Plot,
ImageSize->350,
AxesOrigin->{0,0},
AspectRatio->1,
AxesStyle->Directive[Medium, Bold],
Ticks->ticks
];

SetOptions[
ParametricPlot,
ImageSize->350,
AxesOrigin->{0,0},
AspectRatio->1,
AxesStyle->Directive[Medium, Bold],
Ticks->ticks
];

SetOptions[
VectorPlot,
ImageSize->350,
AxesOrigin->{0,0},
AspectRatio->1,
Axes->True,
Frame->False,
AxesStyle->Directive[Medium, Bold],
Ticks->ticks
];

(* 3D Options *)

SetOptions[
Plot3D,
ImageSize->600,
BoxRatios->1,Boxed->False,AxesOrigin->{0,0,0},
AxesStyle->Directive[Medium, Bold],
Ticks->ticks, 
Mesh->None,
ViewPoint->{2,0.9,1},
ViewVertical->{0,0,1}
];

SetOptions[
ContourPlot3D,
ImageSize->600,
BoxRatios->1,Boxed->False,AxesOrigin->{0,0,0},
AxesStyle->Directive[Medium, Bold],
Ticks->ticks, 
Mesh->None,
ViewPoint->{2,0.9,1},
ViewVertical->{0,0,1}
];

SetOptions[
ParametricPlot3D,
ImageSize->600,
BoxRatios->1,Boxed->False,AxesOrigin->{0,0,0},
AxesStyle->Directive[Medium, Bold],
Ticks->ticks, 
Mesh->None,
ViewPoint->{2,0.9,1},
ViewVertical->{0,0,1}
];

SetOptions[
RegionPlot3D,
ImageSize->600,
BoxRatios->1,Boxed->False,AxesOrigin->{0,0,0},
AxesStyle->Directive[Medium, Bold],
Ticks->ticks, 
Mesh->None,
ViewPoint->{2,0.9,1},
ViewVertical->{0,0,1}
];

SetOptions[
VectorPlot3D,
ImageSize->350,
AxesOrigin->{0,0,0},
AspectRatio->1,
BoxRatios->1,
Axes->True,
AxesStyle->Directive[Medium, Bold],
Ticks->ticks,
ViewPoint->{2,0.9,1},
ViewVertical->{0,0,1}
];

SetOptions[
RevolutionPlot3D,
ImageSize->350,
AxesOrigin->{0,0,0},
AspectRatio->1,
BoxRatios->1,
Boxed->False,
Axes->True,
AxesStyle->Directive[Medium, Bold],
Ticks->ticks,
ViewPoint->{2,0.9,1},
ViewVertical->{0,0,1}
];

First Order Differential Equations

Systems of Differential Equations

Definition

Suppose we define a vector of differentiable functions X(t)=(({{(Subscript[x, 1])(t)}, {(Subscript[x, 2])(t)}, {⋮}, {(Subscript[x, n])(t)}})).  A common notation is

({{({{((dX(t))/dt)=}})(({{(((Subscript[dx, 1])(t))/dt)}, {(((Subscript[dx, 2])(t))/dt)}, {⋮}, {(((Subscript[dx, n])(t))/dt)}})).}})

A vector valued function, F, can be defined as

({{({{F(X(t))=F((Subscript[x, 1])(t), (Subscript[x, 2])(t),⋯,(Subscript[x, n])(t))=}})(({{(Subscript[f, 1])((Subscript[x, 1])(t), (Subscript[x, 2])(t),⋯,(Subscript[x, n])(t))}, {(Subscript[f, 2])((Subscript[x, 1])(t), (Subscript[x, 2])(t),⋯,(Subscript[x, n])(t))}, {⋮}, {(Subscript[f, n])((Subscript[x, 1])(t), (Subscript[x, 2])(t),⋯,(Subscript[x, n])(t))}})).}})

A first order system of differential equations is

({{({{((dX(t))/dt)=F(X(t)).}})}})

That is, we have

({{(({{(((Subscript[dx, 1])(t))/dt)}, {(((Subscript[dx, 2])(t))/dt)}, {⋮}, {(((Subscript[dx, n])(t))/dt)}}))=(({{(Subscript[f, 1])((Subscript[x, 1])(t), (Subscript[x, 2])(t),⋯,(Subscript[x, n])(t))}, {(Subscript[f, 2])((Subscript[x, 1])(t), (Subscript[x, 2])(t),⋯,(Subscript[x, n])(t))}, {⋮}, {(Subscript[f, n])((Subscript[x, 1])(t), (Subscript[x, 2])(t),⋯,(Subscript[x, n])(t))}})).}})

Furthermore, if initial conditions are specified X((Subscript[t, 0]))=(({{(Subscript[x, 1])((Subscript[t, 0]))}, {(Subscript[x, 2])((Subscript[t, 0]))}, {⋮}, {(Subscript[x, n])((Subscript[t, 0]))}})), then we have an initial value problem.

Higher order systems have more derivatives.

Example

The following is a system of two differential equations

({{({{({{(dx/dt)=x-3 y}, {(dy/dt)=2y +3 x.}})}})}})

An vector notation, we have

({{({{(({{(dx/dt)}, {(dy/dt)}}))=(({{x-3y }, {2 y +3 x}}))}}).}})

Example - WAKE UP HERE!

Convert a second order differential equation to a first order system by using (Subscript[y, 1])=x, (Subscript[y, 2])=x'.  (Note that this works for nth order DEs.)

({{({{x''(t)=cos(t) x'(t)-Log(t) x(t).}})}})

Homework - For Software, Use Mathematica.  You need to learn some programming, so use the code I have provided!  In particular, stay away from DSolve and NDSolve.

Pages:		161 - 166
Problems:	1 - 6 ALL

Direction Fields for Systems

Phase Planes

A phase plane is the graphical representation of a solution curve to a system of two ordinary differential equations.

Basic Direction Fields

A direction field or vector field is a graphical representation of the magnitude and direction at different points in the plane generated by a system of two ordinary differential equations.

ivp={  {-1,-1}, {1,1}, {1,-1}, {-1, 1}};
GraphicsGrid[{
{
VectorPlot[{x,y}, {x, -3, 3}, {y, -3,3},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field, (dx/dt) = x, (dy/dt) = y",
Epilog->{PointSize[Large], Point[ivp]}
],
VectorPlot[{x,-y}, {x, -3, 3}, {y, -3,3},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field, (dx/dt) = x, (dy/dt) = -y",
Epilog->{PointSize[Large], Point[ivp]}
]
},
{
VectorPlot[{-x,y}, {x, -3, 3}, {y, -3,3},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field, (dx/dt) = -x, (dy/dt) = y",
Epilog->{PointSize[Large], Point[ivp]}
],
VectorPlot[{-x,-y}, {x, -3, 3}, {y, -3,3},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field, (dx/dt) = -x, (dy/dt) = -y",
Epilog->{PointSize[Large], Point[ivp]}
]
},
{
VectorPlot[{-2 x,-y}, {x, -3, 3}, {y, -3,3},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field, (dx/dt) = -2x, \!(dy/dt) = -y",
Epilog->{PointSize[Large], Point[ivp]}
],
VectorPlot[{-x,-2 y}, {x, -3, 3}, {y, -3,3},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field, (dx/dt) = -x, (dy/dt) = -2y",
Epilog->{PointSize[Large], Point[ivp]}
]
}
}, ImageSize->600]

Competing Species

Consider the following system for competing species.

x(t) represents the prey at time t.

In the absence of the predator, the prey grows with logistic growth, with carrying capacity N.

y(t) represents the predator at time t.

The predator’s only source of food is the prey.  So, in the absence of prey, it will die off exponentially.

The interactions between predator and prey are proportional to the number of each.

Thus, the successful hunt is proportional to the number of predators and prey.

The gain due to hunting is proportional to the number of predators and prey.

A model for this situation is

({{({{(dx/dt)=a x (1-(x/N)) -b x y
(dy/dt)=-c y+d x y }})}})

The equilibria for this system are:

Solve[{a x(1-x/N)-b x y==0, -c y +d x y==0}, {x,y}]

Example

Consider the following predator prey model.

ivp={  {-1,-1}, {1,1}, {1,-1}, {-1, 1}, {6,1},  {6,3}};
theEquilibria={{0,0}, {theN,0}, {c/d, -((a (c-d theN))/(b d theN))}};
a=1;
b=0.3;
c=1;
d=0.4;
theN=5;

VectorPlot[
{a x (1-x/theN)-b x y, -c y+d x y}, {x, -2, 7}, {y, -2,5},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field, Predator - Prey",
Epilog->{PointSize[Large], Point[theEquilibria]}
]

Homework - For Software, Use Mathematica.  You need to learn some programming, so use the code I have provided!  In particular, stay away from DSolve and NDSolve.

Pages:		178 - 183
Problems:	1, 2, 4, 7, 8, 9, 11, 13, 15, 16, 19

Existence and Uniqueness for Systems

The Existence and Uniqueness Theorem

Let (dY/dt)=F(t,Y) be a system of differential equations.  Suppose F(t,Y) is continuously differentiable, that is all possible first order partial derivatives are continuous.  Suppose that (Subscript[t, 0]) is an initial time and (Subscript[Y, 0])=Y((Subscript[t, 0])) is an initial value.  Then there is an ϵ>0 and a function Y(t) defined for (Subscript[t, 0])-ϵ<t<(Subscript[t, 0])+ϵ, such that Y(t) satisfies the initial-value problem

({{({{(dY/dt)=F(t,Y)   and   }})(Subscript[Y, 0])=Y((Subscript[t, 0])).}})

Moreover, for t in this interval, this solution is unique.

Autonomous Solutions - Consequences of Uniqueness

The solution curve for a single solution can’t intersect itself - except for periodic solutions where the solution is a simple closed curve.

The solution curves for two different solutions can’t intersect unless they are the same curve.

Example

Consider the system of DEs given by

({{({{(dy/dt)=v
(dv/dt)=-y}})}})

Note that the solution to this is periodic (as shown below) and if different locations on the unit circle are chosen, then we obtain the same solution curve...we’re just starting in different places!

ivp={  {-1,-1}, {1,1}, {1,-1}, {-1, 1}};

VectorPlot[
{v, -y}, {y, -2,2}, {v, -2,2},
FrameLabel->{y,v},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field",
Epilog->{PointSize[Large], Point[ivp]}
]

Here is how you solve and plot the solution to an initial value problem (the previous system).

mySol=DSolve[{v'[t]==-y[t], y'[t]==v[t], v[0]==1, y[0]==0}, {v,y},t]

ParametricPlot[{v[t],y[t]}/.mySol, {t,0,2 Pi}]

Solution Curves for Autonomous Systems can Divide the Plane into Regions.

myEstimate=NDSolve[{x'[t]==y[t], y'[t]==-x[t]+(1-x[t]^2) y[t], x[0]==0.1,y[0]==0}, {x,y},{t,50}]

ParametricPlot[Evaluate[{x[t],y[t]}/.myEstimate], {t, 0, 50}]

Below, the black curve shows the “limiting behavior” of the periodic solution.  Thus, if you start inside the loop, you are trapped.  If you start outside, then you must remain outside.

ivp={  {-1,-1}, {1,1}, {1,-2}, {-1, 2}};

Show[
VectorPlot[
{y, -x+(1-x^2) y}, {x, -3,3}, {y, -3.5,3.5},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Blue, Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field",
Epilog->{PointSize[Large], Point[ivp]}
],
ParametricPlot[Evaluate[{x[t],y[t]}/.myEstimate], {t, 30, 50},
PlotStyle->{Black,Thick}]
]

NonAutonomous - Things Appear a Little Different!

For non-autonomous systems, the solution curve CAN cross itself if the velocity vector is pointing in a different direction at a later time.

Homework - For Software, Use Mathematica.  You need to learn some programming, so use the code I have provided!  In particular, stay away from DSolve and NDSolve.

Pages:		208 - 209
Problems:	1, 3, 4, 5, 8, 9, 10 (Hint:  Read about Decoupled and Partially Decoupled Systems, pages 191 - 193)

Linear Systems  - First Steps

2 D Case

A linear system of differential equations with constant coefficients has the form

({{({{(dx/dt)=a x +b y
(dy/dt)=c x+d y}})}})

The matrix form for this system where Y(t)=(({{x(t)}, {y(t)}})) and A=(({{a, b}, {c, d}})) is

({{({{(dY/dt)=A Y}}).}})

The matrix A=(({{a, b}, {c, d}})) is called the coefficient matrix.

Equilibria

Defined

To find equilibria, set (dY/dt)=0, that is, find a point (Subscript[Y, 0])=(({{(Subscript[x, 0])}, {(Subscript[y, 0])}})) such that A (Subscript[Y, 0])=(({{0}, {0}})).

So, we solve the system of equations A (Subscript[Y, 0])=(({{0}, {0}})) to find all equilibria.  Yup, Row Reduced Echelon Form (RREF) is your friend!

The trivial solution is (Subscript[Y, 0])=(({{0}, {0}})).  We seek other solutions as well.

Some Matrix Algebra Theory

Theorem:  If A is a matrix with non-zero determinant (i.e. det(A) ≠ 0), then the matrix A is invertible and the only equilibrium point for the linear system ({{(dY/dt)=A Y}}) is the trivial one, (Subscript[Y, 0])=(({{0}, {0}})).

So, when  det(A) = 0, we obtain non-trivial solutions.

Solutions

Linearity Principle

If (Subscript[Y, 1])(t) and (Subscript[Y, 2])(t) are both solutions to the linear system ({{(dY/dt)=A Y}}), then any linearly combination of these solutions, (Subscript[C, 1])(Subscript[Y, 1])(t)+(Subscript[C, 2])(Subscript[Y, 2])(t) is again a solution.  Do you see why?????

Note:  There are infinitely many solutions when det(A)≠0.

Note:  The linear combination (Subscript[C, 1])(Subscript[Y, 1])(t)+(Subscript[C, 2])(Subscript[Y, 2])(t) includes the trivial solution!

Linear Independence

Two vectors (Subscript[V, 1]) and (Subscript[V, 2]) are linearly independent if, whenever (Subscript[C, 1])(Subscript[V, 1])+(Subscript[C, 2])(Subscript[V, 2])=(OverVector[0]) (where (OverVector[0])=(((0,0,...,0))^T) is the zero vector of appropriate size - in this case 2 zeros), then (Subscript[C, 1])=(Subscript[C, 2])=0.

Suppose (Subscript[Y, 1])(t) and (Subscript[Y, 2])(t) are functions.  We say that they are linearly independent if, whenever (Subscript[C, 1])(Subscript[Y, 1])(t)+(Subscript[C, 2])(Subscript[Y, 2])(t)=(OverVector[0]) (where (OverVector[0])=(((0,0,...,0))^T) is the zero vector of appropriate size) for all time, then (Subscript[C, 1])=(Subscript[C, 2])=0.

Theorem:  Suppose (Subscript[Y, 1])(t) and (Subscript[Y, 2])(t) are solutions to the linear system ({{(dY/dt)=A Y.}}) If (Subscript[Y, 1])(t) and (Subscript[Y, 2])(t) are both linearly independent, then we can find constants (Subscript[C, 1]) and (Subscript[C, 2]) such that (Subscript[C, 1])(Subscript[Y, 1])(t)+(Subscript[C, 2])(Subscript[Y, 2])(t) is a solution to the initial value problem Y(0)=(({{(Subscript[x, 0])}, {(Subscript[y, 0])}})).

By the Existence and Uniqueness Theorem, this solution is unique!

The Wronskian for functions (Subscript[f, 1])(t), (Subscript[f, 2])(t), ..., (Subscript[f, n])(t) is defined to be
({{({{W(}})(Subscript[f, 1]), (Subscript[f, 2]), ..., (Subscript[f, n]))(t)=det (({{(Subscript[f, 1])(t), (Subscript[f, 2])(t), ⋯, (Subscript[f, n])(t)}, {(Subscript[f, 1]^('))(t), (Subscript[f, 2]^('))(t), ⋮, (Subscript[f, n]^('))(t)}, {⋮, ⋮, ⋱, ⋮}, {(Subscript[f, 1]^((n-1)))(t), (Subscript[f, 2]^((n-1)))(t), ⋯, (Subscript[f, n]^((n-1)))(t)}})).}})
For the two dimensional case, we have 
({{({{W((Subscript[f, 1]), (Subscript[f, 2]))(t)=det (({{(Subscript[f, 1])(t), (Subscript[f, 2])(t)}, {(Subscript[f, 1]^('))(t), (Subscript[f, 2]^('))(t)}}))}})=((Subscript[f, 1]) (Subscript[f, 2]^('))-(Subscript[f, 2])(Subscript[f, 1]^(')))(t).}})

Theorem:  If the functions (Subscript[f, 1])(t), (Subscript[f, 2])(t), ..., (Subscript[f, n])(t) are differentiable on an open interval I, then they are linearly independent if and only if there exists (Subscript[t, 0])ϵ I such that W((Subscript[f, 1]), (Subscript[f, 2]), ..., (Subscript[f, n]))((Subscript[t, 0]))≠0.
Moreover, they are linearly dependent over the interval I if and only if W((Subscript[f, 1]), (Subscript[f, 2]), ..., (Subscript[f, n]))((Subscript[t, 0]))=0 for some (Subscript[t, 0]) ϵ I.

Example

Find conditions so that the functions (e^((Subscript[λ, 1])x)) and (e^((Subscript[λ, 2])x)) are linearly independent.

Example

Consider the system of differential equations given by

({{({{(dY/dt)=(({{2, 3}, {0, -4}}))}})Y.}})

Show that the functions (Subscript[Y, 1])(t)=(({{(e^(2t))}, {0}}))  and (Subscript[Y, 2])(t)=(({{-(e^(-4t))}, {2(e^(-4t))}})) are solutions.

Write the general solution.

Solve the initial value problem when Y(0)=(({{1}, {-1}})).

Example

Return to the previous example and recall that

({{({{ (Subscript[Y, 1])(t)=(({{(e^(2t))}, {0}}))=(e^(2t))(({{1}, {0}}))  and (Subscript[Y, 2])(t)=(({{-(e^(-4t))}, {2(e^(-4t))}}))}})=(e^(-4t))(({{-1}, {2}})).}})

Show that the vectors (({{1}, {0}})) and (({{-1}, {2}})) are linearly independent.

Graph the functions (the straight line solutions)

({{({{ (Subscript[Y, 1])(t)=(Subscript[C, 1])(({{(e^(2t))}, {0}}))=(Subscript[C, 1])(e^(2t))(({{1}, {0}}))  and (Subscript[Y, 2])(t)=(Subscript[C, 2])(({{-(e^(-4t))}, {2(e^(-4t))}}))}})=(Subscript[C, 2])(e^(-4t))(({{-1}, {2}})).}})

Note that we can let Y(t)=(Subscript[C, 1])(e^(2t))(({{1}, {0}})) or Y(t) =t (({{1}, {0}})) to obtain the same straight line solution graphs!  Similarly, we can use Y(t)=(Subscript[C, 2])(e^(-4t))(({{-1}, {2}}))or Y(t)=t (({{-1}, {2}})).  This is important because Mathematica chokes when you try to use parametric plot with exponentials!

Show[
ParametricPlot[
{t, 0}, {t, -3,3},
PlotRange->{{-3,3},{-3,3}},
PlotStyle->{Blue, Thick,Dashed}
],
ParametricPlot[
{-t, 2 t}, {t, -3,3},
PlotRange->{{-3,3},{-3,3}},
PlotStyle->{Red, Thick,Dashed}
],
Graphics[{Thick,
Arrow[{{0,0},{1,0}}]
}],
Graphics[{Thick,
Arrow[{{0,0},{-1,2}}]
}]
]

What’s happening in Direction Field Land?  Notice that the straight line solutions divide the plane into four regions (because of the Existence and Uniqueness Theorem).  So, if you don’t start on one of the straight line solutions, then you are trapped in one particular region!

ivp={  {-1,-1}, {1,1}, {1,-1}, {-1, 1}};

Show[
VectorPlot[
{2 x+3 y, -4 y}, {x, -3,3}, {y, -3.5,3.5},
FrameLabel->{x,y},
Axes->True,
VectorScale->{Small, Tiny, None}, VectorStyle->Gray,
StreamScale->Full,
StreamStyle->{Darker[Green], Thick, "Line"},
StreamPoints->{ivp},
PlotLabel->"Direction Field",
Epilog->{PointSize[Large], Point[ivp]}
],
ParametricPlot[
{t, 0}, {t, -3,3},
PlotRange->{{-3,3},{-3,3}},
PlotStyle->{Blue, Thick,Dashed}
],
ParametricPlot[
{-t, 2 t}, {t, -3,3},
PlotRange->{{-3,3},{-3,3}},
PlotStyle->{Red, Thick,Dashed}
],
Graphics[{Thick,
Arrow[{{0,0},{1,0}}]
}],
Graphics[{Thick,
Arrow[{{0,0},{-1,2}}]
}]
]

Homework - For Software, Use Mathematica.  You need to learn some programming, so use the code I have provided!  In particular, stay away from DSolve and NDSolve.

Pages:		258 - 264
Problems:	1, 2, 5, 7, 8, 10, 12, 16, 17, 19, 24, 26, 27, 28