Search code examples
pythonsympycalculus

Sympy - limit() Error: Result depends on the sign


I'm attempting to solve the following problem:

enter image description here

Applying the following I get the correct answer.

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

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

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

But this yields NotImplementedError: Result depends on the sign of -sign(α) as well as a further **NotImplementedError** with no description. The function works for real numbers but not oo. How can I work around this problem?


Solution

  • Adding the argument positive = True to the symbols function mitigates this issue.

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

    Yielding 1/α