mp.invertlaplace(fp,t,method='talbot') raise TypeError("cannot create mpf from " + repr(x))

Skip to first unread message

Dec 13, 2018, 6:01:31 AM12/13/18
to mpmath
Dear all,
When I try to use following syntax to obtain the inverse laplace result, the system raise error information TypeError("cannot create mpf from " + repr(x)).
import mpmath as mp
from functools import reduce
s = sp.symbols('s')
x = sp.symbols('x')
y = sp.symbols('y')

wse =[mp.exp(-0.5*s)/(s + 1), mp.exp(-2*s)/(3*s + 1)]
a = (reduce(lambda x,y: x*y, wse[0]))
fp = lambda s:a/s
b = mp.invertlaplace(fp,t=10,method='talbot')
Since the list of wse will change in my loops, I didn't do the inverse laplace transfer directly.
Can someone help me to tackle the problem?
Thank you in advance.

Kris Kuhlman

Dec 13, 2018, 6:44:10 AM12/13/18
If you replace “sp.symbols” with numerical values for those variables and make the functions in wse into lambdas, it may work (I can’t test it right now). Try evaluating the function “by hand” before passing it to the invertlaplace function.

This is a numerical inversion algorithm, not an algebraic one.


You received this message because you are subscribed to the Google Groups "mpmath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

haha Yang

Dec 13, 2018, 7:48:48 AM12/13/18
Thank you Kris,
But symbols "s" is factor in laplace format, and "x,y" will help to multiply the elements is a list. And to tackle a general problem, I am afraid I have to keep these symbols.

Kris Kuhlman <> 于2018年12月13日周四 下午12:44写道:
Reply all
Reply to author
0 new messages