MATH529 Lesson04

First-order differential equations (continued)

This final ODE review lesson presents typical models that lead to single or multiple differential equations, (Zill, 2.7-2.9)

Linear Models

In many models the rate of growth is proportional to the current state

Bacterial growth

Let  denote current population,  the growth rate

DE = P'[t] - k P[t] == 0; IC = P[0] == P0;
sol = DSolve[{DE,IC},P[t],t][[1,1]]

Define some common plot options for reuse

pltopt = {GridLines->Automatic, PlotLabel->title, Frame->True, FrameLabel->xylabel};

Plot the solution

Plot[P[t] /. sol /. {k->0.2,P0->1},{t,0,10}, Evaluate[pltopt /. {title->"Population",xylabel->{"t", "P"}}]]

Radioactive decay

Let  denote current number of isotopes,  the decay rate

DE = A'[t] + k A[t] == 0; IC = A[0] == A0;
sol = DSolve[{DE,IC},A[t],t][[1,1]]

Plot[A[t] /. sol /. {k->0.2,A0->(10^10)},{t,0,10}, Evaluate[pltopt /. {title->"Nr. isotopes",xylabel->{"t", "A"}}]]

LR circuit

An in-series electrical circuit of source , resistor , and inductor  gives DE

Plot[A[t] /. sol /. {k->0.2,A0->(10^10)},{t,0,10}, Evaluate[pltopt /. {title->"Nr. isotopes",xylabel->{"t", "A"}}]]

DE = L i'[t] + R i[t] == e[t]; IC = i[0]==0;
sol = DSolve[{DE,IC} /. e[t] -> 110 Cos[100π t],i[t],t][[1,1]]

Plot[i[t] /. sol /. {R->(10^5),L->500},{t,0,0.1}, Evaluate[pltopt /. {title->"RL circuit current",xylabel->{"t", "i"}}],PlotRange->All]

After initial transient, the circuit stabilizes at current imposed by source.

Nonlinear models

Variable population growth rate (logistic equation)

Environmental constraints on population growth can be modeled by the logistic equation



where  is the growth rate when , and  is maximum population

DE = P'[t] == r (1-P[t]/K) P[t]; IC = P[0]==P0;
sol=DSolve[{DE,IC},P[t],t][[1,1]]

Growth from population less than environment carrying capacity

Plot[P[t] /. sol /. {K->(10^5),r->2,P0->100},{t,0,10}, Evaluate[pltopt /. {title->"Logistic population model",xylabel->{"t", "P"}}],PlotRange->All]

Decrease when population is greater than

Plot[P[t] /. sol /. {K->(10^5),r->2,P0->(10^6)},{t,0,10}, Evaluate[pltopt /. {title->"Logistic population model",xylabel->{"t", "P"}}],PlotRange->All]

Multiple initial conditions rendered on same plot

Plot[Table[P[t] /. sol /. {K->(10^5),r->2,P0->(10^p)},{p,1,6}],{t,0,10}, Evaluate[pltopt /. {title->"Logistic population model",xylabel->{"t", "P"}}],PlotRange->All]

Systems of first-order differential equations

Predator-prey model

Foxes  prey on rabbits , but lacking prey the fox population would decrease. The rabbit population increases (vegetation is freely available) in absence of foxes. The maximum number of rabbit- fox encounters is . The resulting (Lotka-Volterra) model is

DE = {f'[t]==-a f[t] + b f[t] r[t], r'[t] == c r[t] - d f[t] r[t]};
IC = {f[0]==4, r[0]==4};
IVP = Flatten[{DE,IC}];
params = {a->0.16, b ->0.08, c -> 4.5, d -> 0.9};

An analytical solution of the above non-linear system is tedious to obtain. Compute a numerical approximation

sol=NDSolve[IVP /. params,{f[t],r[t]},{t,0,20}][[1]]

Plot[{f[t] /. sol,r[t] /. sol},{t,0,20},Evaluate[pltopt /. {title->"Lotka-Volterra model",xylabel->{"t", "f,r"}}],PlotLegends->{"Foxes","Rabbits"}]