# Lotka-Volterra Equation: Phase Plane

### Tags

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.1 • Viewed 474 times • Downloaded 49 times • Run 0 times

NB: Since this model is very slow while run in NetLogo Web it is recommended to download and run it on your PC.

## WHAT IS IT?

This is a model of a phase-space plot of the Lotka-Volterra equations. It is based on the Wolf Sheep Predation (System Dynamics) Model in NetLogo library.

The Lotka-Volterra equations are a pair of first order, non-linear, differential equations that describe the dynamics of biological systems in which two species interact.

## HOW IT WORKS

The Lotka–Volterra equations, also known as the predator–prey equations represent a system of two dimensional, first-order, nonlinear, differential equations frequently used to describe the dynamics of biological systems in which two species interact, one as a predator and the other as prey. The populations change through time according to the pair of equations:

dX/dt = αX - βXY (1)

dY/dt = δXY - γY (2)

where

* X is the number of prey (in this model, sheep);

* Y is the number of some predator (in this model, wolves);

* dX/dt and dY/dt represent the growth rates of the two populations over time;

* t represents time;

* α, β, γ, δ are positive real parameters describing the interaction of the two species.

* αX represents the exponential growth of the pray population (in this model as 'sheep-births' flow which is added to sheep stock) and the rate of predation upon the prey is assumed to be proportional to the rate at which the predators and the prey meet (in the actual model this is 'sheep-deaths' flow which is subtracted from the sheep stock): this is represented by βxy. If either x or y is zero then there can be no predation.

* δXY represents the growth of the predator population and γY represents the loss rate of the predators due to either natural death or emigration; it leads to an exponential decay in the absence of prey.

Each flow is calculated in terms of the variables, and stocks that are linked to it.

Governed by these equations and calculations a phase-space plot is generated where X-axis represents the number of pray and Y-axis represents the number of predators. With each calculation a turtle is generated and plotted on the plane with respective coordinates.

After 300 ticks (i.e. time-steps) the model automatically stops.

## HOW TO USE IT

Press the buttons (in respective numerical order):

(1) Setup: creates basic conditions for the model to run (i.e. erases data from previous runs, generates X and Y axes, etc.). The plots from previous runs are preserved for further comparison.

(2) Go: starts running the model with generation of new points (turtles) in accordance with numeric values as a result of calculations, performed every time-step.

(3) and (4): These two monitors show the number of sheep and wolves at any particular time-step during the model run.

Activating/Pressing the above buttons will run the model with initial settings, which are close to the Wolf Sheep Predation (System Dynamics) Model in NetLogo library.

The sliders and chooser below allow to change some of the equations parameters and select the color of the plot to be generated during new runs of the model:

(5) This chooser is for selecting the color of the plot for the next model run. Colors are presented by their number on color swatches pallet. On the right there is a list of available colors and their numeric values.

(6), (7), (8) and (9) are sliders which allow to change some parameters of the equations (e.g. number of sheep and wolves, sheep-birth-rate, predation-rate). These values can be changed before a model run/before pressing 'Setup' and 'Go' buttons.

(10) 'Clear-drawing' button clear all the values: globals, ticks, turtles, patches, drawing, plots, and output.

## THINGS TO NOTICE

Initially the model parameters are set close to the ones in the Sheep Predation (System Dynamics) Model in NetLogo library (i.e. number of sheep = 100, number of wolves = 30, sheep birth-rate (α) = 0.04, predation rate (β) = .0003, predator efficiency (δ) = 0.8 , wolf death-rate (γ) = 0.15)

Changing these parameters will lead to change in phase-plot shape. Running the model with different values of the parameters may help to clarify the impact of a certain parameter(s) on the phase-plot shape.

## THINGS TO TRY

You can change model parameters one by one or combined and observe the impact of these changes on the phase-plot. Which combinations will provide the max number of sheep/wolves during the model run with the selected parameters? Try to find combinations that will lead to one of species extinction.

Before running the model with new settings you should first set the parameters using respective sliders, then select the color for the new plot and then press "Setup" and "Go".

## EXTENDING THE MODEL

The number of parameters that can be varied by sliders in this model is limited. An extension of the model would be adding sliders for additional parameters (e.g. predation efficiency, wolf death-rate, etc.).

## NETLOGO FEATURES

This model is based on Wolf Sheep Predation (System Dynamics) Model in NetLogo library. In some aspects it was converted from 'System Dynamics' version to a 'regular' one by recompiling the code and adding new pieces of the code with respective changes/additions in the model interface (buttons, sliders, etc.).

## RELATED MODELS

* Wolf Sheep Predation (System Dynamics) Model

* Wolf Sheep Predation (Docked Hybrid) Model, both present in NetLogo model library

* Van Der Pol Oscillator Model

## CREDITS AND REFERENCES

This simple abstract model was developed by Victor Iapascurta, MD. At time of development he was in the Department of Anesthesia and Intensive Care at University of Medicine and Pharmacy in Chisinau, Moldova / ICU at City Emergency Hospital in Chisinau. Please email any questions or comments to viapascurta@yahoo.com

The model was created in NetLogo 6.0.1, Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

This model was inspired by Introduction to Dynamical Systems and Chaos (Fall, 2017) MOOC by David Feldman @ Complexity Explorer (https://www.complexityexplorer.org/courses).

## Error opening the file

I have just downloaded the last version of NetLogo, and when I try to open the model it says: "Expected nlogo to have 12 sections, this had 10" What is going on? Thank you!

## The error while opening the model

Since the model was built in NetLogo 6.0.1 this might be the problem and solution. Although the two version 6.0.1 and 6.0.2 are 'compatible' the problem may be because of the model building 'procedure': part of the model was created in SDM than converted to 'regular' Netlogo. You can download the 6.0.1 version and try to open the model with it. Regards, The author

## Posted 9 months ago

Click to Run Model

```globals [
mylist-x
mylist-y
sheep-birth-rate
predation-rate
predator-efficiency
wolf-death-rate
sheep
wolves
dt
]

to setup
;clear-all
clear-globals
clear-ticks
clear-patches
clear-all-plots
ask patches with [ pxcor = 0 ] [  set pcolor white ]
ask patches with [ pycor = 0 ] [  set pcolor white ]
setup-coordinates
set mylist-x list 0 (sheep)
set mylist-y list 0 (wolves)
system-dynamics-setup
system-dynamics-do-plot
end

to system-dynamics-setup
reset-ticks
set dt 0.009
set sheep-birth-rate sheep-birth-rate-slider
set predation-rate predation-rate-slider
set predator-efficiency .8
set wolf-death-rate 0.15
set sheep sheep-num
set wolves wolves-num
end

to clear-picture
ca
end

to go
system-dynamics-go
system-dynamics-do-plot
set mylist-x lput result-x mylist-x
set mylist-y lput result-y mylist-y
crt 1 [
set color select-phase-plot-color
set xcor (last mylist-x * 0.15)
set ycor (last mylist-y * 0.15)
set size 0.5
set shape "circle"
]

if ticks >= 300 [ stop ]
end

to system-dynamics-go

let local-sheep-births sheep-births
let local-sheep-deaths sheep-deaths
let local-wolf-births wolf-births
let local-wolf-deaths wolf-deaths

let new-sheep max( list 0 ( sheep + local-sheep-births - local-sheep-deaths ) )
let new-wolves max( list 0 ( wolves + local-wolf-births - local-wolf-deaths ) )
set sheep new-sheep
set wolves new-wolves

end

to-report sheep-births
report ( sheep-birth-rate * sheep
) * dt
end

to-report sheep-deaths
report ( sheep * predation-rate * wolves
) * dt
end

to-report wolf-births
report ( wolves * predator-efficiency * predation-rate * sheep
) * dt
end

to-report wolf-deaths
report ( wolves * wolf-death-rate
) * dt
end

to-report result-x
report sheep
end

to-report result-y
report  wolves
end

to setup-coordinates
[ set plabel "0"
set plabel-color white ]

[ set plabel "1000"
set plabel-color white ]

[ set plabel "500"
set plabel-color white ]

[ set plabel "1000"
set plabel-color white ]

[ set plabel "2000"
set plabel-color white ]

[ set plabel "-50"
set plabel-color white ]

[ set plabel "-50"
set plabel-color white ]

[ set plabel "Wolves"
set plabel-color blue ]

[ set plabel "Sheep"
set plabel-color red ]
end

to system-dynamics-do-plot
if plot-pen-exists? "sheep" [
set-current-plot-pen "sheep"
plotxy ticks sheep
]
if plot-pen-exists? "wolves" [
set-current-plot-pen "wolves"
plotxy ticks wolves
]
end
```

There is only one version of this model, created 11 months ago by Victor Iapascurta.

## Attached files

File Type Description Last updated
Lotka-Volterra Equation: Phase Plane.png preview Preview for 'Lotka-Volterra Equation: Phase Plane' 11 months ago, by Victor Iapascurta Download

This model does not have any ancestors.

This model does not have any descendants.