CS代写 Modelling Complex Software Systems

Modelling Complex Software Systems
Lecture Cx.03
ODE Models I: Predator-Prey
Artem Polyvyanyy,

Copyright By PowCoder代写 加微信 powcoder

Semester 1, 2022

􏰁 complex systems
􏰁 building a mathematical model 􏰁 assumptions
􏰁 update rules
􏰁 population growth models 􏰁 exponential
􏰁 logistic
􏰁 behaviour of dynamic systems 􏰁 fixed points
􏰁 limit cycles 􏰁 chaos

Objectives
􏰁 interpret mathematical equations describing a model
􏰁 understand how these equations can be solved numerically
and/or analytically to give the model’s dynamic behaviour
􏰁 describe the dynamic behaviour of the model, and how this depends on:
􏰁 model parameters 􏰁 initial condition

The Lotka-Volterra model
An aside: solving ODEs
Behaviour of the Lotka-Volterra model Extensions to the Lotka-Volterra model Summary

Motivation
Lynxes and hares
Figure90 years of hare and lynx populations in the Hudson Bay, Canada

Predator-prey relationships
FigureRed fox
The Lotka-Volterra model
FigureRabbit
Independently formulated in 1925–26 by , a US mathematician and chemist, and , an Italian mathematician and physicist. Both were inspired by the logistic equation of Verhulst.

Assumptions
Predators: red foxes — Prey: rabbits
􏰁 the rabbit population is sustainable (they have ample food)
􏰁 the rabbit population grows at a rate proportional to its size if
there are no red foxes
􏰁 the red foxes eat only rabbits
􏰁 the red fox population declines at a rate proportional to its size
if there are no rabbits to eat
􏰁 the environment is static and has no effect on the rates of
population growth and decay

Model formulation Prey (rabbits):
Predators (red foxes):
dR =αR−βRF dt
dF =δRF−γF dt
Parameters:
Parameter Meaning
α growth rate of the rabbit population
β rate at which foxes predate upon (eat) rabbits
δ growth rate of the fox population
γ decay rate of the fox population due to death and migration

The Lotka-Volterra model
An aside: solving ODEs
Behaviour of the Lotka-Volterra model Extensions to the Lotka-Volterra model Summary

An aside: solving ODEs using Euler method
Given a set of differential equations and an initial condition, how can we calculate the future states of the system?
In the system
y ′ (t ) = f (t , y (t ))
where f defines the relationshp between variables y and their deriva- tives, the Euler forward difference approach computes the sequence of approximations:
yn+1 =yn +∆t.f(tn,yn) tn+1 = tn + ∆t
as a time-stepped simulation of the underlying behaviour

An aside: using the mid-point to improve accuracy
Rather that basing our estimate of the next point on the slope at the start of the interval, we can improve accuracy by using the slope at the mid-point:
yn+1 = yn + ∆t.f 􏰄tn + ∆t , yn + ∆t f (tn, yn)􏰅 22
tn+1 = tn + ∆t
This approach will diverge from the ‘true’ situation more slowly, but requires more calculations per iteration

An aside: solving ODEs using the Runge-Kutta method
The Euler method is often not accurate enough. Accuracy can be increased by making use of more points in the period between tn and tn+1
The Runge-Kutta family of approaches take this approach, with the most commonly used being RK4, which computes:
yn+1 =yn +(∆t).(k1 +2k2 +2k3 +k4) 6
where the kn values are intermediate estimates of slope: k1 =f(tn,yn)
k2 = f (tn + ∆t , yn + ∆t k1) 22
k3 = f (tn + ∆t , yn + ∆t k2) 22
k4 =f(tn +∆t,yn +∆t.k3)

An aside: solving ODEs using Matlab Matlab function for the Lotka-Volterra model:
function dx = lotka_volterra_function(t, x)
dx = [0; 0];
dx(1) = alpha * x(1) – beta * x(1) * x(2);
dx(2) = delta * x(1) * x(2) – gamma * x(2);
Matlab test script:
rabbits = 5;
foxes = 2;
[t, x] = [0 200],
[rabbits foxes], options);

The Lotka-Volterra model An aside: solving ODEs
Behaviour of the Lotka-Volterra model
Extensions to the Lotka-Volterra model Summary

Numerical solution of the Lotka-Volterra model
FigureRed fox (predator) and rabbit (prey) population levels over time

Numerical solution of the Lotka-Volterra model
FigureThe phase plane

Analysing the Lotka-Volterra model
What is the long term behaviour of the system?
equilibria: points at which the system variables (the population levelsR andF)donotchange;ie,where dR =0and dF =0
Two equilibria:
􏰁 R = 0, F = 0 􏰁 R = γδ , F = αβ
R(α − βF) = 0 F(δR − γ) = 0
Interpretation:
􏰁 equilibrium 1: both populations are extinct
􏰁 equilibrium 2: both populations sustained at non-zero levels
indefinitely

Analysing the Lotka-Volterra model
How does system behaviour depend on its initial condition?
Stability analysis reveals that:
􏰁 the first equilibrium (both populations going extinct) is
unstable; it can only arise if the prey level is set to zero, at which point the predators also die out
􏰁 the second equilibrium is stable; specifically, it is neutrally stable, and surrounded by infinitely many periodic orbits
How realistic is this?

Another limitation
FigureAnother Lotka-Volterra phase plane
What is wrong with this picture?

The Lotka-Volterra model An aside: solving ODEs
Behaviour of the Lotka-Volterra model
Extensions to the Lotka-Volterra model

Lotka-Volterra model with competition
􏰁 There is no notion of carrying capacity for the prey species
􏰁 The logistic equation captured intraspecific competition
􏰁 The base Lotka-Volterra model captues interspecific
competition
􏰁 We can combine these ideas by adding an additional term to
the Lotka-Volterra model to account for competition among members of the same species:
dR = αR − βRF − aR2 dt
dF =δRF−γF−bF2 dt

Lotka-Volterra model with competition
FigureTime series FigurePhase plane
Other model refinements have been proposed that increase the ability to capture observed phenomena

Lotka-Volterra model with multiple species
The two-species competitive model can also be written as:
dx1 =rx􏰄1−􏰄x1−α12×2􏰅􏰅 dt11 K1
dx2 =rx􏰄1−􏰄x2−α21×1􏰅􏰅 dt22 K2
where αij is the effect that species j has on species i. This can then be generalised to an n-species model:
dxi 􏰄 􏰆Nj=1 αijxj 􏰅 dt =rixi 1− Ki
where xi represents the i-th species and αij is a matrix of interaction terms.

Lotka-Volterra model with multiple species
Another representation of the multi-species model is:
This version pulls the carrying capacities Ki and interaction terms
dt=xi ri+ αij inside the interaction matrix A
For three species, growth rates r1 = 1.1; r2 = −0.5; r3 = α + 0.2, and the interaction matrix:
 0.5 A = −0.5
can produce chaotic behaviour for values of α ≥ 1.5.
0.5 0.1 −0.1 0.1

Lynxes and hares
Figure90 years of hare and lynx populations in the Hudson Bay, Canada

The Lotka-Volterra model An aside: solving ODEs
Behaviour of the Lotka-Volterra model Extensions to the Lotka-Volterra model Summary

Recap on dynamic behaviours
􏰁 Dynamic systems can exhibit different types of long-term behaviour, including fixed points and limit cycles
􏰁 Fixed points and limit cycles can be:
􏰁 stable and attracting (often referred to as attractors) 􏰁 unstable and repelling
􏰁 A single dynamic system can exhibit multiple stable and unstable fixed points
􏰁 In a system with more than one stable fixed point, the long-term behaviour will depend on the initial conditions
􏰁 The set of initial conditions that approach an attractor are known as a basin of attraction

Broader applicability of Lotka-Volterra model
In the 1960s, , a mathematician and economist, proposed a model analogous to the Lotka-Volterra model for the relationship between wages and employment in an economy:
􏰁 wages = predators 􏰁 employment = prey
The system operates as follows:
􏰁 at high levels of employment, employees can bargain for higher wages, which reduces profits
􏰁 as profits shrink, fewer workers will be employed, which increases profits
􏰁 once profit levels are higher, more workers will be employed and employment will increase, leading to cyclic behaviour.
Complex systems often exhibit underlying patterns of behaviour across multiple domains

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com