pythonsympy

inverse laplace transform in Sympy


I am stuck with the inverse laplace using sympy for the function

(21.4375*s**2 - 128.5*s + 1.0)/(-187.03125*s**3 - 297.9375*s**2 - 126.0*s + 1.0)

it shows RisingFactorial(_t + 1, 1.0) contains an element of the set of generators.

I was using sympy

Aprox_t = inverse_laplace_transform(PD_s, s, t)
pprint(Aprox_t)

Solution

  • I suspect the cause of the problems are the floating point numbers. Just convert them to rational with nsimplify, then the computation runs correctly:

    from sympy import *
    var("s, t")
    expr = (21.4375*s**2 - 128.5*s + 1.0)/(-187.03125*s**3 - 297.9375*s**2 - 126.0*s + 1.0)
    expr = expr.nsimplify()
    res = inverse_laplace_transform(expr, s, t)
    

    If that doesn't work, you might want to check which sympy version you are using with import sympy as sp;print(sp.__version__). I'm using 1.13.1, but the latest is 1.13.3.