Applied mathematics is the study of describing the natural world.  In this study we are often more interested in how things change rather than how things are currently.  We want to study how things change in order to predict how things will be in the future.  Often it is easier to measure how things change.

In mathematics, rates of change are described by derivatives.  Thus, an important field of mathematics is that of equations which have derivatives in them.  This is a extremely broad field of study that includes ordinary and partial derivatives, linear and nonlinear equation, systems of equation and numerical techniques.  We will cover some of the basics.

Definition: An n-th order, constant coefficient, linear ordinary differential equation has the form

(((d^n)y)/(dx^n))+(Subscript[a, n-1])·(((d^(n-1))y)/(dx^(n-1)))+⋯+(Subscript[a, 1])·(dy/dx)+(Subscript[a, 0])·y=f(x)

where (Subscript[a, i]) are constants.

First Order ODE's

Example 1: The growth rate of a population with unlimited resources is proportional to the population size.  In mathematics this statement can be modeled by the first order equation

(dP/dt)=k P.

This is one of the simplest ordinary differential equations (ODE's), called the Malthusian Population Model.  We can solve this equation by the method of separation of variables and we get a solution of

P(t)=C·(e^kt).

In Mathematica we would use the DSolve command.

sols=DSolve[{P'[t]==k*P[t],P[0]==P0},P,t]

In this case the P0 is called an initial condition of the ODE while the k is called a parameter of the equation.  We can graph this solution for several values of P0 and k as follows

Plot[Evaluate[P[t]/.sols/.{{P0->1,k->0.3},{P0->5,k->0.1}}],{t,0,10}]

We often want to explore families of solutions with either varying values for a parameter or varying values of an initial condition.  In the following we use the Table command to get various parameter values.

Clear[P,t,k,P0]
malthus=P'[t]-k*P[t];
malsols=Table[k=0.05*n;
DSolve[{malthus==0,P[0]==1.0},P,t],{n,10}]

malplot=Plot[Evaluate[P[t]/.malsols],{t,0,10},
AxesLabel->{"t","P(t)"}]

Systems of First Order ODE's

Systems of ODE's come about when you have more than one dependent variable, one independent variable and the rate of change in the dependent variables can depend on any combination of the independent and dependent variables.

Example 2: Consider the following system that model the competition between two species of animals.

(du/dt)=2*u-u*v,

(dv/dt)=-v+(1/2)*u*v

If the first species is u (the prey) and the second is v (the predator), then the first species is harmed, while the second benefits from interactions between the two species.  This is a simple predator-prey model.  These equations form a non-linear model because of the u v terms in the equations.  Non-linear problems often require special techniques to solve in closed form (if possible), so we will use commands that give us a numerical approximation to the solution.  Lets see how Mathematica solves this system.  Note in the following that the general form for the NDSolve command is {list of equations and initial conditions}, {list of things to solve for}, {interval to solve over} and then options which we will see a little later.

ppsols=NDSolve[{u'[t]==2*u[t]-u[t]*v[t],
v'[t]==-v[t]+1/2*u[t]*v[t],u[0]==v[0]==5},{u,v},{t,0,20}]

To see these solutions we can graph the approximations as follows

Plot[Evaluate[u[t]/.ppsols],{t,0,20},AxesLabel->{"t","u(t)"}]
Plot[Evaluate[v[t]/.ppsols],{t,0,20},AxesLabel->{"t","v(t)"}]

These graphs are called state-space graphs.  This is because we are graphing the state or dependent variables versus the independent variable.  Another type of graph that is sometimes used is called a phase-space graph were we graph the state variables against each other and the independent variable appears parametrically:

ParametricPlot[Evaluate[{u[t],v[t]}/.ppsols],{t,0,20}, AxesLabel->{"u[t]","v[t]"}]

Example 3: Solve the previous system of ODE's with initial conditions of (5,2), (5,4), (5,6), and (5,7).  Graph all of the solutions on the same axes in phase-space along with the initial conditions.

First define a vector of initial conditions (note that the first component of each of the initial conditions is 5):

v0={2,4,6,7}

Then get a table of solutions:

Clear[ppsols]
ppsols=Table[
NDSolve[{u'[t]==2*u[t]-u[t]*v[t],
v'[t]==-v[t]+1/2*u[t]*v[t],u[0]==5,v[0]==v0[[n]]},{u,v},{t,0,20}]
,{n,1,4}]

Now use the Show command to combine several graphs:

Show[
ListPlot[{Table[{5,v0[[n]]},{n,1,4}]},PlotMarkers->{"o"},PlotStyle->Black],
ParametricPlot[Evaluate[{u[t],v[t]}/.ppsols],{t,0,20}],
PlotRange->{-1,8}, AxesLabel->{"u[t]","v[t]"},
AxesOrigin->{0,0}
]

OK.  Note that we use the ListPlot command to plot the initial conditions where the list of points is generated using the Table command (note that the options PlotMarkers and PlotStyle sets how the points appear in the graph).  We then use the ParametricPlot command to graph the four solutions that are the output of the NDSolve command.  In the Show command we list the various graphics commands followed by some options that change the vertical axis, label the axes, and setting where the axes pass through on the graph.

Exercise 4.

1. Use the DSolve command to try to solve the following problems.  If a closed form solution is possible (and aesthetically pleasing) then show that solution.  If Mathematica does not find a nice closed form solution, then find a numerical solution with initial conditions of  y(0)=1 and graph the solution.

a.

(dy/dx)=2y-1

b.

(dy/dx)=x y

c.

(dy/dt)=(t^2)y-t (y^2)+t

2. Use the NDSolve command to numerically approximate solutions to the following systems of equations.  Generate both state and phase space graphs of the solutions (try different ranges of the independent variable to see what works).

a.

(dx/dt)=x+x y, (dy/dt)=(x^2)-y, x(0) = 1, y(0) = 1/2.

b.

(dx/dt)=x y sin(t), (dy/dt)=x y cos(t), x(0) = 1, y(0) = 2.

c.

(dx/dt)=2x-(1/2)x y ,

(dy/dt)=(1/5)x y-y,

x(0) = 3, 6, 9, 12, 15; y(0) = 1.