Fitting a Line to the 1950-1980 Data

> third:=[seq(dataPvsRel[i],i=16..nops(dataPvsRel))]:
newthird:=[seq([third[i][1],third[i][2]/100],i=1..4)]:

> xdata:=map(x->x[1],newthird);
ydata:=map(x->x[2],newthird);

[Maple Math]

[Maple Math]

> with(stats):
with(math3):
clear(a,b):
linefit:=fit[leastsquare[[x,y],y=a*x+b]]([xdata,ydata]);

lineplot:=plot(rhs(linefit),x=151000..206000,y=0.005..0.02):
thirdplot:=plot(newthird,style=point):
with(plots):
display([thirdplot,lineplot]);

[Maple Math]

[Maple Plot]

We now have modeled with a line the relative growth rate data, as a function of [Maple Math] , between 1950 and 1980. Thus, as in the above section, we have the relationship [Maple Math] , a differential equation that we must solve for [Maple Math] . We have already solved this equation in Chapter 3. This will be clear if we rewrite it in the form [Maple Math] . You should already have done this in the above section where you also showed that [Maple Math] and [Maple Math] . Then you will be able to determine the exact solution from the results of your work in Chapter 3 which we will state here, namely, [Maple Math] where [Maple Math] .

> data3:=[seq(dataCensus[i],i=17..21)];

[Maple Math]

> a:=coeff(rhs(linefit),x,1);
b:=coeff(rhs(linefit),x,0);
K:=b;
L:=-b/a;
P0:=data3[1][2];
A:=(L-P0)/P0;

f3:=t->L/(1+A*exp(-K*(t-1950)));

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

Thus, the exponential fitting function and its graph with the original census data between 1950 and 1990 are:

> with(plots):
p1:=plot(data3, style=point):
p2:=plot(f3(t),t=1950..1990):
display([p1,p2]);

[Maple Plot]

The total error with this fit is:

tm3p.html

> f3error:=[seq([data3[i][1],abs(f3(1950+10*(i-1))-data3[i][2]),abs(f3(1950+10*(i-1))-data3[i][2])/data3[i][2]*100],i=1..5)]:
toterrorf3:=add((f3(1950+10*(i-1))-data3[i][2])^2,i=1..5):

with(math3):
headers:=["year","absolute error","% error"]:
printtable(f3error,"Rel Growth Rate Fit", headers);
TotalSqrError:=toterrorf3;

                                   Rel Growth Rate Fit

 

                   year            absolute error              % error

                   ---------------------------------------------------

                   1950                0.000000               0.000000

                   1960             3875.678400               2.145158

                   1970             3161.214300               1.542966

                   1980             2287.313300               1.004432

                   1990             2805.481600               1.122534

 

[Maple Math]

Here is a plot of this logistic curve over a longer time interval. Note the value of [Maple Math] and the classic shape of the logistic curve.

> plot(f3(t),t=1950..2100);

[Maple Plot]

The predicted limit is 350 million!

Go back