ClearAll;
$DefaultFont = {"Times-Roman",10};
Needs["Statistics`DataManipulation`"];
Needs["Graphics`Graphics`"];
times = {6,18,30,39,46,53,60,74,93};
weights = {1,4,9,17,26,42,62,71,74};
datapoints = Map[Thread,Transpose[{times,weights}]];
W[A_,K_,l_,t_]:= K/(1 + A Exp[-l t]);
error[A_,K_,l_] = Apply[Plus,Table[(W[A,K,l,times[[n]]]-weights[[n]])^2,{n,1,9}]];
leasterror = FindMinimum[error[A,K,l],{A,{1,2}},
			{K,{80,85}},{l,{0.01,0.02}}];
Aopt = A/.leasterror[[2]]
Kopt = K/.leasterror[[2]]
lopt = l/.leasterror[[2]]
Wprime[t_]:= lopt W[Aopt,Kopt,lopt,t](1-W[Aopt,Kopt,lopt,t]/Kopt);

Print["Error is ",leasterror[[1]]];

uplot = Show[{ListPlot[datapoints,PlotRange->{{0,100},{0,77}},
	AxesOrigin->{0,0},PlotLabel->FontForm["y = W(t)",{"Courier",10}]],
	Plot[W[Aopt,Kopt,lopt,t],{t,0,100}]}];
lplot = Show[Plot[Wprime[t],{t,0,100},PlotRange->{{0,100},{0,2.3}},
	AxesOrigin->{0,0},PlotLabel->FontForm["y = W'(t)",{"Courier",10}]]];

Show[GraphicsArray[{{uplot},{lplot}}],
		PlotLabel->"          Figure 29.2\nGrowth in weight of maize"]