Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 303
Kernel: SageMath (default)

MTH 337 Differential Equations Project 1:

Project 1 Topic

Mason High, Nicole Hester

Due Friday, February 21st at 5PM

MTH 337-001

Remember to use both markdown cells and calculations cells in your writeup.

For instance, the graph of y=x2y=x^2 as xx goes from −1-1 to 33 is given below.

New York

This is a scatter plot of the given data for the population in thousands of New York from 1790-2000, where t0=1790t_0=1790

s = scatter_plot([[0,340],[1,589],[2,959],[3,1373],[4,1919],[5,2429],[6,3097],[7,3881],[8,4383],[9,5083],[10,6003],[11,7269],[12,9114],[13,10385],[14,12588],[15,13479],[16,14830],[17,16782],[18,18241],[19,17558],[20,17990],[21,18976]], title="New York Population between 1790-2000") d = s.get_minmax_data() d['xmin'] 0.0 d['ymin'] 0 d['xmax'] 22 d['ymax'] 20000 s+text("Population in Thousands",(-10,10000))+text("Time in Years",(10,-3000))
Image in a Jupyter notebook

Exponential Growth Model

P(t)=CektP(t)=Ce^{kt}C=P0C=P_0P0=340P_0=340t=11,P(t)=7269t=11,P(t)=72697269=340ek(11)7269=340e^{k(11)}7269340=e11k\frac{7269}{340}=e^{11k}ln∣7269340∣=11kln|\frac{7269}{340}|=11kln∣7269340∣11=k\frac{ln|\frac{7269}{340}|}{11}=kk≈.278k\approx.278P(t)=340e(.278)tP(t)=340e^{(.278)t}
P,t=var('P,t') f(t)=340*exp(.278*t) t_min=-5 t_max= 23 P_min=0 P_max=20000 p=plot(f(t),(t,t_min,t_max),xmin=0,xmax=25,ymin=0,ymax=20000) s = scatter_plot([[0,340],[1,589],[2,959],[3,1373],[4,1919],[5,2429],[6,3097],[7,3881],[8,4383],[9,5083],[10,6003],[11,7269],[12,9114],[13,10385],[14,12588],[15,13479],[16,14830],[17,16782],[18,18241],[19,17558],[20,17990],[21,18976]]) show(p+s)
Image in a Jupyter notebook

Estimated 2010 and 2020 Population

For 2010, the estimated population was 154,036 (in thousands) and for 2020 it will be about 203,403 (in thousands). Both of these estimates are larger than the actual values of New York's population which makes sense for our model as the first ten or so value are close but the deviation increases as time increases. In order to increase the accuracy of the 2020 estimate, some other factors that would affect the population would need to be accounted for so that the estimates aren't as large compared to the actual population.

Logistic Growth Model

Let's say that New York has a carrying capacity of 30,000,000. In thousands that is 30,000.

dPdt=(1−PN)P\frac{dP}{dt}=(1-\frac{P}{N})PN=carryingcapacityN = carrying capacityP(0)=340P(0)=340dPdt=(1−P30,000)P\frac{dP}{dt}=(1-\frac{P}{30,000})P30000P(30000−P)dP\frac{30000}{P(30000-P)}dP(1P+130000−P)dP=kdt(\frac{1}{P}+\frac{1}{30000-P})dP=kdt∫(1P+130000−P)dP=∫kdt\int{(\frac{1}{P}+\frac{1}{30000-P})dP}=\int{kdt}ln(∣P∣)−ln(∣30000−P∣)=kt+Cln(|P|)-ln(|30000-P|)=kt+Cln(∣P30000−P∣)=kt+Cln(|\frac{P}{30000-P}|)=kt+CP30000−P=ekt+C\frac{P}{30000-P}=e^{kt+C}P30000−P=ekt+eC\frac{P}{30000-P}=e^{kt}+e^{C}P=Cekt(30000−P)P=Ce^{kt}(30000-P)30000Cekt−PCekt30000Ce^{kt}-PCe^{kt}P=30000CektCekt+1P=\frac{30000Ce^{kt}}{Ce^{kt}+1}P=30000Ce−kt+1P=\frac{30000}{Ce^{-kt}+1}P(0)=340P(0)=340340=30000Ce−k∗0+1340=\frac{30000}{Ce^{-k*0}+1}340=30000C+1340=\frac{30000}{C+1}340(C+1)=30000340(C+1)=30000C+1=30000340C+1=\frac{30000}{340}C=148317C=\frac{1483}{17}k=.278k=.278P=30000148317e−.278t+1P=\frac{30000}{\frac{1483}{17}e^{-.278t}+1}
t,y,x=var('t,y,x') t_min=0 t_max=25 f(t)=(30000)/((1483/17)*exp(-.278*t)+1) q=plot(f(t),(t,t_min,t_max),xmin=0,xmax=25,ymin=0,ymax=32000) s = scatter_plot([[0,340],[1,589],[2,959],[3,1373],[4,1919],[5,2429],[6,3097],[7,3881],[8,4383],[9,5083],[10,6003],[11,7269],[12,9114],[13,10385],[14,12588],[15,13479],[16,14830],[17,16782],[18,18241],[19,17558],[20,17990],[21,18976]]) show(q+s)
Image in a Jupyter notebook

For 2010, the estimated population was 25,156 (in thousands) and for 2020 it will be about 26,182(in thousands). Both of these estimates are larger than the actual values of New York's population however, these are much closer to the actual values for New York which makes sense for the graph as the estimated values are more accurate

Euler's Method

t,y = PolynomialRing(QQ,2,"ty").gens() eulers_method((y*exp(.278*t)),0,340,1,21)
x y h*f(x,y) 0 340 340 1 680 897.930614102185 2 1577.93061410218 2751.41204463138 3 4329.34265873357 9968.35643741993 4 14297.6990961535 43471.1987866371 5 57768.8978827906 231933.462726138 6 289702.360608929 1.53587273153673e6 7 1.82557509214566e6 1.27801739041313e7 8 1.46057489962769e7 1.35018960682557e8 9 1.49624709678834e8 1.82645137431434e9 10 1.97607608399318e9 3.18524117927823e10 11 3.38284878767754e10 7.20037492875595e11 12 7.53865980752371e11 2.11885158320564e13 13 2.19423818128087e13 8.14374235601790e14 14 8.36316617414599e14 4.09868790111629e16 15 4.18231956285775e16 2.70660701367976e18 16 2.74843020930833e18 2.34869470632878e20 17 2.37617900842187e20 2.68135845667822e22 18 2.70512024676244e22 4.03084559430876e24 19 4.05789679677638e24 7.98443980310159e26 20 8.02501877106936e26 2.08508313864416e29 21 2.09310815741523e29 7.18129645787820e31
/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/sage/repl/ipython_kernel/__main__.py:2: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...) See http://trac.sagemath.org/5930 for details. from sage.repl.ipython_kernel.kernel import SageKernel

Eulers Method is accurate for the first population with regards to tt, but became extremely inacccurate after the fact. This is less accurate when compared the the fourth order Runge-Kutta (below), which is accurate up to the 3rd population with regard to tt.

Fourth order Runge-Kutta Method

t,P=var('t,P') desolve_rk4((340*exp(0.278*t)),P, ics=[-1,0], ivar=t, end_points=[0,20], step=1)
[[-1, 0], [0.0, 296.8318396696827], [1.0, 688.7941868456819], [2.0, 1206.375056117268], [3.0, 1889.833449929883], [4.0, 2792.33082532614], [5.0, 3984.066152554332], [6.0, 5557.736202885624], [7.0, 7635.745783309438], [8.0, 10379.72875192735], [9.0, 14003.12038736414], [10.0, 18787.75902904131], [11.0, 25105.80831400929], [12.0, 33448.7051880963], [13.0, 44465.3853550671], [14.0, 59012.75945461924], [15.0, 78222.36615871494], [16.0, 103588.3866652886], [17.0, 137083.866622342], [18.0, 181314.1855745249], [19.0, 239719.7112490383], [20.0, 316843.4017429747]]

Montana

This is a scatter plot of the given data for the population in thousands of Montana from 1870-2000, where t0=1870t_0=1870

s = scatter_plot([[0,21],[1,39],[2,143],[3,243],[4,376],[5,549],[6,538],[7,559],[8,591],[9,675],[10,694],[11,787],[12,799],[13,902]], title="Montana Population between 1870-2000") d = s.get_minmax_data() d['xmin'] 0.0 d['ymin'] 0 d['xmax'] 15 d['ymax'] 1000 s+text("Population in Thousands",(-3,500))+text("Time in Years",(7,-100))
Image in a Jupyter notebook

Exponential Growth Model

P(t)=CektP(t)=Ce^{kt}C=P0C=P_0P0=21P_0=21t=1,P(t)=39t=1,P(t)=3939=21ek(1)39=21e^{k(1)}3921=e1k\frac{39}{21}=e^{1k}ln∣3921∣=1kln|\frac{39}{21}|=1kln∣3921∣1=k\frac{ln|\frac{39}{21}|}{1}=kk≈.619k\approx.619P(t)=21e(.619)tP(t)=21e^{(.619)t}
y,x=var('y,x') f(t)=21*exp(0.619*x) q=plot(f(t),(t,t_min,t_max),xmin=0,xmax=15,ymin=0,ymax=1000) s = scatter_plot([[0,21],[1,39],[2,143],[3,243],[4,376],[5,549],[6,538],[7,559],[8,591],[9,675],[10,694],[11,787],[12,799],[13,902]]) show(q+s)
Image in a Jupyter notebook

We have created the above exponential model using the first population, of 21, as our P0P_0, because that is where the population starts. We decided to use the next year, t=1, P=39, to help us solve for kk, because it made our exponential more accurate to the original data. This model fits the data for the first about 6 populations 1870-1930, but becomes wildly inaccurate after that.

Estimated 2010 Population

This model estimates that the population of 2010, t=14t=14, was 121847, but this in thousands, in real numbers it is 121,847,000. The actually population of Montana in 2010 was 989,415, which is a lot smaller that the estimated value.

Logistic Growth Model

Let's say that Montana has a carrying capacity of 1,500,000, in thousands that is 1500. We chose this carrying capacity, because it gave more room for the population to grow from the year 2000. We will be using the the kk value, .417. We found this kk value by solving for it using our exponential function,using a mid point of the data which is when t=8t=8 (1940) P=591P=591. ln(59121)=8kln(\frac{591}{21})=8k, k=ln591218k=\frac{ln\frac{{591}}{{21}}}{8}, k≈.417k\approx.417 This kk value made our logistic model more accurate to our original data.

dPdt=(1−PN)P\frac{dP}{dt}=(1-\frac{P}{N})PN=carryingcapacityN = carrying capacityP(0)=21P(0)=21dPdt=(1−P1500)P\frac{dP}{dt}=(1-\frac{P}{1500})P1500P(1500−P)dP\frac{1500}{P(1500-P)}dP(1P+11500−P)dP=kdt(\frac{1}{P}+\frac{1}{1500-P})dP=kdt∫(1P+11500−P)dP=∫kdt\int{(\frac{1}{P}+\frac{1}{1500-P})dP}=\int{kdt}ln(∣P∣)−ln(∣1500−P∣)=kt+Cln(|P|)-ln(|1500-P|)=kt+Cln(∣P1500−P∣)=kt+Cln(|\frac{P}{1500-P}|)=kt+CP1500−P=ekt+C\frac{P}{1500-P}=e^{kt+C}P1500−P=ekt+eC\frac{P}{1500-P}=e^{kt}+e^{C}P=Cekt(1500−P)P=Ce^{kt}(1500-P)1500Cekt−PCekt1500Ce^{kt}-PCe^{kt}P=1500CektCekt+1P=\frac{1500Ce^{kt}}{Ce^{kt}+1}P=1500Ce−kt+1P=\frac{1500}{Ce^{-kt}+1}P(0)=21P(0)=2121=1500Ce−k∗0+121=\frac{1500}{Ce^{-k*0}+1}21=1500C+121=\frac{1500}{C+1}21(C+1)=150021(C+1)=1500C+1=150021C+1=\frac{1500}{21}C=4937C=\frac{493}{7}k=.417k=.417P=15004937e−.417t+1P=\frac{1500}{\frac{493}{7}e^{-.417t}+1}
t,y,x=var('t,y,x') t_min=0 t_max=15 f(t)=(1500/((493/7)*exp(-.417*t)+1)) q=plot(f(t),(t,t_min,t_max),ymin=0,ymax=1700) s = scatter_plot([[0,21],[1,39],[2,143],[3,243],[4,376],[5,549],[6,538],[7,559],[8,591],[9,675],[10,694],[11,787],[12,799],[13,902]]) show(q+s)
Image in a Jupyter notebook

The above Logistic model is accurate at the first 2 populations, 1870-1880, and between the 8th and 12th populations, 1950-1990, but is not as accurate between the 2nd and 8th populations, 1880-1950.

Estimated 2010 Population

This model extimates that the population in 2010, t=14t=14, will be 1245 in thousands, in real numbers that is 1,245,000. This is not as far off of 989,415 as the exponential model was. This means that the logistic model better fits the way the population in Montana is growing than the exponential model.

Euler's Method

t,y = PolynomialRing(QQ,2,"ty").gens() eulers_method((y*exp(.619*t)),0,21,1,14)
x y h*f(x,y) 0 21 21 1 42 77.9969418042685 2 119.996941804268 413.834550507003 3 533.831492311271 3418.92082389472 4 3952.75231620599 47012.4342476488 5 50965.1865638548 1.12568023274638e6 6 1.17664541931023e6 4.82631111654341e7 7 4.94397565847443e7 3.76594795601901e9 8 3.81538771260375e9 5.39715575111615e11 9 5.43530962824218e11 1.42783771040922e14 10 1.43327302003746e14 6.99216661967487e16 11 7.00649934987525e16 6.34763890551583e19 12 6.35464540486571e19 1.06913053420253e23 13 1.06976599874302e23 3.34238509624232e26 14 3.34345486224106e26 1.93995405594528e30
/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/sage/repl/ipython_kernel/__main__.py:2: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...) See http://trac.sagemath.org/5930 for details. from sage.repl.ipython_kernel.kernel import SageKernel

Eulers Method is accurate for the first 3 populations with regards to tt, which means it is accurate between the years 1870-1890, but becomes extremely inacccurate after the fact.

Estimated 2010 Population

In 2010 t=14, and the above model, Euler's Method, predicts the population will be ≈3.343e26\approx 3.343e26, which is extremely larger than the actually population of Montana which was 989,415. It shows that Euler's Method is more accurate in the begining of the data and not as the data gets farther and farther away from the starting point.

Fourth order Runge-Kutta Method

t,P=var('t,P') desolve_rk4((21*exp(0.619*t)),P, ics=[-1,0], ivar=t, end_points=[0,14], step=1)
[[-1, 0], [0.0, 15.65808207840933], [1.0, 44.73623723641293], [2.0, 98.73640808484853], [3.0, 199.0185076821339], [4.0, 385.2493906892606], [5.0, 731.0931845955554], [6.0, 1373.349333802144], [7.0, 2566.063988399758], [8.0, 4781.018643250908], [9.0, 8894.344579287066], [10.0, 16533.07895202516], [11.0, 30718.74372175657], [12.0, 57062.51680508041], [13.0, 105984.7486166248], [14.0, 196836.7597485285]]

The fourth order Runge-Kutta is accurate up to the 6th population with regard to tt, which means it is accurate between the years 1870-1920. This means it is a little more accurate Euler's Method, but it becomes less accurate as time goes on.

Estimated 2010 Population

The Runge-Kutta Method predicted in 2010, t=14t=14 to be 196836 in thousands in real numbers that is 196,836,000. The model is still far off the actually population of 989,415, but it is closer than Eulers Method. This also supports the above statement that Runge-Kutta is more accurate than Eulers Method, but Runge-Kutta is also more accurate when it is closer to the beggining of the data and becomes more innaccurate as time goes on.

Estimating 2020 Population

The model that would be the best at estimating the 2020 population would be the logistic model, because it is the most accurate out of all the models above, with regards to the data provided. The logistic model is also the model that has the closest estimate to the actual 2010 population of Montana.