Generating the Figures in Chapter 6 of Otto and Day

Inputs (Enter first)

<< Graphics`Graphics`

<< Graphics`MultipleListPlot`

<< Graphics`Arrow`

Off[General::"spell"]

Off[General::"spell1"]

Needs["Graphics`PlotField`"]

Figure 6.1 - General solution to the mouse model of Chapter 2

genmouse [R_, m_, n0_, t_] :=  
      R^t n0 + (1 - R^t) m/(1 - R)

DisplayTogether[
ListPlot[
        Table[{t, genmouse [0.99, 1, 10, t]}, {t, 0, 500}], 
        PlotJoined -> True], 
ListPlot[
        Table[{t, genmouse [0.99, 1, 50, t]}, {t, 0, 500}], 
        PlotJoined -> True], 
ListPlot[
        Table[{t, genmouse [0.99, 1, 75, t]}, {t, 0, 500}], 
        PlotJoined -> True], 
ListPlot[
        Table[{t, genmouse [0.99, 1, 125, t]}, {t, 0, 500}], 
        PlotJoined -> True], 
ListPlot[
        Table[{t, genmouse [0.99, 1, 150, t]}, {t, 0, 500}], 
        PlotJoined -> True], 
ListPlot[
        Table[{t, genmouse [0.99, 1, 190, t]}, {t, 0, 500}], 
        PlotJoined -> 
          True], 
PlotRange -> {{0, 400}, {0, 
            200}}
]

Export["Fig", %, "EPS"]

Figure 6.2 - Exponential growth comparisons

\(DisplayTogether[
	Plot[Exp[r], {r, \(-10\), 10}], 
	
      Plot[\((1 + r)\), {r, \(-10\), 10}], 
	
      PlotRange -> {{\(-2\), 2}, {0, 5}}
]\)

\(DisplayTogether[
	
      ListPlot[Table[{t, \((1 + r)\)^t\ n0 /. 
		{r -> \(-0.2\), \ 
                n0 -> 1000}}, {t, 0, 50}]], 
	
      Plot[Exp[r\ t]\ n0 /. 
		{r -> \(-0.2\), \ n0 -> 1000}, {t, 0, 
          50}], 
	
      ListPlot[Table[{t, \((1 + r)\)^t\ n0 /. 
		{r -> 0.1, \ 
                n0 -> 1000}}, {t, 0, 50}]], 
	
      Plot[Exp[r\ t]\ n0 /. 
		{r -> 0.1, \ n0 -> 1000}, {t, 0, 
          50}], 
	
      ListPlot[Table[{t, \((1 + r)\)^t\ n0 /. 
		{r -> 0.2, \ 
                n0 -> 1000}}, {t, 0, 50}]], 
	
      Plot[Exp[r\ t]\ n0 /. 
		{r -> 0.2, \ n0 -> 1000}, {t, 0, 
          50}], 
	PlotRange -> {{0, 21}, {0, 5000}}
]\)

Figure 6.3 - Logistic Growth in Continuous Time (NDSolve vs General Solution)

Clear[DifLogistic, K, r, n0, n]
DifLogistic[K_, r_, n0_, tmin_, 
        tmax_] := DifLogistic[K, r, n0, tmin, tmax] = 
        NDSolve[{D[n[t], t] == r n[t] (1 - n[t] /K), n[tmin] == n0}, 
          n[t], {t, tmin, tmax}]

SolLogistic[K_,r_,n0_,t_]=Exp[r*t]*n0/((1-n0/K)+Exp[r*t]*n0/K);

\(DisplayTogether[
	
      Plot[SolLogistic[1000, 0.5, 10, t], {t, 0, 100}, 
        PlotStyle -> Dashing[{0.005, 0.02}]], 
	
      Plot[n[t] /. DifLogistic[1000, 0.5, 10, 0, 100], {t, 0, 100}, 
        PlotStyle -> 
          Dashing[{0.05}]], 
\ \ \ PlotRange -> {{0, 30}, {0, 
            1100}}
]\)