Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here is the budword_part1.m file Here is budword_part2.m file Here is the euler file 1 Background The background information is from the book Mathematical Biology
Here is the budword_part1.m file
Here is budword_part2.m file
Here is the euler file
1 Background The background information is from the book Mathematical Biology by J.D. Murray 2. The spruce budworm is a species of pests which can defoliate the balsam fir. That is, they feed on the needles of the balsam fir and if there are enough of them, they can eat all of the needles. The population dynamies was proposed to be modeled [1] by: Here, r is the linear growth rate of the species (that is, the growth rate when there are no predators and abundant resources). The parameter K is the carrying capacity. This is related to the density of needles on the trees Finally, the term p(N) represents predation. Birds are the major predator. When the number of budworms is below a certain threshold, the birds don't really eat the budworms and look for food elsewhere. When the number of budworms is above that threshold, p(N) p. Thus, p(N)isessentially a "switch". When N is smaller than some threshold, p(N) and when N is bigger than this threshold, p(N)p. A good form for p(n)is BN2 + N2. The parameter A is the "threshold" and B is the value p. Thus, for values of N less than A, p(N)0 and for values of N bigger than A, p(N)B. (It miht be good to graph this for some particular values of A and B. This function is an example of something called a sigmoid function If you want, read more about them here: https://en.wikipedia.org/ wiki/Sigmoid function.) So, the ODE becomes: dN dt BN2 Thus, there are four parameters. The parameters A and K have the same dimensions as N (that is, number of budwors The parameter r has dimensions of (time) and B has the dimensions of (dimensions of N)(time)-'. Thus, overal, the dimensions of BN(I- are-i-tertibisteun-which is what we want. tisne 2 Kill All The Birds We are first going to assume that the trees on which te budworms feed are located in an area where there are no bids. Thus, A or B 0-whichever way you want to view it, the point is that p(N)0 and so we have the new equation: dN dt This is an autonomous equation R that this particular one is called the logistic eguation. This can be solved using methods similar to the ones we have used so far. The first part of the project is to analyze this equation. You must do the following (1) What are the equilibrium solutions? Are they stable or unstable? (2) Let's say you are in charge of the trees on which the budworms feed. What are some steps you cantake to lmit the number of budworms? How would these changes affect the differential equation (e.g., what happens if you change some of the parameters). (3) Let T-25 and K 4. Use dsolve to find and plot several solutions to this ODE with various initial population values. In this problem, there are two equbrium solutions; I'l call them o and ind two solutions with starting values in the (o,) nterval and two solutions with starting values in the (n, oo) range (4) Now, using the euler method, find numerical solutions to the ODE. You are going to do this with step sizes 5, .25, 1. For each step size, plot them solutions on the same graph as the solutions from (3). So, you will end up with three graphs: each graph will contain solutions plotted from part (3) and numerical solutions with a given step size If you are using, Matlab, use the seript template "budworm.part1.m". (Of course, you will also have to fill out the euler 308.m function that I provided). 3 Bring The Birds Back Now, we are going to go back to the original equation: dN BN2 For various reasons, it is good to make this equation "dimensionless". So we introduce Ar Bt Thus, we can re write the equation as: dT In addition to making the equation dimensionless, we have educed the number of parameters. We will study this equation. We are going to set r25 and q 16. This gives the ODE: You will analyze this ODE and answer the following question: (1) Find the equlibrium solutions (round them to 4 decimal places). You can use either the formulas for roots of quartic or cubic equation, or you can use the solve function in Matlab (or something else) (2) You can't use dsolve to solve this ODE it can't find an explicit solution. So you will use your Euler Method function to approximate solutions. Let's say that the equilibriurn solutions are 4,111,112,113. Use Euler's method to plot numerical solutions. As in the previous part, you wll want to plot two solutions with initial values in the interval (uo,), two solutions in (ui,u2) andso on. As above, you will also do this with t step values of of .25, .1,.01 (3) Use your graph above to determine which equilibrium soions are stable r unstable. If you are using Matlab, use the script template "budworm.part2.m". (Of course, will also have to fill out the euler-308.m function that I provided). 4 Deliverables You will answer the questions asked above. You must turn in the following files: (1) Your euler 308.m file (2) Your budworm.part1.m file (3) Your budworm.part2.m file (4) A pdf with your answers from Part 1 and 2 and with the graphs on the PDFs. clear; figure; hold on; set numerical parameters t step- % Put a value here; t min : % Put a value here; t max- % Put a value here; tvalst min:t step:t max; init val-min- % Put a value here; init val step- % Put a value here; init val max : % Put a value here; init val_list- init val min:init val_step:init val_max; The ODE is dn/dt : r (1-n/kb) n : f(t,n). % functiom below r .25; Define the f -6(t,n) % Fill in this part using the ODE % Look at the code in class for the proper syntax. for init val init val list The "euler 308" function below is one that you will have to write. But I have also given % you a template for this T, Neuler_308 (f, t_vals, init val); plot (T, N); end Now, use dsolve to get an analytic solution and plot them to compare syms n(t); ode - diff (n, t)f (t,n); for init val init val list 883858338838838833 %%%88 Here, put code to use dsolve to find 88%%% %%% an analytic solution to the problem . %%%%% 883858338838838833 fplot (sol, (0 t max]) end clear; figure; hold on; set numerical parameters t step- % Put a value here; t min : % Put a value here; t max- % Put a value here; tvals t min:t step:t_max; init val min : % Put a value here; init val step % Put a value here; init val max : % Put a value here; init val_list- init val min:init val_step:init val_max; The ODE is du / dt : ru ( 1-u/4) % functiom below r.25; q16 f-@(t,) % Fill in this part -u^2 / (1+u"2 ) f ( t, u). Define the : using the ODE. % Look at the code in class for the proper syntax for init val init val list % The "euler 308" function below is one that you will have to write. But I have also given you a template for this. T, N euler_308 (f, t vals, init val) plot (T, N) end function [T,X) = euler 308f, t vals, init val) % uses Euler's method to find a numerical solution to the ODE % T is the input vector; X is the output vector. f is the right hand side of the oot. That is, % dx / dt f(t,x) - x- ones ( size (T) ) ; x(1) Put the first element in the X vector here; 88888888888888888888888888888888888888888888 88%%% Here, put the code the calculates %%%%% : the next value in the X vector. " %88%% See the code from class; it will % %%% 888888888888888888 888888%88888888888888888888 for n- 2:length (X) 88888888888888888888888888888888888888888888 %%%88 Here, put the code the calculates %%%%% %%%%% the next value in the X vector. %%%%% 8883883838888 end end 1 Background The background information is from the book Mathematical Biology by J.D. Murray 2. The spruce budworm is a species of pests which can defoliate the balsam fir. That is, they feed on the needles of the balsam fir and if there are enough of them, they can eat all of the needles. The population dynamies was proposed to be modeled [1] by: Here, r is the linear growth rate of the species (that is, the growth rate when there are no predators and abundant resources). The parameter K is the carrying capacity. This is related to the density of needles on the trees Finally, the term p(N) represents predation. Birds are the major predator. When the number of budworms is below a certain threshold, the birds don't really eat the budworms and look for food elsewhere. When the number of budworms is above that threshold, p(N) p. Thus, p(N)isessentially a "switch". When N is smaller than some threshold, p(N) and when N is bigger than this threshold, p(N)p. A good form for p(n)is BN2 + N2. The parameter A is the "threshold" and B is the value p. Thus, for values of N less than A, p(N)0 and for values of N bigger than A, p(N)B. (It miht be good to graph this for some particular values of A and B. This function is an example of something called a sigmoid function If you want, read more about them here: https://en.wikipedia.org/ wiki/Sigmoid function.) So, the ODE becomes: dN dt BN2 Thus, there are four parameters. The parameters A and K have the same dimensions as N (that is, number of budwors The parameter r has dimensions of (time) and B has the dimensions of (dimensions of N)(time)-'. Thus, overal, the dimensions of BN(I- are-i-tertibisteun-which is what we want. tisne 2 Kill All The Birds We are first going to assume that the trees on which te budworms feed are located in an area where there are no bids. Thus, A or B 0-whichever way you want to view it, the point is that p(N)0 and so we have the new equation: dN dt This is an autonomous equation R that this particular one is called the logistic eguation. This can be solved using methods similar to the ones we have used so far. The first part of the project is to analyze this equation. You must do the following (1) What are the equilibrium solutions? Are they stable or unstable? (2) Let's say you are in charge of the trees on which the budworms feed. What are some steps you cantake to lmit the number of budworms? How would these changes affect the differential equation (e.g., what happens if you change some of the parameters). (3) Let T-25 and K 4. Use dsolve to find and plot several solutions to this ODE with various initial population values. In this problem, there are two equbrium solutions; I'l call them o and ind two solutions with starting values in the (o,) nterval and two solutions with starting values in the (n, oo) range (4) Now, using the euler method, find numerical solutions to the ODE. You are going to do this with step sizes 5, .25, 1. For each step size, plot them solutions on the same graph as the solutions from (3). So, you will end up with three graphs: each graph will contain solutions plotted from part (3) and numerical solutions with a given step size If you are using, Matlab, use the seript template "budworm.part1.m". (Of course, you will also have to fill out the euler 308.m function that I provided). 3 Bring The Birds Back Now, we are going to go back to the original equation: dN BN2 For various reasons, it is good to make this equation "dimensionless". So we introduce Ar Bt Thus, we can re write the equation as: dT In addition to making the equation dimensionless, we have educed the number of parameters. We will study this equation. We are going to set r25 and q 16. This gives the ODE: You will analyze this ODE and answer the following question: (1) Find the equlibrium solutions (round them to 4 decimal places). You can use either the formulas for roots of quartic or cubic equation, or you can use the solve function in Matlab (or something else) (2) You can't use dsolve to solve this ODE it can't find an explicit solution. So you will use your Euler Method function to approximate solutions. Let's say that the equilibriurn solutions are 4,111,112,113. Use Euler's method to plot numerical solutions. As in the previous part, you wll want to plot two solutions with initial values in the interval (uo,), two solutions in (ui,u2) andso on. As above, you will also do this with t step values of of .25, .1,.01 (3) Use your graph above to determine which equilibrium soions are stable r unstable. If you are using Matlab, use the script template "budworm.part2.m". (Of course, will also have to fill out the euler-308.m function that I provided). 4 Deliverables You will answer the questions asked above. You must turn in the following files: (1) Your euler 308.m file (2) Your budworm.part1.m file (3) Your budworm.part2.m file (4) A pdf with your answers from Part 1 and 2 and with the graphs on the PDFs. clear; figure; hold on; set numerical parameters t step- % Put a value here; t min : % Put a value here; t max- % Put a value here; tvalst min:t step:t max; init val-min- % Put a value here; init val step- % Put a value here; init val max : % Put a value here; init val_list- init val min:init val_step:init val_max; The ODE is dn/dt : r (1-n/kb) n : f(t,n). % functiom below r .25; Define the f -6(t,n) % Fill in this part using the ODE % Look at the code in class for the proper syntax. for init val init val list The "euler 308" function below is one that you will have to write. But I have also given % you a template for this T, Neuler_308 (f, t_vals, init val); plot (T, N); end Now, use dsolve to get an analytic solution and plot them to compare syms n(t); ode - diff (n, t)f (t,n); for init val init val list 883858338838838833 %%%88 Here, put code to use dsolve to find 88%%% %%% an analytic solution to the problem . %%%%% 883858338838838833 fplot (sol, (0 t max]) end clear; figure; hold on; set numerical parameters t step- % Put a value here; t min : % Put a value here; t max- % Put a value here; tvals t min:t step:t_max; init val min : % Put a value here; init val step % Put a value here; init val max : % Put a value here; init val_list- init val min:init val_step:init val_max; The ODE is du / dt : ru ( 1-u/4) % functiom below r.25; q16 f-@(t,) % Fill in this part -u^2 / (1+u"2 ) f ( t, u). Define the : using the ODE. % Look at the code in class for the proper syntax for init val init val list % The "euler 308" function below is one that you will have to write. But I have also given you a template for this. T, N euler_308 (f, t vals, init val) plot (T, N) end function [T,X) = euler 308f, t vals, init val) % uses Euler's method to find a numerical solution to the ODE % T is the input vector; X is the output vector. f is the right hand side of the oot. That is, % dx / dt f(t,x) - x- ones ( size (T) ) ; x(1) Put the first element in the X vector here; 88888888888888888888888888888888888888888888 88%%% Here, put the code the calculates %%%%% : the next value in the X vector. " %88%% See the code from class; it will % %%% 888888888888888888 888888%88888888888888888888 for n- 2:length (X) 88888888888888888888888888888888888888888888 %%%88 Here, put the code the calculates %%%%% %%%%% the next value in the X vector. %%%%% 8883883838888 end endStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started