Professional Documents
Culture Documents
Respuestas:
1.- #modelacion poblacion conejo V/S Zorro ayudantia n + 4
#metodo de Euler
import numpy as np
import matplotlib.pyplot as plt
def animales(c, z, b=1000):
c_dot = (2*c) * (1-(c/b)) - (1.2*c*z)
z_dot = -z + (0.9 * c * z)
return c_dot, z_dot
dt = 0.01
stepCnt = 1000
cs = np.empty((stepCnt + 1))
zs = np.empty((stepCnt + 1))
cs[0], zs[0] = ( 2, 4)
t = np.linspace(0,stepCnt*dt,stepCnt+1)
for i in range(stepCnt):
c_dot, z_dot = animales(cs[i], zs[i])
cs[i + 1] = cs[i] + (c_dot * dt)
zs[i + 1] = zs[i] + (z_dot * dt)
plt.plot(t,cs,t, zs)
numpoints = 10000
t=np.linspace(0, stoptime, numpoints)
w0 = [c, z]
sol = odeint(animales, w0, t)
solc = [sol[i,0] for i in range(numpoints)]
solz = [sol[i,1] for i in range(numpoints)]
plt.plot(t,solc,t,solz)
Graf. 3
4.-
Graf. 4
Graf. 5
Graf. 6
Graf. 8