Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

import numpy as np

from scipy.integrate import odeint


def rates(y,t,k1,k2,kmemb):
C_cholesterol, Ccholestenone, C_O2, C_H2O2 = y
k_react = k1 / (k2 + C_cholesterol)
r_cholesterol = k_react * C_cholesterol * C_O2
dC_cholesterol_dt = -r_cholesterol
dC_cholestenone_dt = r_cholesterol
dC_O2_dt = -kmemb * C_O2 + k_react * C_cholesterol * C_O2
dC_H2O2_dt = k_react * C_cholesterol * C_O2
return [dC_cholesterol_dt, dC_cholestenone_dt, dC_O2_dt, dC_H2O2_dt]

#se the initial conditions


y0=[15,0,1,0]
k1=0.001
k2=5*10^(-6)
kmemb=0.01

t = np.linspace(0,2000,10000)

sol = odeint(rates,y0,t,args=(k1,k2,kmemb))

import matplotlib.pyplot as plt


plt.plot(t,sol[:,0],label='cholesterol')
plt.plot(t,sol[:,1],label='cholestenone')
plt.plot(t,sol[:,2],label='O2')
plt.plot(t,sol[:,3],label='H2O2')
plt.legend()
plt.xlabel('time(s)')
plt.ylabel('concentration(mM)')
plt.show()

You might also like