Is it possible to calculate inverse Laplace Transform of exponent?

185 views
Skip to first unread message

Paul Royik

unread,
Jul 3, 2015, 6:58:06 AM7/3/15
to sy...@googlegroups.com
I want to calculate inverse laplace of e^(-2s) which is dirac(t-2), but sympy gives unevaluated.

Kalevi Suominen

unread,
Jul 3, 2015, 7:47:19 AM7/3/15
to sy...@googlegroups.com


On Friday, July 3, 2015 at 1:58:06 PM UTC+3, Paul Royik wrote:
I want to calculate inverse laplace of e^(-2s) which is dirac(t-2), but sympy gives unevaluated.

It is currently not possible to compute in SymPy. The inverse transform involves integration along a vertical line in the complex plane and the absolute value of e^(--2s) is constant along any such line. Hence the function is not integrable on a vertical line in the usual sense, and its integration is currently not supported by SymPy.

Paul Royik

unread,
Jul 3, 2015, 10:28:28 AM7/3/15
to sy...@googlegroups.com
OK.
Thanks.

Aaron Meurer

unread,
Jul 7, 2015, 2:31:41 PM7/7/15
to sy...@googlegroups.com
More generally, SymPy's integrator doesn't know how to return delta
functions. It only knows how to deal with delta functions as arguments
to integrals.

Aaron Meurer
> --
> 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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/52c17e0e-2055-4531-a87d-e59276b474ca%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Kalevi Suominen

unread,
Jul 8, 2015, 3:19:56 AM7/8/15
to sy...@googlegroups.com


On Tuesday, July 7, 2015 at 9:31:41 PM UTC+3, Aaron Meurer wrote:
More generally, SymPy's integrator doesn't know how to return delta
functions. It only knows how to deal with delta functions as arguments
to integrals.
 
It would not be too hard to extend SymPy's integrator to return delta functions,
their derivatives and even other tempered distributions. They can be represented
as boundary values of analytic functions provided a suitable interface is defined.
I have discussed this in a slightly different connection in #9483.

There are more details in the attachment.


invlaplace.pdf

Andrés Prieto

unread,
Jul 20, 2015, 1:00:03 PM7/20/15
to sy...@googlegroups.com
Some weeks ago, we were working on a (dirty) patch to be able to compute inverse Laplace transforms of exponentials in Octsympy (https://github.com/cbm755/octsympy/pull/261#issuecomment-122077921). The trick is based on the linearity of the inverse Laplace transform and on the expansion of all terms to be transformed in terms of exponentials. In what follows, a code snippet is attached to illustrate its feasibility:

import sympy as sp


from sympy.abc import t, s, c



F=5*sp.exp(-3*s)+2*sp.exp(c*s)-2*sp.exp(-2*s)/s



f=0; a_ = sp.Wild("a_"); b_ = sp.Wild("b_")


Fr=F.rewrite(sp.exp)


if type(Fr)==sp.Add:


    terms=Fr.expand().args


else:


    terms=(Fr,)


for term in terms:


    #compute the Laplace transform for each term


    r=sp.simplify(term).match(a_*sp.exp(b_))


    if r!=None and sp.diff(term,s)!=0:


        rlist=list(r.values())


        modulus=rlist[0]


        phase=rlist[1]/s


        # if a is constant and b/s is constant


        if sp.diff(modulus,s)==0 and sp.diff(phase,s)==0:


            f = f + modulus*sp.DiracDelta(t+phase)


        else:


            f = f + sp.Subs(sp.inverse_laplace_transform(term, s, t),sp.Heaviside(t),1).doit()


    elif sp.diff(term,s)==0:


        f = f + term*sp.DiracDelta(t)


    else:


        f = f + sp.Subs(sp.inverse_laplace_transform(term, s, t),sp.Heaviside(t),1).doit()


     I hope that this approach could be helpful to handle Dirac deltas in the context of (i)Laplace transforms.

Aaron Meurer

unread,
Jul 20, 2015, 1:06:20 PM7/20/15
to sy...@googlegroups.com
Perhaps we just need to add some cases to manualintegrate to handle this.

Aaron Meurer

--
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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
Reply all
Reply to author
Forward
0 new messages