                Page 99
f0:=t-> exp(t/10);
dsolve({ diff(y(t),t)=f0(t-1),y(0)=f0(0)},y(t));
f1:=unapply(rhs(%),t);
dsolve({ diff(y(t),t)=f1(t-1),y(1)=f1(1)} ,y(t));
f2:=unapply(rhs(%),t);
dsolve({ diff(y(t),t)=f2(t-1),y(2)=f2(2)} ,y(t));
f3:=unapply(rhs(%),t);
plot({ [t,f0(t),t=-1..0],
   [t,f1(t),t=0..1],[t,f2(t),t=1..2],
   [t,f3(t),t=2..3]} ,t=-1..3,
   y=-1..6,color=black);

               Page 101
xval:=[seq(a[i],i=1..3)];
yval:=[seq(b[i],i=1..3)];
lny:=map(ln,yval);
with(stats);
fit[leastsquare[[x,y],y=r*x+ln(A),{r}]]([xval,lny]);
coeff(rhs(%),x);
combine(simplify(%));
xval:=[seq(a[i],i=1..3)];
yval:=[seq(b[i],i=1..3)];
lny:=map(ln,yval);
with(stats);
fit[leastsquare[[x,y],y=r*x+ln(A),{r}]]([xval,lny]);
coeff(rhs(%),x);
combine(simplify(%));

               Page 102
restart;
tt:=[seq(1790+i*10,i=0..20)];
pop:=[3.929214, 5.308483, 7.239881,
 9.638453, 12.866020, 17.069453, 23.191876,
 31.433321, 39.818449, 50.155783,62.947714,
 75.994575, 91.972266, 105.710620, 122.775046,
 131.669275, 151.325798,179.323175, 203.302031,
 226.545805, 248.709873];
data:= [seq([tt[i],pop[i]],i=1..21)];
plot(data,style=POINT,symbol=CROSS,tickmarks=[4,5]);

tzeroed:=[seq((i-1)*10,i=1..21)];

lnpop:=[seq(ln(pop[i]),i=1..21)];
plot([seq([tzeroed[i],lnpop[i]],i=1..21)],style=POINT,symbol=CIRCLE);

              Page 103
with(stats):
fit[leastsquare[[t,y],y=m*t+b]]([tzeroed,lnpop]);
y:=unapply(rhs(%),t);
J:=plot(exp(y(t-1790)),t=1790..1930,tickmarks=[4,5]):
K:=plot(data,style=POINT,symbol=CROSS,tickmarks=[4,5]):
plots[display]({J,K} );

               Exercises/Experiments
2.
yrs:=([9,19,29,39,49,59,69,79,89]);
DR:=([.3,1.5, 1.9, 2.9, 6.5, 16.5,37.0, 83.5, 181.9]);
pts:=[seq([yrs[i],DR[i]], i=1..9)];
plot(pts,style=POINT, symbol=CROSS);
lnpts:=[seq([yrs[i],ln(DR[i]) ], i=1..9)];
plot(lnpts,style=POINT,symbol=CIRCLE);
with(stats): lnDR:=map(ln,DR);
fit[leastsquare[[t,y],y=a*t+b]]([yrs,lnDR]);
a:=op(1,op(1,rhs(%)));
b:=op(2,rhs(%%));
death:=t-> exp(a*t+b);
J:=plot(pts,style=POINT, symbol=CROSS):
K:=plot(death(t),t=0..90):
plots[display]({ J,K});






