Lesson 9: Predator-Prey and ode45

Similar documents
Lesson 14: Van der Pol Circuit and ode23s

Lab 5: Nonlinear Systems

Lesson 4: Population, Taylor and Runge-Kutta Methods

Graded Project #1. Part 1. Explicit Runge Kutta methods. Goals Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo

Lesson 13: Rapid Cooling and Euler-trapezoid

Problem set 7 Math 207A, Fall 2011 Solutions

Getting Started With The Predator - Prey Model: Nullclines

2D-Volterra-Lotka Modeling For 2 Species

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

APPM 2360 Lab #3: The Predator Prey Model

Differential Equations FMNN10 Graded Project #1 c G Söderlind 2017

Project 6.3 Predator-Prey and Your Own Game Preserve

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

Lesson 11: Mass-Spring, Resonance and ode45

Math 2930 Worksheet Introduction to Differential Equations. What is a Differential Equation and what are Solutions?

Lesson 9: Diffusion of Heat (discrete rod) and ode45

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

Lesson 13: Rapid Cooling and Euler-trapezoid

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

Phenomenon: Canadian lynx and snowshoe hares

Lotka-Volterra Models Nizar Ezroura M53

Gerardo Zavala. Math 388. Predator-Prey Models

Lecture 20/Lab 21: Systems of Nonlinear ODEs

Bees and Flowers. Unit 1: Qualitative and Graphical Approaches

MATH 250 Homework 4: Due May 4, 2017

Lesson 15: Oregonator, Chemical Reactions and ode15s

Physics: spring-mass system, planet motion, pendulum. Biology: ecology problem, neural conduction, epidemics

Introduction to Dynamical Systems

Nonlinear Dynamics. Moreno Marzolla Dip. di Informatica Scienza e Ingegneria (DISI) Università di Bologna.

Motivation and Goals. Modelling with ODEs. Continuous Processes. Ordinary Differential Equations. dy = dt

EG4321/EG7040. Nonlinear Control. Dr. Matt Turner

Interactions. Yuan Gao. Spring Applied Mathematics University of Washington

1. Population dynamics of rabbits and foxes

Ordinary Differential Equations (ODE)

Math 2930 Worksheet Introduction to Differential Equations

Systems of Ordinary Differential Equations

STABILITY OF EIGENVALUES FOR PREDATOR- PREY RELATIONSHIPS

EECS 700: Exam # 1 Tuesday, October 21, 2014

CPS 5310: Parameter Estimation. Natasha Sharma, Ph.D.

Math 232, Final Test, 20 March 2007

Ordinary Differential Equations

Math Assignment 2

CDS 101: Lecture 2.1 System Modeling

Section 5. Graphing Systems

Computers, Lies and the Fishing Season

MECH : a Primer for Matlab s ode suite of functions

Lotka Volterra Predator-Prey Model with a Predating Scavenger

Dynamical Systems and Chaos Part II: Biology Applications. Lecture 6: Population dynamics. Ilya Potapov Mathematics Department, TUT Room TD325

Math 128A Spring 2003 Week 12 Solutions

Ordinary Differential Equations: Initial Value problems (IVP)

2007 Summer College on Plasma Physics

1.2. Introduction to Modeling. P (t) = r P (t) (b) When r > 0 this is the exponential growth equation.

Lokta-Volterra predator-prey equation dx = ax bxy dt dy = cx + dxy dt

1 The pendulum equation

Name: MA 226 Exam 2 Show Your Work and JUSTIFY Your Responses. Problem Possible Actual Score TOTAL 100

The functions in all models depend on two variables: time t and spatial variable x, (x, y) or (x, y, z).

Chemical Oscillations

HOMEWORK 3: Phase portraits for Mathmatical Models, Analysis and Simulation, Fall 2010 Report due Mon Oct 4, Maximum score 7.0 pts.

(Refer Slide Time: 00:32)

Predator-Prey Population Models

FIRST-ORDER SYSTEMS OF ORDINARY DIFFERENTIAL EQUATIONS III: Autonomous Planar Systems David Levermore Department of Mathematics University of Maryland

y 1 = 0 y 2 = 0, and y 1 = p 3 /p 4 y 2 = p 1 /p 2

STABILITY. Phase portraits and local stability

Predator-Prey Population Dynamics

A NUMERICAL STUDY ON PREDATOR PREY MODEL

Coordinate Curves for Trajectories

Lecture 1. Scott Pauls 1 3/28/07. Dartmouth College. Math 23, Spring Scott Pauls. Administrivia. Today s material.

Solution. Your sketch should show both x and y axes marked from 5 to 5 and circles of radius 1, 3, and 5 centered at the origin.

Logistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations

Laboratory 1. Solving differential equations with nonzero initial conditions

Continuous time population models

Final Exam Sample Problems, Math 246, Spring 2018

Solutions of the Sample Problems for the First In-Class Exam Math 246, Fall 2017, Professor David Levermore

MA 138 Calculus 2 with Life Science Applications Handout

Solving Differential Equations with Simulink

First In-Class Exam Solutions Math 246, Professor David Levermore Thursday, 20 September 2018

MAS212 Scientific Computing and Simulation

Dynamics Analysis of Anti-predator Model on Intermediate Predator With Ratio Dependent Functional Responses

Lab Project 4a MATLAB Model of Oscillatory Flow

Predator - Prey Model Trajectories and the nonlinear conservation law

Symbolic Solution of higher order equations

Do not write in this space. Problem Possible Score Number Points Total 100

EXERCISES FOR SECTION 1.1

Linear Systems of ODE: Nullclines, Eigenvector lines and trajectories

Numerical Methods for Ordinary Differential Equations

Coupled differential equations

Appendix 3B MATLAB Functions for Modeling and Time-domain analysis

Elementary Differential Equations

Chapter 7. Nonlinear Systems. 7.1 Introduction

154 Chapter 9 Hints, Answers, and Solutions The particular trajectories are highlighted in the phase portraits below.

Chap. 20: Initial-Value Problems

Falling Mass and Improved Euler

CDS 101: Lecture 2.1 System Modeling. Lecture 1.1: Introduction Review from to last Feedback week and Control

1 (t + 4)(t 1) dt. Solution: The denominator of the integrand is already factored with the factors being distinct, so 1 (t + 4)(t 1) = A

AM205: Assignment 3 (due 5 PM, October 20)

2015 Holl ISU MSM Ames, Iowa. A Few Good ODEs: An Introduction to Modeling and Computation

Modeling with differential equations

Math 23: Differential Equations (Winter 2017) Midterm Exam Solutions

Direction fields of differential equations...with SAGE

6x 2 8x + 5 ) = 12x 8

Transcription:

Lesson 9: Predator-Prey and ode45 9.1 Applied Problem. In this lesson we will allow for more than one population where they depend on each other. One population could be the predator such as a fox, and the second population could be the prey such as a rabbit. The populations will be modeled by two or more differential equations. The Matlab command ode45 can be used to solve such systems of differential equations. 9.2 Differential Equation Model. We will consider the first of the continuous predator-prey models: one predator, and one prey with constant birth and death rate, one predator, and one prey with variable birth and death rates and one predator, and two preys. We consider the predator to be a fox and a prey to be either rabbits or turkeys. One could also consider different species of fish such as sharks and bass. One Predator, and One Prey with Constant Birth and Death Rate. Suppose a fox population only eats rabbits and has population of x(t) at time t. With no rabbits the fox population will die out according to the differential equation x' = -dx where d is the birth rate minus the death rate. The rabbit population y(t) will, without any foxes, continue to grow for some time according to the differential equation y' = by where b is the birth rate minus the death rate.

2 We want to model the case where both populations are positive. In the above differential equation for the foxes we need an additional term on the right side that will be positive when there are rabbits. More precisely, this additional term should be large if either x(t) or y(t) are large. There are many ways to do this, but a good option is modify the birth rate minus the death rate for the fox populations to be -d + ey. The e is a positive constant because the rabbits are a source of food for the foxes. Thus, the differential equation for the foxes is x' = (-d + ey)x and x(0) = x 0. Fox Equation A similar term must be inserted into the birth rate minus the death rate for the rabbits. But, in this case the rabbit population should decrease, and so, we will insert -cx. y' = (b - cx)y and y(0) = y 0. Rabbit Equation These two differential equations are coupled, and they are known as the Lotka-Volterra system of differential equations. Solutions to such systems are usually difficult to find, and so, numerical methods are used. We will discuss this below. Fortunately, one can gain some qualitative knowledge about the solutions. There should be oscillations in the population. If the rabbit population is very large, then there will be plenty of food for the fox population and it should increase. As the fox population increases, more of the rabbits are consumed. So, the food supply for the fox population decreases, and the fox population will have to decrease. One expects there is a perfect balance of the populations where neither population changes. This means both x' and y' must be zero. This is called the steady state or equilibrium solution. There is one positive steady state solution x = b/c from the rabbit equation, and y = d/e from the fox equation.

3 In fact, the graph of the points (x(t), y(t)) must be a closed curve. In order to see this, consider the composed function H(x(t), y(t)), where H(x, y) = b ln(x) - c x + d ln(y) - ey and x(t) and y(t) satisfy the Lotka-Volterra equation. The time derivative of this composed function is computed by the chain rule as follows H' = H x x' + H y y' = (b/x -c) (-d + e y) x + (d/y - e) (b - c x) y = 0. Thus, H(x(t), y(t)) must be a constant. With some additional effort one can show that H(x, y) = constant defines a simple closed curve. Any numerical method should generate such a simple closed curve. 9.3 Method of Solution. In this lesson we will use the Matlab command ode45 to solve our systems of differential equation. This command is a robust implementation for systems of differential equations, which uses a variable step size method and the fourth and fifth order Runge-Kutta method. 9.4 Matlab Implementation. In the following calculations we have attempted to solve the second predator-prey model x' = -.5x +.01xy and y' =.5y -.01xy. The steady state solutions are given by x' = -.5x +.01xy = 0 and y' =.5y -.01xy = 0.

4 The nonzero steady state solutions are x = 50 and y = 50. Our numerical solution should orbit about the steady state solution. The first graph below does not quite do this. This is because some of the error options for ode45 need to be made smaller. The default value for relative error is.001, and this is what was used in the first graph below. The Matlab command odeset('reltol', 1e-5) was used to "tune" the ode45 method. Adjust the rf.m file by replacing line 6, the line with ode45, by the two following lines: options = odeset('reltol', 1e-5); [t y] = ode45('yprf',[to tf],yo,options); Here more time steps will be required; use the whos command to find the number of time steps n = 133 with RelTol = 1e-3, and n = 289 with RelTol = 1e-5. m-file yprf.m: function yprf =yprf(t,y) yprf(1) =-.5*y(1) +.01*y(1)*y(2); yprf(2) =.5*y(2) -.01*y(1)*y(2); yprf = [yprf(1) yprf(2)]'; m-file rf.m: %your name, your student number, lesson number clear; to = 0; tf =50; yo = [80 100]; [t y] = ode45('yprf',[to tf],yo); plot(y(:,1),y(:,2)) title('your name, your student number, lesson number') ylabel('rabbits') xlabel('fox') %plot(t,y(:,1),t,y(:,2)) %xlabel('time') %ylabel('rabbits and fox')

5 120 your name, your student number, lesson number 100 80 rabbits 60 40 20 0 0 20 40 60 80 100 120 fox 120 your name, your student number, lesson number 100 80 rabbits 60 40 20 0 0 20 40 60 80 100 120 fox

6 In the yprf.m file the x(t), fox, is associated with the symbol y(1), and y(t), rabbits, is associated with the symbol y(2). The right sides of the differential equations are given by yprf(1) and yprf(2). In rf.m the yo = [80 100] is a 1x2 array of initial populations where x(0) = 80 and y(0) = 100. The output [t y] from the rf.m file has three column vectors where the first column is for all the time values and the second and third columns are for the corresponding values of x(t) and y(t). These values can be viewed by typing [t y] at the Matlab prompt. Also the following graph of x(t) versus t and y(t) versus t was generated by typing plot(t, y(:,1),t,y(:,2)) at the Matlab prompt. 120 100 fox and rabbit populations 80 60 40 20 0 0 5 10 15 20 25 30 35 40 45 50 time

7 9.5 Numerical Experiments. In the following calculations we have attempted to solve the fox and rabbit problem with harvesting of the fox population. The fox equation must be modified as follows to include a harvesting rate h(t) fox per unit time. x' = -.5x +.01xy - h(t) y' =.5y -.01xy. In the calculation indicated in the following graph h(t) = 1, and the graph spirals outward. 250 your name, your student number, lesson number 200 150 rabbits 100 50 0 0 50 100 150 200 250. fox

8 9.6 Additional Calculations. Consider the following fox and rabbit model with no harvesting x' = -.5x +.01xy, y' =.4y -.01xy and with variable initial conditions [x(0) y(0) ] = [(100 +10*(1+.S)) 90 ], [(100 +10*(1+.S)) 1 ] and [(100 +10*(1+.S)) 40]. (a). (b). (c). Find a steady state solution where both populations are positive. Modify the yprf.m file. Insert you name and student number into the rf.m file. Execute rf.m for each set of initial conditions. (d). Print the yprf.m and rf.m files and the graphs.