p = symbols('p')
alpha = symbols('ฮฑ', positive=True)
pprint(Limit(4 * pi * p ** (-alpha) * (p ** 3 - p ** alpha) / (alpha - 3), p, 0))
โ -ฮฑ โ 3 ฮฑโโ
โ4โ
ฯโ
p โ
โp - p โ โ
lim โโโโโโโโโโโโโโโโโโโ
pโโ0โบโ ฮฑ - 3 โ
md5-79cfb4f1d7fcfbec6d25b4abe71a549e
-4โ
ฯ
โโโโโ
ฮฑ - 3
but correct results are:
-4โ
ฯ
โโโโโ (0 < ฮฑ < 3)
ฮฑ - 3
oo (ฮฑ > 3)
```
This boils down to
>>> Limit(p ** (-alpha) * (p ** 3 - p ** alpha), p, 0).doit()
-1
versus
>>> Limit(p ** (-alpha) * (p ** 3 - p ** alpha), p, 0).expand().doit()
NotImplementedError: Result depends on the sign of sign(ฮฑ - 3)
It might be possible to prevent the wrong result, but it seems the most we can expect is NotImplementedError. When limit detects such dependence, it throws an error instead of splitting the computation in two or three cases.
See the discussion at https://github.com/sympy/sympy/issues/13312 about making limit able to return Piecewise objects.
The non-expanded version not giving the error is definitely a wrong result.
I would like to work on this issue. @asmeurer , @normalhuman can you guide me what exactly to do.