Lotka-Volterra 2d

Lotka–Volterra models are used in mathematical biology for modelling population dynamics of animal species, as well as many other fields where predator-prey and similar models appear. The dynamics of the growth of two interacting species can be modelled by the following noncanonical Hamiltonian system

\[\dot{q} = \begin{pmatrix} \hphantom{-} 0 & + q_1 q_2 \\ - q_1 q_2 & \hphantom{+} 0 \\ \end{pmatrix} \nabla H (q) , \quad H (q) = a_1 \, q_1 + a_2 \, q_2 + b_1 \, \log q_1 + b_2 \, \log q_2 .\]

Sub-models

The Euler-Lagrange equations of the Lotka-Volterra model can be obtained from different Lagrangians, which are connected by gauge transformations. Although they all lead to the same equations of motion, they lead to different variational integrators. Therefore different models based on different Lagrangians are implemented.

GeometricProblems.LotkaVolterra2dModule

Lotka-Volterra model in 2D

\[\begin{aligned} L (q, \dot{q}) &= \bigg( q_2 + \frac{\log q_2}{q_1} \bigg) \, \dot{q_1} + q_1 \, \dot{q_2} - H(q) , \\ H(q) &= a_1 \, q_1 + a_2 \, q_2 + b_1 \, \log q_1 + b_2 \, \log q_2 \end{aligned}\]

source
GeometricProblems.LotkaVolterra2dSymmetricModule

Lotka-Volterra model in 2D with symmetric Lagrangian

\[\begin{aligned} L (q, \dot{q}) &= \frac{1}{2} \frac{\log q_2}{q_1} \, \dot{q_1} - \frac{1}{2} \frac{\log q_1}{q_2} \, \dot{q_2} - H(q) , \\ H(q) &= a_1 \, q_1 + a_2 \, q_2 + b_1 \, \log q_1 + b_2 \, \log q_2 \end{aligned}\]

This Lagrangian is a slight generalization of Equation (5) in José Fernández-Núñez, Lagrangian Structure of the Two-Dimensional Lotka-Volterra System, International Journal of Theoretical Physics, Vol. 37, No. 9, pp. 2457-2462, 1998.

source
GeometricProblems.LotkaVolterra2dSingularModule

Lotka-Volterra model in 2D with "singular" Lagrangian

\[\begin{aligned} L (q, \dot{q}) &= \frac{\log q_2}{q_1} \, \dot{q_1} - H(q) , \\ H(q) &= a_1 \, q_1 + a_2 \, q_2 + b_1 \, \log q_1 + b_2 \, \log q_2 \end{aligned}\]

This Lagrangian is equivalent to the Lagrangian of the symmetric Lotka-Volterra model. It differs only by a gauge transformation with the term $- 1/2 \, d(\log(q_1) \log(q_2))/dt$. It leads to the same Euler-Lagrange equations but to a different variational integrator.

source
GeometricProblems.LotkaVolterra2dGaugeModule

Lotka-Volterra model in 2D with symmetric Lagrangian with gauge term

\[\begin{aligned} L (q, \dot{q}) &= \bigg( q_2 + \frac{1}{2} \frac{\log q_2}{q_1} \bigg) \, \dot{q_1} + \bigg( q_1 - \frac{1}{2} \frac{\log q_1}{q_2} \bigg) \, \dot{q_2} - H(q) , \\ H(q) &= a_1 \, q_1 + a_2 \, q_2 + b_1 \, \log q_1 + b_2 \, \log q_2 \end{aligned}\]

This Lagrangian is equivalent to the Lagrangian of the symmetric Lotka-Volterra model. It differs only by a gauge transformation with the term $d(q_1 q_2)/dt$. It leads to the same Euler-Lagrange equations but to a different variational integrator.

source

User Functions

Plotting Functions

GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d!Method

Plots the solution of a 2D Lotka-Volterra model together with the energy error.

Arguments:

  • sol <: Solution
  • equ <: Equation

Keyword aguments:

  • nplot=1: plot every nplotth time step
  • xlims=:auto: xlims for solution plot
  • ylims=:auto: ylims for solution plot
  • latex=true: use LaTeX guides
source
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d!Method

Plots the solution of a 2D Lotka-Volterra model together with the energy error.

Arguments:

  • sol <: Solution
  • equ <: Equation

Keyword aguments:

  • nplot=1: plot every nplotth time step
  • xlims=:auto: xlims for solution plot
  • ylims=:auto: ylims for solution plot
  • latex=true: use LaTeX guides
source
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2dMethod

Plots the solution of a 2D Lotka-Volterra model together with the energy error.

Arguments:

  • sol <: Solution
  • equ <: Equation

Keyword aguments:

  • nplot=1: plot every nplotth time step
  • xlims=:auto: xlims for solution plot
  • ylims=:auto: ylims for solution plot
  • latex=true: use LaTeX guides
source