最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - inverse laplace transform in Sympy - Stack Overflow

programmeradmin1浏览0评论

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)

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)
Share Improve this question edited Feb 1 at 18:13 ti7 18.9k7 gold badges47 silver badges79 bronze badges asked Feb 1 at 17:24 Pankit ChahalPankit Chahal 132 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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.

发布评论

评论列表(0)

  1. 暂无评论