Here, we will conduct a brief analytical study of a famous nonlinear differential system: the Lotka-Volterra equations, also known as predator-prey equations. These equations are first-order differential equations that describe the evolution of two interacting populations (for example, sharks and sardines), where the predators eat the prey. This example illustrates how to obtain exact expressions and results about fixed points and their stability with SymPy.
For this recipe, knowing the basics of linear and nonlinear systems of differential equations is recommended.
Let's create some symbols:
In [1]: from sympy import * init_printing() In [2]: var('x y') var('a b c d', positive=True) Out[2]: (a, b, c, d)
The variables
x
andy
represent the populations of the prey and predators, respectively. The parametersa
,b
,c
, andd
are strictly positive parameters (described...