You are on page 1of 1

01-04-2021 2021-04-01-153418

In [1]: import numpy as np


import matplotlib.pyplot as plt
from scipy.integrate import odeint
def df_dt(x, t, a, b, c, d):
dx = a * x[0] - b * x[0] * x[1]
dy = - c * x[1] + d * x[0] * x[1]
return np.array([dx, dy])

#Parametros
a = 0.1
b = 0.02
c = 0.3
d = 0.01
# Condiciones iniciales
x0 = 50 # Presas
y0 = 10 # Depredadores
conds_iniciales = np.array([x0, y0])
# Condiciones para integración
tf = 200
N = 800
t = np.linspace(0, tf, N)
solucion = odeint(df_dt, conds_iniciales, t, args=(a, b, c, d))

plt.plot(t, solucion[:, 0], label='presa')


plt.plot(t, solucion[:, 1], label='depredador')

Out[1]: [<matplotlib.lines.Line2D at 0x7f2cb9ae32e8>]

Out[1]:

In [0]:

https://cocalc.com/006811ad-762b-4624-9fdb-16159e2dd68c/raw/2021-04-01-153418.html 1/1

You might also like