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.LotkaVolterra2d
— ModuleLotka-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}\]
GeometricProblems.LotkaVolterra2dSymmetric
— ModuleLotka-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.
GeometricProblems.LotkaVolterra2dSingular
— ModuleLotka-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.
GeometricProblems.LotkaVolterra2dGauge
— ModuleLotka-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.
User Functions
GeometricProblems.LotkaVolterra2d.daeproblem
— FunctionCreates a DAE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.hdaeproblem
— FunctionCreates a Hamiltonian DAE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.hodeproblem
— FunctionCreates a Hamiltonian ODE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.idaeproblem
— FunctionCreates an implicit DAE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.idaeproblem_spark
— FunctionCreates an implicit DAE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.iodeproblem
— FunctionCreates an implicit ODE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.iodeproblem_dg
— FunctionCreates an implicit ODE object for the Lotka-Volterra 2D model for use with DG integrators.
GeometricProblems.LotkaVolterra2d.ldaeproblem
— FunctionCreates a variational DAE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.ldaeproblem_slrk
— FunctionCreates a variational DAE object for the Lotka-Volterra 2D model for use with SLRK integrators.
GeometricProblems.LotkaVolterra2d.lodeproblem
— FunctionCreates a variational ODE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.odeproblem
— FunctionCreates an ODE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.pdaeproblem
— FunctionCreates a partitioned DAE object for the Lotka-Volterra 2D model.
GeometricProblems.LotkaVolterra2d.podeproblem
— FunctionCreates a partitioned ODE object for the Lotka-Volterra 2D model.
Plotting Functions
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d!
— MethodPlots the solution of a 2D Lotka-Volterra model together with the energy error.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time stepxlims=:auto
: xlims for solution plotylims=:auto
: ylims for solution plotlatex=true
: use LaTeX guides
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d!
— MethodPlots the solution of a 2D Lotka-Volterra model together with the energy error.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time stepxlims=:auto
: xlims for solution plotylims=:auto
: ylims for solution plotlatex=true
: use LaTeX guides
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d
— MethodPlots the solution of a 2D Lotka-Volterra model together with the energy error.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time stepxlims=:auto
: xlims for solution plotylims=:auto
: ylims for solution plotlatex=true
: use LaTeX guides
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d_solution!
— MethodPlots the solution of a 2D Lotka-Volterra model.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time stepxlims=:auto
: xlims for solution plotylims=:auto
: ylims for solution plotlatex=true
: use LaTeX guides
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d_solution!
— MethodPlots the solution of a 2D Lotka-Volterra model.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time stepxlims=:auto
: xlims for solution plotylims=:auto
: ylims for solution plotlatex=true
: use LaTeX guides
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d_solution
— MethodPlots the solution of a 2D Lotka-Volterra model.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time stepxlims=:auto
: xlims for solution plotylims=:auto
: ylims for solution plotlatex=true
: use LaTeX guides
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d_traces!
— MethodPlots time traces of the solution of a 2D Lotka-Volterra model and its energy error.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time steplatex=true
: use LaTeX guides
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d_traces!
— MethodPlots time traces of the solution of a 2D Lotka-Volterra model and its energy error.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time steplatex=true
: use LaTeX guides
GeometricProblems.LotkaVolterra2dPlots.plot_lotka_volterra_2d_traces
— MethodPlots time traces of the solution of a 2D Lotka-Volterra model and its energy error.
Arguments:
sol <: GeometricSolution
equ <: GeometricProblem
Keyword aguments:
nplot=1
: plot everynplot
th time steplatex=true
: use LaTeX guides