CoCalc Public Files2020-11-30-171452.ipynb
Authors: Andy Hon, Nyla Jafri, Sewon(Timothy) Jeong
Views : 63
Compute Environment: Ubuntu 20.04 (Default)
In [5]:
var("E,V,R")
Vprime= 100*E - 2*V
Rprime= 0.272 - 0.00136*R - 0.00027*R*V
Eprime= 0.00027*R*V - 0.33*E
list_plot(Vprime, plotjoined=True)+list_plot(Rprime, plotjoined=True)+list_plot(Eprime, plotjoined=True)

--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-5-0eb44a0c940a> in <module> ----> 1 var("E,V,R") 2 Vprime= 100*E - 2*V 3 Rprime= 0.272 - 0.00136*R - 0.00027*R*V 4 Eprime= 0.00027*R*V - 0.33*E 5 list_plot(Vprime, plotjoined=True)+list_plot(Rprime, plotjoined=True)+list_plot(Eprime, plotjoined=True) NameError: name 'var' is not defined 
In [6]:
#Hello World

In [3]:
var("E")
var("V")
var("R")
Vprime= 100*E - 2*V
Rprime= 0.272 - 0.00136*R - 0.00027*R*V
Eprime= 0.00027*R*V - 0.33*E
t=srange(0,100,0.1)
sol_6=desolve_odeint([Vprime, Rprime, Eprime], ics=[0,0,0], dvars=[V,R,E], times=t)
list_plot(list([sol_6[:,0], sol_6[:,1], sol_6[:,2]]))

--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-3-496fd129b02b> in <module> ----> 1 var("E") 2 var("V") 3 var("R") 4 Vprime= 100*E - 2*V 5 Rprime= 0.272 - 0.00136*R - 0.00027*R*V NameError: name 'var' is not defined 
In [13]:


Vprime= 100*E - 2*V
Rprime= 0.272 - 0.00136*R - 0.00027*R*V
Eprime= 0.00027*R*V - 0.33*E
t=srange(0,100,0.1)
sol_6=desolve_odeint([Vprime, Rprime, Eprime], ics=[0,0,0], dvars=[E,V,R], times=t)
list_plot(list([sol_6[:,0], sol_6[:,1], sol_6[:,2]]))

--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-13-5df68e0800d3> in <module> ----> 1 var(V) 2 var(R) 3 Vprime= 100*E - 2*V 4 Rprime= 0.272 - 0.00136*R - 0.00027*R*V 5 Eprime= 0.00027*R*V - 0.33*E NameError: name 'var' is not defined 
In [1]:
#3

# importing library sympy
from sympy import symbols, Eq, solve

# defining symbols used in equations
# or unknown variables
V, R, E = symbols('V,R,E')

# defining equations

eq1 = Eq((100*E - 2*V), 0)
print("Equation 1:")
print(eq1)
eq2 = Eq((0.272*R - 0.00136*R - 0.00027*V), 0)
print("Equation 2")
print(eq2)
eq3= Eq((0.00027*V - 0.33*E), 0)
print("Equation 3")
print(eq3)
# solving the equation
print("Values of 3 unknown variable are as follows:")

print(solve((eq1, eq2, eq3), (V,R,E)))

Equation 1: Eq(100*E - 2*V, 0) Equation 2 Eq(0.27064*R - 0.00027*V, 0) Equation 3 Eq(-0.33*E + 0.00027*V, 0) Values of 3 unknown variable are as follows: {E: 0.0, R: 0.0, V: 0.0}
In [1]:
#In order to find the stability, I used an eigenvector and eigenvalues calculator to compute the eigenvector and eigenvalue of this 3x3 matrix. The results are λ_1≈-2.240 λ_2≈-0.337 λ_3≈0.247 for eigenvalues. v_1≈({{58552.061}, {-7073.759}, {1}}) v_2≈({{30.581}, {-24.566}, {1}}) v_3=({{1946.186*x_3}, {2136.363*x_3}, {x_3}}) --> These are the eigenvectors for the 3x3 matrix representing our model.

#Concluding stability on 3x3 matrix equilibrium points: http://utkstair.org/clausius/docs/che505/pdf/ODE_stability.pdf

#Based on the website, We would thus conclude that the equilibrium points of (0,0,0) is thereby unstable. There is at least 1 positive eigenvalue, which satisfies the condition for unstable equilibrium points that just needs at least one positive real part.

In [ ]:
#5