The limit does not evaluate the power function

I am trying to make a relatively simple limit using sympy:

from sympy import *
f,k,b = symbols('f k b')
test = f**b - k**b
limit(test,k,f)

I expect 0, but get:

>>> limit(test,k,f)
f**b - exp(b*log(f))

Mathematically, this is correct (and zero), but why doesn't it evaluate zero?

Please note if I define:

from sympy import *
f,k,b = symbols('f k b')
test = exp(b*log(f)) - exp(b*log(k))
limit(test,k,f)

then i get zero.

+4
source share
1 answer

It would be wrong to say that the limit is zero at all. Consider the following calculation in the Python console:

>>> (-1)**(1/2)
(6.123233995736766e-17+1j)
>>> (-1 - 1e-15j)**(1/2)
(5.053215498074303e-16-1j)

Due to the branching off of a slice of a complex square root along the negative real axis, two extremely close base values ​​give completely different results (the difference is about 2j).

The limit is indeed zero if we adhere to a positive base and real indicators.

from sympy import *
k = symbols('k')
f = symbols('f', positive=True)
b = symbols('b', real=True)
test = f**b - k**b
limit(test,k,f)   # returns 0 
+2
source

Source: https://habr.com/ru/post/1668025/


All Articles