import math
class B(object):
L1=0
L2=0
La=0
lambda1=0
lambda2=0
ka=0
tau = 0
Cp = []
result1 = []
result2 = []
result3 = []
t = []
def __init__(self, L1, L2, La, lambda1, lambda2, ka, tau):
self.L1 = float(L1)
self.L2 = float(L2)
self.La = float(La)
self.lambda1 = float(lambda1)
self.lambda2 = float(lambda2)
self.ka = float(ka)
self.tau = int(math.floor(float(tau)))
self.t = [x for x in range(0, self.tau)]
self.Cp = []
self.result1 = []
self.result2 = []
self.result3 = []
def calculate(self):
'''three different types of genotypes (normal, fast, ultra),
or genotype1, 2, and 3, respectively.'''
normal = 1
fast = 0.8
ultra = 0.5
for element in list(self.t):
self.result1.append(self.L1 * math.exp(element * -self.lambda1) +
self.L2 * math.exp(element * -self.lambda2) +
self.La * math.exp(element * -self.ka))
self.result2.append(fast*self.L1 * math.exp(element * -self.lambda1) +
fast*self.L2 * math.exp(element * -self.lambda2) +
self.La * math.exp(element * -self.ka))
self.result3.append(ultra*self.L1 * math.exp(element * -self.lambda1) +
ultra*self.L2 * math.exp(element * -self.lambda2) +
self.La * math.exp(element * -self.ka))
Matrix1 = [[0 for x in range(2)] for x in range(len(self.t))]
Matrix2 = [[0 for x in range(2)] for x in range(len(self.t))]
Matrix3 = [[0 for x in range(2)] for x in range(len(self.t))]
for index_row in range(len(self.t)):
Matrix1[index_row][0] = self.t[index_row]
Matrix1[index_row][1] = self.result1[index_row]
Matrix2[index_row][0] = self.t[index_row]
Matrix2[index_row][1] = self.result2[index_row]
Matrix3[index_row][0] = self.t[index_row]
Matrix3[index_row][1] = self.result3[index_row]
return Matrix1, Matrix2, Matrix3