import math
class A(object):
La=0
L2=0
L3=0
ka=0
k=0
keo=0
tau=0
Cp = []
Ce = []
t = []
def __init__(self, La, L2, ka, k, keo, tau):
self.La = float(La)
self.L2 = float(L2)
self.ka = float(ka)
self.k = float(k)
self.keo = float(keo)
self.tau = int(math.floor(float(tau)))
denominatorLae = self.keo-self.ka
if 0<=(self.keo - self.ka) < 0.01:
print("Warning: zero denominator")
denominatorLae = 0.01
if 0<(self.ka - self.keo) <0.01:
denominatorLae = -0.01
self.Lae = -self.La*self.keo/denominatorLae
denominatorL2e = self.keo-self.k
if 0<=(self.keo - self.k) < 0.01:
print("Warning: zero denominator")
denominatorL2e = 0.01
if 0<(self.ka - self.keo) <0.01:
denominatorL2e = -0.01
self.L2e =-self.L2*self.keo/denominatorL2e
self.L3e = self.La-self.L2
self.t = [x for x in range(0, self.tau)]
self.Ce = []
def calculate(self):
import math
for element in list(self.t):
self.Ce.append(self.Lae * math.exp(element * -self.ka) +
self.L2e * math.exp(element * -self.k) +
self.L3e * math.exp(element * -self.keo))
Matrix = [[0 for x in range(2)] for x in range(len(self.t))]
for index_row in range(len(self.t)):
Matrix[index_row][0] = self.t[index_row]
Matrix[index_row][1] = self.Ce[index_row]
return Matrix