Computational Mathematics for Life and Management Sciences
Computational Mathematics for Life and Management Sciences MA 132
Popular in Course
Popular in Mathematics (M)
This 13 page Class Notes was uploaded by Braeden Lind on Thursday October 15, 2015. The Class Notes belongs to MA 132 at North Carolina State University taught by Staff in Fall. Since its upload, it has received 14 views. For similar materials see /class/223727/ma-132-north-carolina-state-university in Mathematics (M) at North Carolina State University.
Reviews for Computational Mathematics for Life and Management Sciences
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/15/15
Math 1329 Lesson 9 Population Models and Numerical Methods 91 Application Population models attempt to predict future population sizes Important examples include management of epidemics and fish populations We will consider several models but we will direct our efforts toward the fish population model Consider a lake which is capable of supporting a given fish population If no fish are removed then one can expect the fish population to level off to this maximum number However if the fish are harvested at a large rate number of fish per unit time then the fish population may decrease to an unacceptable level We would like to be able to determine the fish population as a function of these parameters 92 Math Model We will consider three continuous models for the population size birth b and death d rates are constant birth and death rates are not constant b d kM y and birth and death rates are not constant and nonzero harvesting rate H Here yt is the population size at any instant in time t The birth and death rates are the number of births or deaths in a unit of time per unit of population So if the unit of time is one day then a birth rate 01 means that 01 yt fish are born each day M is the maximum population size and H is the number of fish caught in each day Birth and Death Rates are Constant The continuous model can be used for very large populations where yt is viewed as a continuous function of time The change in the population size over a change in time dt is yt dt yt z births deaths dt b yt dt d yt Now the population yt will change a little as time moves from t to tdt and this is the reason we do not have an equality sign for the above change in population If we let dt go to zero we just get zero on both sides However if we divide by dt let dt go to zero and use the definition of a derivative we get the differential equation y b dy This differential equation with known b d and given initial condition yO yo is the continuous model Birth and Death Rates Vary with Population b d kM yt The change in the population size over a change in time dt is yt dt yt z births deaths dt b d yt dt kM yt yt Again the population yt will change a little as time moves from tto tdt and this is the reason we do not have an equality sign for the above change in population If we divide by dt and let dt go to zero we get the differential equation y kM W This differential equation with known k and M and given initial condition yO yo is the continuous model This is the logistic differential equation and it also is a model for the spread of information via personal communication Harvesting and b d kM y Varies with Population The change in the population size over a change in time dt is yt dt yt z births deaths harvesting dtbdytdtH dt kM yt yt dt H If we divide by dt and let dt go to zero we get the differential equation y39kMyyH This differential equation with known H k and M and given initial condition yO yo is the continuous model If the lake was stocked with new fish then H would be replaced by a positive stocking rate S 93 Method of Solution The first model where b d are constant will only be good enough approximation for small changes in population sizes The algebraic solution has the form yt yO em where yO is the initial population at some starting time set equal to zero If bd gt 0 then the population will increase to any large population size Eventually the environment will not be able to support this population size and therefore the bd will have to decrease or even become negative If bd lt 0 then the population will decrease to zero The next two models with variable bd have solutions which are a little more difficult to find and they are similar to the spread of information via personal communication model We will use three methods the Excel macro euler MATLABMAPLE CAS command dsolve and a new MATLAB command ode45 This last command is an implementation of much more capable numerical scheme for solving differential equations Recall in solving the spread of information models we had some difficulty with the euler macro39 we needed to either choose much smaller time steps or to use a quotbetterquot numerical method such as in the eulert macro The scheme used in the MATLAB command ode45 will also work well for these problem and it will work well for many systems of differential equations which might arise from models with interacting populations The ode45 is an implementation of the RungeKuttaFelberg variable step size method which should be described in a course on numerical analysis The general problem of solving or approximating the solution of the differential equation y gty can be approached via a variation of the first order finite difference method Since y39t is the derivative of yt and it can be approximated by Y39O e 0 0 t dt tdt where t is any time and dt represents a small change in time Now let t idt replace yt by Yi and replace the differential equation by the following discrete equation YiH Yidt gidt Yi Next we solve for Yil in terms of the previous Yi We hope the error Yi yidt will be small and it will decrease as dt goes to zero Euler39s Numerical Method for Approximating y39 gty Let Y0 be given Yi1 Yi dtgidtYi The Euler method is implemented in the macro euler The following variation is implemented in the macro eulert Inspection of this method shows that at each time step one must implicitly solve for the next value of the unknown Yil In the macro eulert this in done by successive approximation in the inner loop where one must choose the length of this inner loop The Eulertrapezoid scheme is generally more accurate and requires fewer time steps than the Euler method EulerTrapezoid Numerical Method for Approximating y39 gty Let Y0 be given Yi1 Yi dt2gidtYi gi1dtYi1 Macros gfct and eulert Function gfctty kl18 Ml 0 Hl 0 gfct kyM y End Function Sub eulertO tmax 10 n 100 dt tmax n o l 1 Dim y300 yl yo CellsRow col lValue yl For i 1 To n t i l dt Cellsi Row colValue t dt yy y1 dt gfctt yl or k 1 To 6 yy yi dt gfctt yy gfctt dt yi 2 Next k yi 1 yy Cellsi Row col 1Value yi 1 Next I End Sub 931 Table Method via eulert The tables that are the output of the macro eulertO can have a large number of entries In the computations below the output was graphed and this gives a very nice overview of all the numbers in the output table However very precise values in the output table cannot be determined from the graph Here we consider the second model y kM m and W W In the calculations below we assumed the initial population was 1 unit after 1 unit of time the population was 15 and the maximum population is 10 So yo 1 M 10 and k is computed as follows from the Euler method where i 0 15 101 k110 1 k 118 Inhibited Growth Population 2 E 3 n c n 932 Graph Method via 0de45 The first graph below is for the fish population with no harvesting y39 118y10 y and y0 1 It was generated via the ode45 where the time interval was from zero to 10 and it is consistent with the output of the above macro euler It suggests that the population will level off at M 10 the maximum population and the second graph confirms this is true 1O y39 118y10 y and y0 1 for t in 1 10 y39 118y10 y and y0 1 for t in 1 20 The next two graphs are for the fish population with harvesting rate H 2 y39 118y10 y 2 Here the steady state solutions also called the equilibrium populations are defined by setting the right side equal to zero and solving for y 118y10 y 2 0 yZlOy360 So y 10 2 x8542 374 and 9626 If the initial population is large enough the fish population Will increase to the larger steady state solution This is illustrated in the next graph Where the initial population is one However if the initial fish population is too small the fish population Will go to zero This is illustrated in the second graph Where the initial population is 1 units Here the fish population drops to zero in about t 5 units of time 5 1O 15 20 y39 118y10 y 2 and y0 1 05 1 15 2 25 3 y39 118y10 y 2 and y0 1 933 Algebra Method via dsolve The following commands use dsolve and ezplot to find the algebraic solution and graph to the fish population with harvesting rate H 2 y39 118y10 y 2 and y0 l EDU dsolve Dy 118y10 y 210 39y0l3939t39 alit155tanh09630l07quot t9log 535 l220 535 l220535 l2535 l25l07535 l2535 l2 EDU ezplotans0 20 5quot12107quot12smh190 12og18785quot12107quot 1O 931 Algebra Method with Maple As before we can use Maple to solve the problems involved with this worksheet We have already seen how to use Maple s version of dsolve when we looked at the cooling problem Here we review it again Suppose we seed a lake with 100 fish so y0 100 The lake can sustain at most 150000 fish so M 150000 and that the growth rate of this species of fish in this environment is r b 7 d 02301 We do the following Creating an exponential model of the data is easy enough we need to solve the differential equation y 02301 y gt dsolvediffytt02301 yty010039 Now de ne a population function P that re ects the solution gt PeXptgt100eXp02301t Once we have this function it is a snap to nd the population at times t5 t10 or t30 gt PeXp5 PeXplO PeXp30 3 1 5 977240 1 9984161626 9952560095 Notice that the sh population has very quickly exceeded the maximum population the lake can actually sustain So the eXponential model is certainly bad in the shortterm Now we consider the logistic model Observe that in the logistic model we are given an equilibrium population if the population reaches the maXimum sustainable M it will grow no further Using dsolve we can nd and de ne an equation for the sh population that takes this fact into account For k we use the relationship k r M So we need to solve the differential equation y 02301 100000 100000 7 y y With Maple we accomplish this via gt dsolvediffytt02301100000100000ytyty0100 We can create a function to represent the result gt Plogtgttgt1000001999eXp02301t If we plot this result over 60 days we see how the sh population levels off just under 100000 gt plotPlogtt060 On the other hand let s consider what happens if we allow harvesting A parallel to harvesting in the case of our shpopulated lake would be if we allow shing in our lake This gives us a harvesting constant say H15 and we want to know with how many fish we need to see the lake in order to prevent the population s dying out The differential equation is now that of the harvesting model y 02301 100000100000 7 y y 715 Our first question becomes what are the equilibrium populations Because there is harvesting we expect that there must be a minimum population that must be maintained if the population falls below that critical number it will be overfished into oblivion On the other hand there should still be a maximum sustainable population To solve this we use this fact at the equilibrium population the population y will not change hence y 0 since y represents the instantaneous change in population If we substitute this into the differential equation we get a quadratic equation that is not too hard to solve by hand 0 02301 100000 100000 7 y y 715 But why solve by hand when we can use Maple gt solve002301100000100000yy15 9993476840 6523159986 So the initial population of fish must be at least 65 if we want to maintain fish in the lake and because of harvesting the population will never exceed 99934 notice that with harvesting the maximum sustainable population is less than it would be without harvesting We can see these different behaviors more explicitly using Maple s DEplot command DEplot will graph a differential equation for us The format is similar but not identical to the format of the dsolve command We will use DEplot to observe the behavior of the fish population when we start with 70 fish which is enough to sustain the fish population and when we start with 60 fish which is not enough to sustain the fish population The DEplot function is part of an external module to Maple so we have to load in that module before we invoke the DEplot command The module we want is called DEtools1 To load it in type gt withDEtools The format of the DEplot command is DEplot di erential equation dependent variable rangefor indep vars initial condition 39 so we type gt DEplotdiffytt02301100000100000ytyt 7 15 ytt060y070 and we obtain the following graph Notice that it takes the sh population longer to approach its maximum If we want to see what happens with an initial population of 60 which again is too small we should plot over a smaller interval of t values gtDEplotdiffytt02301100000100000 7 ytytytt020y060 and we obtain this graph instead Notice that in this case we eXpect the population will die off after about 11 days 94 Implementation Instructions for Numerical Solution of y39 118y10 y y0 1 via the Macro eulert 1 Notice that we type a colon instead of the usual semicolon 39 at the end of the subsequent with command One can type the usual semicolon but Maple will give you a lot of useless information Typing the colon suppresses output Step 1 Examine the macro eulert and enter the macro via the tools macro menu via the Visual Basic editor Step 2 Let tmax 20 n 40 yo 1 and rowcol 11 Step 3 Enter the function gty by using the Visual Basic editor Step 4 Return to a new sheet where you want the output Step 5 Execute the macro eulert by via the tools and macro menu and double click on eu1ert Step 6 Chart the output data and experiment with n Observe quotconvergencequot 95 Assessment The quotconstantsquot k M and H in our two models may be difficult to determined and could even vary with time for example M or H might depend on the time of year Another problem is that interaction with other populations can play a very significant role There may be more than one fish population and one may prey on the others so that the death rates vary with predators population size The differential equation y39 cyM y can be solved exactly but it does require a little more effort Generally numerical methods can be applied to a larger class of differential equations than algebraic methods In the next lesson we will see how we can use the MATLAB command ode45 to solve predator prey systems of differential equations 96 Possible Homework 1 Verify the calculations in this lesson 2 Consider the following model with different initial conditions y39 120 y20 y 1 and y0 1 4 15 and 20 a Find the steady state solutions b Use eulert to numerically solve these problems c Use the chart wizard to graph the solutions 3 Consider problem two with 120 replace by 02 05 and 08 Compare the solutions
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'