#calculate the Max. velocity and Michaelis constant
#Initialization of variables
import math
import numpy as np
from numpy import linalg
S=[10, 20, 40, 80, 120, 180, 300]
v=[0.32, 0.58, 0.9, 1.22, 1.42, 1.58, 1.74]
#calculations
n=len(S)
def fun1(x):
for i in range(0,len(x)):
x[i]=1000./(x[i])
return x
def fun2(x):
for i in range(0,len(x)):
x[i]=1./(x[i])
return x
bys=fun1(S)
byv=fun2(v)
x=bys
y=byv
A = np.vstack([x, np.ones(len(x))]).T
m1, b1 = np.linalg.lstsq(A, y)[0]
print '%s' %("From graph,")
vmax=1/b1
Km=m1*1000./b1
#results
print '%s %.2f %s' %("Max. velocity =",vmax," mumol/L s")
print '%s %.1f %s' %("\n Michaelis constant =",Km," mumol/L")
#calculate the Equilibrium constant
#Initialization of variables
c=1.234
m=2.044
#calculations
Ki=c/m
#results
print '%s %.2f' %("KI = ",Ki)
#calculate the no. of diheptane molecules destroyed
#Initialization of variables
import math
P=50. #J/s
l=313.*math.pow(10,-9) #m
h=6.62608*math.pow(10,-34) #Js
N=6.023*math.pow(10,23)
c=2.99792*math.pow(10,8) #m/s
yiel=0.21
#calculations
rate=P*l/(h*c)
Frate=yiel*rate
molrate=Frate/N
#results
print '%s %.1e %s' %("No.of diheptane molecules destroyed =",Frate," s^-1")
print '%s %.2e %s' %("\n Moles of diheptane molecules destroyed =",molrate,"mol s^-1")
#calculate the Equilibrium constant for dimerization
#Initialization of variables
import math
kf=8.18*math.pow(10,8) #L/mol s
kb=2*math.pow(10,6) #s^-1
#calculations
K=kf/kb
#results
print '%s %.1e' %("Equilibrium constant for dimerization = ",K)
#calculate if the reaction step is far from equilibrium and calculate the heat generated
#Initialization of variables
import math
F16bP=1.9*math.pow(10,-5) #mmol/L
ADP=1.3/1000. #mmol/L
ATP=11.4/1000. #mmol/L
F6P=8.9*math.pow(10,-5) #mmol/L
k=1.2*1000.
#calculations
Q=F16bP*ADP/(F6P*ATP)
if(Q<k):
print '%s %.3f' %("The reaction step is far from equilibrium and Q= ",Q)
else:
print '%s %.3f' %("The reaction step is at equilibrium and Q= ",Q)