Python – Sympy – limit() error : Result depends on the sign

Sympy – limit() error : Result depends on the sign… here is a solution to the problem.

Sympy – limit() error : Result depends on the sign

I’m trying to solve the following problem:

enter image description here

Applying the following I got the correct answer.

α, t, x = symbols('α t x')
integrate(α*x*exp(-α*x), (x, 0, oo), conds='none')

To check the solution (1/α), I tried the following.

limit(integrate(α*x*exp(-α*x), (x, 0, t), conds='none'), t, oo)

But this produces a NotImplementedError

: Result depends on the sign of -sign(α) and a further **NotImplementedError** that is not described. The function works for real numbers, but not for oo. How do I fix this?

Solution

Adding the parameter positive = true to the symbols function alleviates this problem.

α, t, x = symbols('α t x', positive = True)

func = integrate(α*x*exp(-α*x), (x, 0, t), conds='none')

(limit(func, t, oo))

Yield 1/α

Related Problems and Solutions