import numpy as np

# importamos bibliotecas para plotear
import matplotlib
import matplotlib.pyplot as plt

# para desplegar los plots en el notebook
%matplotlib inline

# para cómputo simbólico
from sympy import *
init_printing()

x, y = symbols('x y')

f = (1-x-y)*x
f

g = (4-7*x-3*y)*y
g

"""
Explanation: Jacobiana
$$\frac{dx}{dt}=a_{1}x-b_{1}x^{2}+c_{1}xy$$
$$\frac{dy}{dt}=a_{2}y-b_{2}y^{2}+c_{1}xy$$

$$\frac{dx}{dt}=(1-x-y)x$$
$$\frac{dy}{dt}=(4-7x-3y)y$$
End of explanation
"""


solve(f, x)

solve(g, y)

Y = solve(g, y)[1]
solve(f.subs(y, Y),x)

solve(g.subs(x, -y + 1), y)

"""
Explanation: Equilibrios
End of explanation
"""


J = symbols("J")

J = Matrix([[diff(f, x), diff(f, y)], 
            [diff(g, x), diff(g, y)]])
J

"""
Explanation: Jacobiana
End of explanation
"""


J = J.subs({x: 1/4, y:3/4})
J

J.det(), J.trace()

"""
Explanation: Evaluada en un punto de equilibrio
End of explanation
"""


