# 15.7. Analyzing a nonlinear differential system — Lotka-Volterra (predator-prey) equations


```python
from sympy import *
init_printing(pretty_print=True)

var('x y')
var('a b c d', positive=True)
```


```python
f = x * (a - b * y)
g = -y * (c - d * x)
```


```python
solve([f, g], (x, y))
```


```python
(x0, y0), (x1, y1) = _
```


```python
M = Matrix((f, g))
M
```


```python
J = M.jacobian((x, y))
J
```


```python
M0 = J.subs(x, x0).subs(y, y0)
M0
```


```python
M0.eigenvals()
```


```python
M1 = J.subs(x, x1).subs(y, y1)
M1
```


```python
M1.eigenvals()
```

b8cd0f37c068ce2526f7764d934ce52d7c983c4e
ipynb
Jupyter Notebook
chapter15_symbolic/07_lotka.ipynb
wgong/cookbook-2nd-code
8ca2e5b3c90fee6605f4155e6b9dfb783ce46807
MIT
chapter15_symbolic/07_lotka.ipynb
wgong/cookbook-2nd-code
8ca2e5b3c90fee6605f4155e6b9dfb783ce46807
MIT
chapter15_symbolic/07_lotka.ipynb
wgong/cookbook-2nd-code
8ca2e5b3c90fee6605f4155e6b9dfb783ce46807
MIT
Qwen/Qwen-72B
1. YES
2. YES