As the title suggests, I am trying to implement the above. My first attempt at doing this involved solving the continuous fraction part. Question: How do i know how deep i need to go in the continued fraction part? I tried choosing 3 levels( continued fraction that goes down 3 levels). But doing so, takes sympy tons of time to execute. Can someone please help? Heres my code:
My function that computes generalized continued fraction:
def list_to_fract2(l,l2):
expr2 = sym.Integer(0)
for i,j in zip(reversed(l),reversed(l2)):
expr2 = j-expr2
expr1 = i
expr2 = expr1 / expr2
return expr2
ak = sym.symbols("a1:4") #3 levels deep
bk = sym.symbols('b1:4') #3 levels deep
mu = sym.Symbol('mu')
s,lam = sym.symbols(['s','lam'])
expr = list_to_fract2(ak,bk)
expr
a1/(-a2/(-a3/b3 + b2) + b1)
#Initializing parameters to be subbed into sympy later
k = np.arange(1,len(ak)+1)
dk = mu + k*frac(str(thetas[0]))
a_k = lam * dk
b_k = s + dk + lam
expr = expr.subs({i:j for i,j in zip(ak,a_k)})
expr
lam*(mu + 71/100)/(b1 - lam*(mu + 71/50)/(b2 - lam*(mu + 213/100)/b3))
expr = expr.subs({i:j for i,j in zip(bk,b_k)})
expr
lam*(mu + 71/100)/(-lam*(mu + 71/50)/(-lam*(mu + 213/100)/(lam + mu + s + 213/100) + lam + mu + s + 71/50) + lam + mu + s + 71/100)
expr = expr.subs({'mu': frac(str(mu2)),'lam':frac(str(lamda_emp[0]))})
expr
1221/(400*(s + 7/2 - 2183/(500*(s + 421/100 - 11359/(2000*(s + 123/25))))))
Question: Now is this what i am supposed to take inverse laplace of?
I next tried this:
t = sym.symbols("t", positive=True)
ans = sym.inverse_laplace_transform(expr,s,t).evalf().simplify()
This is taking way too long to execute in my machine. If i change the levels to 2, in which case it actually works quite fast. Can anyone help with this? Thanks
My parameters are as follows: mu = 0.94, theta = 0.71, lamda = 1.85
dk = k*theta
ak = lam*dk
bk = s + dk + lam
Im trying to solve the following function. Assume b = 1 in the simple case. And then finally taking inverse laplace transform of this
In reality, i want to take inverse laplace of the following equation. But before i try this, i wanted to first try for the base case.