7.1 Modeling with Differential Equations

Mathematica script by Chris Parrish,
cparrish@sewanee.edu

Sources and references for some of these problems include
James Stewart, "Calculus: Concepts and Contexts," Second Edition, Brooks/Cole, 2001
Deborah Hughes-Hallett, Andrew M. Gleason, et. al., "Calculus," Second Edition, John Wiley & Sons, 1998
Robert Fraga, ed., "Calculus Problems for a New Century," The Mathematical Association of America, 1993

How a Person Learns

Hughes-Hallett, Gleason, et al, Text Example, page 478

In[138]:=

Let dy/dt = f[t,y]. Here is the data we are working with.

In[139]:=

Clear[f,t,y,k]

f[t_,y_] := 100 - y;  (* dy/dt = f[t,y]; t in weeks, y is % of task learned *)

t0 = 0.0;
y0 = 0.0;

deltaT = 0.2;      (* 1 day = 1/5th week *)

m0 = f[t0,y0];     (* m0 = slope of solution curve at t = t0 *)

We need the % of the task that has been learned by the end of the first day.

In[145]:=

y1 = y0 + f[t0,y0] deltaT

Out[145]=

By the end of the second day, ...

In[146]:=

t1 = t0 + deltaT;

y2 = y1 + f[t1,y1] deltaT

Out[147]=

There is a pattern here. On the k+1 st day, ...

In[148]:=

t[0]   = t0;
t[k+1] = t0 + k deltaT;

y[0]   = y0;
y[k+1] = y[k] + f[t[k],y[k]] deltaT;

We can ask Mathematica to do that sort of incremental evaluation,
and accumulate the series of numbers in a variable named "result."

In[152]:=

y = y0; t = a = t0;
result = {{t,y}};
Do[y = y + f[t,y] deltaT;
t = a + k deltaT;
AppendTo[result,{5 t,y}],  (* t is in weeks, but we want the result to be in days *)
{k,20}];

TableForm[result,
TableSpacing -> {0,3}]

Out[155]//TableForm=

 time (days) % % of Task Learned 0. 0. 1. 20. 2. 36. 3. 48.8 4. 59.04 5. 67.232 6. 73.7856 7. 79.0285 8. 83.2228 9. 86.5782 10. 89.2626 11. 91.4101 12. 93.1281 13. 94.5024 14. 95.602 15. 96.4816 16. 97.1853 17. 97.7482 18. 98.1986 19. 98.5588 20. 98.8471

Let's put this data in a picture.

In[156]:=

ListPlot[result,
PlotStyle -> {CornflowerBlue,PointSize[0.02]},
PlotLabel -> "% of Task Learned",
AxesLabel -> {"time (days)","%"}];

Logistic Equation

Hughes-Hallett, Gleason, et al, Exercise 9.1.6, page 482

In[157]:=

In[160]:=

Out[160]=

In[161]:=

p[t] ( 1 - p[t]) //Simplify

Out[161]=

They don't look the same. Are they?
Try harder, Mathematica.

In[162]:=

Out[162]=

Yup. They are same -- so p[t] is a solution of the Logistic Equation.

Hanging Cable

Hughes-Hallett, Gleason, et al, Exercise 9.1.8a, page 482

In[163]:=

Now calculate.

In[166]:=

Out[166]=

They don't look the same. Are they?
Try harder, Mathematica.

In[167]:=

Out[167]=

This is about as far as Mathematica can take it. Can you take it farther?

Hughes-Hallett, Gleason, et al, Exercise 9.1.8b, page 482

In[168]:=

Let's calculate the two sides of the equation separately.

In[170]:=

Out[170]=

In[171]:=

Out[171]=

If y[x] is a solution of the more general differential equation,
the quotient of these two results should give us k.

In[172]:=

Out[172]=

If you are given k, what's a?

Families of Curves

Hughes-Hallett, Gleason, et al, Exercise 9.1.8a, page 482

In[173]:=

In[175]:=

y'[x]

Out[175]=

In[176]:=

Table[{y[x]/x,
x Log[y[x]]/x,
y[x]/x (1 + Log[y[x]/x]),
(y[x] Log[y[x]])/(x Log[x])}]

Out[176]=

Will the REAL dy/dx please come forward!

In[177]:=

Created by Mathematica  (April 22, 2004)