Hello,

I have tried to do the inverse Laplace transform of ‘2/((3*s + 1)*(s**2 + 1))’ 
and I got a really ugly result. Fortunately it’s easy to get a much better 
solution.

It wouldn’t surprise me to know that I’m doing something wrong... If not, I 
hope it could improve in someway how Sympy does the inverse Laplace transform.

Here is the Jupyter session showing how I got that ugly solution:

+*In[1]:*+
[source, ipython3]
----
from sympy import *
t = symbols("t", real=True)
s = symbols("s")

y = 2/((3*s + 1)*(s**2 + 1))

inverse_laplace_transform(y, s, t)
----


+*Out[1]:*+
----
2*(-(I*sin(t) - cos(t))*gamma(-2*I)*gamma(1/3 - I)/(gamma(1 - 2*I)*gamma(4/3 - 
I)) + (I*sin(t) + cos(t))*gamma(2*I)*gamma(1/3 + I)/(gamma(1 + 2*I)*gamma(4/3 + 
I)) + exp(-t/3)*gamma(-1/3 - I)*gamma(-1/3 + I)/(gamma(2/3 - I)*gamma(2/3 + 
I)))*Heaviside(t)/3
----

The solution could be improved a lot if we perform a partial fraction 
decomposition and then do the inverse Laplace transform:

+*In[2]:*+
[source, ipython3]
----
yapart = apart(expand(y))
yapart
----


+*Out[2]:*+
----
-(3*s - 1)/(5*(s**2 + 1)) + 9/(5*(3*s + 1))
----


+*In[3]:*+
[source, ipython3]
----
inverse_laplace_transform(yapart.args[0], s, t) + \
inverse_laplace_transform(yapart.args[1], s, t)
----

+*Out[3]:*+
----
(sin(t) - 3*cos(t))*Heaviside(t)/5 + 3*exp(-t/3)*Heaviside(t)/5
----

Maybe it could be a good idea if the inverse Laplace transform performed this 
decomposition.

Javier

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/58060483-977C-4F60-99E9-81F6846108B5%40gmail.com.

Reply via email to