CoCalc Public Filesprojects_F20 / dds_Proj11 / Population Model.ipynb
Author: Julia Burnside
Views : 55
Compute Environment: Ubuntu 20.04 (Default)

# A Population Model

The average rat can live up to 4 years. Below is a table of birth and survival rates for rats observed at the local park.

Age (Years) Birth Rate Survival Rate Population in 2019
0-1 0.000 0.845 61
1-2 0.450 0.975 75
2-3 0.391 0.965 64
3-4 0.264 0.012 43
##### Construct a discrete population model for this population of rats.

First we need to separate the population into 4 age groups;

$A_n=(0-1)\ age\ population,$

$B_n=(1-2)\ age\ population,$

$C_n=(2-3)\ age\ population,$

$D_n=(3-4)\ age\ population.$

Our initial population values as of 2019 are;

$A_0=61,$

$B_0=75,$

$C_0=64,$

$D_0=43.$

The birth rate each year for each group must be added to A;

$A_{n+1}=0.450 \cdot B_n + 0.391 \cdot C_n + 0.264 \cdot D_n$

Each year, a percentage of the population of each age group graduates to the next group, so we must transfer the survival rate of the previous age group to the subsequent population group;

$B_{n+1}=0.845 \cdot A_n,$

$C_{n+1}=0.975 \cdot B_n,$

$D_{n+1}=0.965 \cdot C_n.$

In [39]:
import numpy as np
import matplotlib.pyplot as plt

def rat(n):
A=[61]
B=[75]
C=[64]
D=[43]
for i in range(n):
A_old=A[-1]
B_old=B[-1]
C_old=C[-1]
D_old=D[-1]
A_new=0.45*B_old+0.391*C_old+0.264*D_old
B_new=0.845*A_old
C_new=0.975*B_old
D_new=0.965*C_old
A.append(A_new)
B.append(B_new)
C.append(C_new)
D.append(D_new)
return A, B, C, D

Y1,Y2,Y3,Y4=rat(6)

plt.plot(Y1, label="Age 0-1")
plt.plot(Y2, label="Age 1-2")
plt.plot(Y3, label="Age 2-3")
plt.plot(Y4, label="Age 3-4")
plt.xlabel("2019-2025 (Six Year Period)")
plt.ylabel("Rat Population")
plt.legend()
plt.show()

In [42]:
rat(6)
rat(20)
rat(200)

([61, 70.126, 68.09176500000001, 64.944979125, 61.285255512, 61.348851381796884, 58.51658482908944, 56.70136150475633, 54.87673777683243, 53.28747472999706, 51.41444881947399, 49.84135821268461, 48.2342116649777, 46.699105477272276, 45.18811011504739, 43.7564910243037, 42.35009879043183, 40.99677690718738, 39.68367805208794, 38.415545971481166, 37.18509939631312, 35.995847644201255, 34.84385361031996, 33.72910182697112, 32.649697416076314, 31.60510278834911, 30.593766073224323, 29.61486919906786, 28.667251173996974, 27.749988179426623, 26.862049495859377, 26.00253813963457, 25.170520904203084, 24.365130779926076, 23.585507626947148, 22.83083287798793, 22.100304299518427, 21.393151573075325, 20.708625424992082, 20.046002704665174, 19.404581973035928, 18.783685202274587, 18.182655452623194, 17.600857163474828, 17.037674891585734, 16.492513030135076, 15.964794935088571, 15.453962472999507, 14.959475333470632, 14.480810516809884, 14.01746174355695, 13.568938943271979, 13.134767720656306, 12.714488863415987, 12.307657850640403, 11.913844386387751, 11.532631942155433, 11.163617317862704, 10.806410214439934, 10.460632821609984, 10.125919417911273, 9.801915984122125, 9.488279828670029, 9.184679225268898, 8.890793062000025, 8.606310501716303, 8.330930653252494, 8.064362253194117, 7.806323357804899, 7.556541044826769, 7.314751124812056, 7.080697861698284, 6.854133702320082, 6.634819014578398, 6.422521833986118, 6.217017618324537, 6.018089010149585, 5.8255256068976236, 5.639123738347027, 5.4586862512005805, 5.284022300560579, 5.114947148076264, 4.951281966549975, 4.792853650795428, 4.639494634548037, 4.491042713233634, 4.347340872408134, 4.208237121686695, 4.073584333986717, 3.9432400899146485, 3.8170665271320203, 3.6949301945413815, 3.5767019111379006, 3.4622566293773707, 3.351473302916067, 3.2442347585826092, 3.140427572446381, 3.0399419498514524, 2.942671609289098, 2.8485136699861098, 2.757368543089983, 2.6691398263359045, 2.5837342020841247, 2.5010613386198717, 2.4210337946114144, 2.3435669266252255, 2.2685787996004168, 2.195990100187768, 2.1257240528616803, 2.0577063387163337, 1.9918650168601604, 1.92813044832549, 1.8664352224128933, 1.8067140853923174, 1.7489038714856011, 1.692943436057373, 1.6387735909436694, 1.5863370418498712, 1.5355783277517434, 1.4864437622354905, 1.438881376714774, 1.3928408654646451, 1.3482735324142456, 1.3051322396420102, 1.2633713575188863, 1.2229467164468453, 1.1838155601416367, 1.1459365004103752, 1.1092694733761266, 1.0737756971031978, 1.0394176305783054, 1.006158934004245, 0.9739644303640584, 0.9428000682150508, 0.912632885673302, 0.8834309755505828, 0.8551634516067992, 0.8278004158822729, 0.8013129270753034, 0.7756729699315692, 0.7508534256129865, 0.7268280430146925, 0.703571410999807, 0.6810589315226145, 0.6592667936117328, 0.6381719481857542, 0.6177520836747221, 0.5979856024216572, 0.5788515978391746, 0.5603298322970297, 0.5424007157172075, 0.5250452848539123, 0.5082451832365463, 0.4919826417544596, 0.4762404598629397, 0.46100198739056114, 0.446251106928652, 0.43197221678425346, 0.41815021447854084, 0.40477048077325195, 0.39181886420822976, 0.3792816661337232, 0.3671456262216166, 0.35539790844026214, 0.3440260874780816, 0.3330181356015787, 0.3223624099338604, 0.3120476401402135, 0.30206291650771105, 0.2923976784062405, 0.2830417031187497, 0.2739850950288963, 0.2652182751546642, 0.25673197101687795, 0.24851720683189857, 0.24056529401812757, 0.23286782200627892, 0.22541664934369857, 0.21820389508332272, 0.21122193044816773, 0.20446337076253454, 0.19792106764139422, 0.1915881014296927, 0.185457773883579, 0.17952360108581444, 0.1737793065878716, 0.16821881477146766, 0.1628362444225122, 0.15762590251067193, 0.15258227816797332, 0.1477000368600747, 0.14297401474404262, 0.1383992132066647, 0.13397079357752278, 0.12968407201123391, 0.12553451453344655, 0.12151773224535227, 0.1176294766816406, 0.11386563531698765, 0.11022222721632527, 0.10669539882429066], [75, 51.545, 59.25647, 57.53754142500001, 54.878507360625, 51.78604090764, 51.83977941761837, 49.44651418058057, 47.91265047151909, 46.3708434214234, 45.02791614684751, 43.44520925245552, 42.115947689718496, 40.757908856906155, 39.46074412829507, 38.18395304721504, 36.97423491553663, 35.78583347791489, 34.64227648657334, 33.532707954014306, 32.461136345901586, 31.421408989884586, 30.41649125935006, 29.443056300720365, 28.501091043790595, 27.588994316584486, 26.706311856154997, 25.85173233187455, 25.024564473212344, 24.223827242027443, 23.448740011615495, 22.698431824001172, 21.97214472799121, 21.269090164051605, 20.588535509037534, 19.92975394477034, 19.2920537818998, 18.67475713309307, 18.07721307924865, 17.498788484118307, 16.93887228544207, 16.39687176721536, 15.872213995922024, 15.364343857466599, 14.872724303136229, 14.396835283389946, 13.936173510464139, 13.490251720149843, 13.058598289684582, 12.640756656782683, 12.236284886704352, 11.844755173305623, 11.465753407064822, 11.098878723954579, 10.74374308958651, 10.399970883791141, 10.06719850649765, 9.745073991121341, 9.433256633593984, 9.131416631201743, 8.839234734260437, 8.556401908135026, 8.282619006583195, 8.017596455226174, 7.761053945352218, 7.512720137390021, 7.272332373950276, 7.039636401998357, 6.814386103949029, 6.59634323734514, 6.38527718287862, 6.180964700466187, 5.98318969313505, 5.791742978460469, 5.606422067318746, 5.42703094971827, 5.2533798874842335, 5.085285213576399, 4.922569137828492, 4.765059558903237, 4.612589882264491, 4.46499884397369, 4.322130340124443, 4.183833261734729, 4.049961334922137, 3.9203729661930913, 3.794931092682421, 3.673503037184873, 3.555960367825257, 3.4421787622187754, 3.332037875977878, 3.225421215426557, 3.122216014387467, 3.022313114911526, 2.9256068518238783, 2.8319949409640763, 2.7413783710023045, 2.653661298717192, 2.568750947624477, 2.486557509849288, 2.4069940511382626, 2.3299764189110355, 2.2554231532538394, 2.183255400761085, 2.1133968311337914, 2.0457735564466453, 1.9803140529983154, 1.9169490856623521, 1.855611634658664, 1.7962368246681197, 1.738761856215302, 1.6831259392468354, 1.629270228835039, 1.5771377629388947, 1.526673402156508, 1.4778237714053328, 1.43053720346848, 1.3847636843474005, 1.3404548003631411, 1.2975636869502232, 1.2560449790889894, 1.215854763323984, 1.1769505313176252, 1.1392911348900374, 1.1028367424974985, 1.067548797103459, 1.0333899753975841, 1.000324148319683, 0.968316342846767, 0.937332705002827, 0.907340464052202, 0.878307897838668, 0.850204299233587, 0.8229999436576294, 0.7966660576417179, 0.7711747883939402, 0.7464991743402425, 0.7226131166077453, 0.6994913514205207, 0.6771094233786313, 0.655443659592176, 0.6344711446429736, 0.6141696963474151, 0.594517842294837, 0.5754947971366092, 0.5570804406019142, 0.5392552962169622, 0.5220005107051402, 0.5052978340463004, 0.4891296001741025, 0.4734787082909901, 0.4583286047810403, 0.4436632657015559, 0.42946717983488164, 0.41572533228251835, 0.4024231885841841, 0.3895466793450241, 0.37708218535471094, 0.3650165231826942, 0.353336931234367, 0.3420310562533979, 0.33108694025595414, 0.3204930078829961, 0.310238054157266, 0.30031123263202153, 0.29070204391897897, 0.281400324583334, 0.27239623639411203, 0.26368025591848043, 0.25524316444901585, 0.2470760382532732, 0.2391702391353435, 0.23151740529941736, 0.22410944250569123, 0.21693851550926185, 0.20999703977295428, 0.20327767344531777, 0.19677330959530567, 0.19047706869542527, 0.18438229134540768, 0.17848253122870172, 0.1727715482943417, 0.1672433021569781, 0.16189194570809035, 0.15671181893162425, 0.1516974429175132, 0.1468435140667515, 0.14214489848189016, 0.13759662653702281, 0.1331938876215178, 0.12893202505193746, 0.12480653114676313, 0.120813042458716, 0.11694733515963167, 0.11320532057300675, 0.10958304084949265, 0.10607666478076233, 0.10268248374732267, 0.09939690779598631, 0.09621646184285457, 0.09313778199779485], [64, 73.125, 50.256375, 57.77505825, 56.099102889375004, 53.50654467660937, 50.491389884949, 50.54378493217791, 48.21035132606605, 46.714834209731116, 45.211572335887816, 43.90221824317632, 42.35907902114413, 41.06304899747553, 39.7389611354835, 38.47422552508769, 37.22935422103466, 36.04987904264821, 34.89118764096702, 33.776219574409005, 32.694390255163945, 31.649607937254046, 30.63587376513747, 29.656078977866308, 28.706979893202355, 27.78856376769583, 26.899269458669874, 26.03865405975112, 25.205439023577686, 24.398950361382035, 23.618231560976756, 22.862521511325106, 22.13097102840114, 21.42284110979143, 20.737362909950313, 20.073822121311597, 19.43151009615108, 18.809752437352305, 18.207888204765744, 17.625282752267434, 17.061318772015348, 16.515400478306017, 15.986949973034974, 15.475408646023974, 14.980235261029934, 14.500906195557823, 14.036914401305197, 13.587769172702535, 13.152995427146097, 12.732133332442467, 12.324737740363116, 11.930377764536743, 11.548636293972983, 11.179109571888201, 10.821406755855714, 10.475149512346846, 10.139971611696362, 9.815518543835209, 9.501447141343307, 9.197425217754134, 8.9031312154217, 8.618253865903926, 8.34249186043165, 8.075553531418615, 7.8171565438455195, 7.567027596718413, 7.324902133955271, 7.090524064601518, 6.863645491948398, 6.644026451350303, 6.431434656411511, 6.225645253306655, 6.026440582954532, 5.833609950806673, 5.646949403998957, 5.466261515635778, 5.291355175975313, 5.122045390297128, 4.958153083236989, 4.7995049093827795, 4.645933069930656, 4.497275135207878, 4.353373872874347, 4.2140770816213315, 4.079237430191361, 3.9487123015490835, 3.822363642038264, 3.7000578153653603, 3.5816654612552514, 3.4670613586296257, 3.356124293163306, 3.2487369290784307, 3.144785685040893, 3.0441606140277804, 2.9467552870387377, 2.8524666805282815, 2.7611950674399743, 2.672843911727247, 2.587319766249262, 2.5045321739338653, 2.424393572103056, 2.346819199859806, 2.2717270084382597, 2.1990375744224933, 2.128674015742058, 2.0605619103554464, 1.9946292175354792, 1.9308062016733576, 1.8690253585207932, 1.8092213437921973, 1.7513309040514167, 1.6952928098099194, 1.6410477907656644, 1.588538473114163, 1.5377093188654223, 1.4885065671025952, 1.4408781771201995, 1.394773773381768, 1.3501445922387154, 1.3069434303540626, 1.2651245947764675, 1.2246438546117646, 1.1854583942408843, 1.1475267680346846, 1.1108088565177865, 1.075265823935061, 1.0408600771758725, 1.0075552260126446, 0.9753160446116909, 0.9441084342755979, 0.9138993873777562, 0.8846569524508969, 0.8563502003927013, 0.8289491917527473, 0.8024249450661887, 0.776749406200675, 0.7518954186840916, 0.7278366949817364, 0.7045477886925516, 0.6820040676350076, 0.6601816877941655, 0.6390575681023716, 0.6186093660268992, 0.5988154539387297, 0.579654896237466, 0.561107427208194, 0.5431534295868663, 0.5257739138115382, 0.5089504979375117, 0.49266538819514283, 0.47690136016974993, 0.4616417405837153, 0.4468703896615143, 0.43257168405901697, 0.4187305003390096, 0.40533219897545536, 0.39236260886957947, 0.3798080123613985, 0.36765513072084316, 0.3558911101031268, 0.3445035079535078, 0.33348027984706297, 0.3228097667495553, 0.3124806826859212, 0.3024821028033344, 0.29280345181622097, 0.28343449282100447, 0.2743653164687507, 0.2655863304842592, 0.2570882495205184, 0.24886208533779045, 0.24089913729694137, 0.2331909831569599, 0.22572947016693193, 0.21850670644304895, 0.2115150526215303, 0.20474711377863042, 0.19819573160918483, 0.19185397685542302, 0.18571514197803965, 0.1797727340617725, 0.17402046794798418, 0.16845225958698315, 0.16306221960305364, 0.1578446470653881, 0.15279402345833365, 0.14790500684457536, 0.14317242621508272, 0.1385912760198429, 0.13415671087359723, 0.12986404043097985, 0.12570872442563902, 0.12168636786809404, 0.1177927163972481, 0.11402365178064088, 0.11037518755868159, 0.10684346482825532, 0.10342474816124327, 0.1001154216536396, 0.09691198510108665, 0.0938110502967832], [43, 61.76, 70.565625, 48.497401874999994, 55.75293121125, 54.13563428824688, 51.633815612928046, 48.724191238975784, 48.77475245955168, 46.52298902965374, 45.079815012390526, 43.62916730413174, 42.365640604665145, 40.87651125540409, 39.62584228256389, 38.34809749574158, 37.12762763170962, 35.926326823298446, 34.78813327615552, 33.66999607353317, 32.59405188930469, 31.550086596233207, 30.541871659450155, 29.563618183357658, 28.618116213640985, 27.702235596940273, 26.815964035826475, 25.957795027616427, 25.12730116765983, 24.323248657752465, 23.544987098733664, 22.791593456342568, 22.062333258428726, 21.3563870424071, 20.67304167094873, 20.011555208102052, 19.37123834706569, 18.751407242785792, 18.151411102044975, 17.570612117598944, 17.008397855938075, 16.46417261499481, 15.937361461565306, 15.42740672397875, 14.933769343413134, 14.455927026893885, 13.9933744787133, 13.545622397259514, 13.112197251657946, 12.692640587195983, 12.28650866580698, 11.893371919450406, 11.512814542777956, 11.144434023683928, 10.787840736872115, 10.442657519400763, 10.108519279414706, 9.78507260528699, 9.471975394800976, 9.168896491396291, 8.87551533513274, 8.59152162288194, 8.316614980597288, 8.050504645316542, 7.792909157818963, 7.543556064810926, 7.302181630833268, 7.068530559266836, 6.842355722340465, 6.623417899730203, 6.411485525553043, 6.206334443437108, 6.0077476694409215, 5.815515162551123, 5.629433602528439, 5.449306174858994, 5.274942362588526, 5.106157744816176, 4.942773801636728, 4.784617725323694, 4.631522237554382, 4.483325412483083, 4.339870505475602, 4.201005787323745, 4.066584383764585, 3.936464120134663, 3.8105073709948654, 3.688580914566925, 3.5705557918275725, 3.4563071701113177, 3.345714211077589, 3.23865994290259, 3.1350311365606855, 3.034718186064462, 2.937614992536808, 2.8436188519923817, 2.7526303467097915, 2.664553240079575, 2.579294374816793, 2.496763574430538, 2.41687354784618, 2.339539797079449, 2.2646805278647126, 2.1922165631429205, 2.122071259317706, 2.054170425191086, 1.9884422434930058, 1.9248171949217374, 1.8632279846147901, 1.8036094709725654, 1.7458985967594705, 1.690034322409617, 1.6359575614665722, 1.5836111180888661, 1.5329396265551671, 1.4838894927051325, 1.4364088372540043, 1.3904474409209924, 1.345956691313406, 1.3028895315103604, 1.2612004102916703, 1.2208452339592912, 1.1817813197003528, 1.1439673504424532, 1.1073633311534705, 1.071930546539664, 1.0376315200973338, 1.004429974474717, 0.972290793102202, 0.9411799830502816, 0.9110646390759519, 0.8819129088195348, 0.8536939591151155, 0.8263779433789566, 0.7999359700414012, 0.774340071988872, 0.7495631769836514, 0.7255790790301484, 0.7023624106573756, 0.6798886160883123, 0.6581339252677824, 0.6370753287213697, 0.6166905532187885, 0.5969580382159577, 0.5778569130508742, 0.5593669748691547, 0.5414686672559071, 0.524143059551326, 0.5073718268281343, 0.49113723050969876, 0.47542209960831283, 0.46020981256380866, 0.44548427966328524, 0.4312299260233613, 0.41743167511695134, 0.40407493282714424, 0.3911455720113144, 0.37862991755914416, 0.36651473192874956, 0.35478720114561363, 0.34343492124951736, 0.332445885175135, 0.32180847005241575, 0.31151142491332084, 0.301543858791914, 0.29189522920521765, 0.28255533100265323, 0.2735142855722693, 0.2647625303923444, 0.25629080891731015, 0.24809016078730026, 0.24015191235096778, 0.23246766749154843, 0.2250292987464663, 0.2178289387110893, 0.21085897171754223, 0.20411202577977675, 0.19758096479637835, 0.19125888100286334, 0.1851390876654832, 0.17921511200880827, 0.17348068836961045, 0.16792975156980472, 0.16255643050143873, 0.15735504191694677, 0.1523200844180995, 0.14744623263729198, 0.14272833160501522, 0.1381613912975548, 0.13374058135914837, 0.12946122599302132, 0.12531879901589554, 0.12130891907074165, 0.11742734499271075, 0.11366997132334442, 0.11003282396831844, 0.10651205599412773, 0.10310394355926639, 0.09980488197559975, 0.09661138189576221, 0.09352006562254861])
##### Estimate the population of rats at the local part in 2025.

Assuming the population model is correct, the rat population for all age groups will decrease between 2019-2025. If we continue to monitor this trend over a long enough period of time, the population will completely bottom out, suggesting the birth rate vs the survival rate is not sustainable.

In [ ]: