'Error in Laplace transform with sympy: "Argument 'polar_lift(0)' is not comparable."

I've been trying to calculate the Laplace transform of the following function:

x, u, k = symbols('x u k', real = True)

def gLbar(x):
   return Piecewise((0, x < 0), (k*exp(-k*x), (x >= 0)&(x <= u)), (0, True))
gLbar(x)

Which is basically an exponential distribution of parameter k that is truncated at u. u and k are scalars whose values I don't want to define just yet (so far that has worked for integration/derivation operations).

I try to compute the Laplace transform with the sympy function, which has worked so far for many other functions:

laplace_transform(gLbar(t), t, s)

However, for this one, I get an error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-149-5e61d42f0daf> in <module>()
----> 1 laplace_transform(gLbar(t), t, s)


/usr/local/lib/python3.7/dist-packages/sympy/functions/elementary/miscellaneous.py in _new_args_filter(cls, arg_sequence)
    559                     arg.is_number and
    560                     not arg.is_comparable):
--> 561                 raise ValueError("The argument '%s' is not comparable." % arg)
    562 
    563             if arg == cls.zero:

ValueError: The argument 'polar_lift(0)' is not comparable.

Do you know what might be the problem? I'm new to using sympy but so far everything was working OK.

Thank you!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source