Mathematica Tool 1

This Mathematica notebook is designed for  use with Activity 1 in Section 6.2

We define k and M below, but the intial value P(0) is defined farther down the page.

k=0.00009;
M=1000;

We assign n and Δ ( in place of Δt) and define the iteration process.

n=40;
Δ=(120/n);
P=Range[n];
f[x_]:=For[i=1,i<n+1,i++,If[i==1,P[[i]]=x,P[[i]]=N[P[[i-1]]+(k P[[i-1]] (M-P[[i-1]])) Δ]]];

We define the constant (Subscript[P, 0])

(Subscript[P, 0])=10;

We carry out the iteration and assign the values to t  and P.

f[(Subscript[P, 0])]
Solution=Partition[Riffle[(Range[n]-1) Δ,P],2];
solPlot=ListPlot[Solution,PlotStyle->PointSize[0.02],PlotRange->{{0,120},{0,1050}}]