New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sympy is unable to integrate this #23299
Comments
Wolfram alpha makes the assumption that In [1]: a, x = symbols('a, x', positive=True)
In [2]: integrate(a* x**(a-1) * ln(x), (x, 0, 1))
Out[2]:
-1
───
a |
SymPy is able to compute the indefinite integral >>> pprint(integrate(a* x**(a-1) * ln(x), x))
⎛⎧ a a ⎞
⎜⎪x ⋅log(x) x ⎟
⎜⎪───────── - ── for a ≠ 0⎟
⎜⎪ a 2 ⎟
⎜⎪ a ⎟
a⋅⎜⎨ ⎟
⎜⎪ 2 ⎟
⎜⎪ log (x) ⎟
⎜⎪ ─────── otherwise⎟
⎜⎪ 2 ⎟
⎝⎩ ⎠ The problem is it doesn't know how to compute the lower limits with the symbolic term. >>> integrate(a* x**(a-1) * ln(x), x).limit(x, 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/core/expr.py", line 3390, in limit
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/limits.py", line 64, in limit
return Limit(e, z, z0, dir).doit(deep=False)
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/limits.py", line 359, in doit
r = gruntz(e, z, z0, dir)
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/gruntz.py", line 711, in gruntz
r = limitinf(e0, z)
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/core/cache.py", line 70, in wrapper
retval = cfunc(*args, **kwargs)
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/gruntz.py", line 452, in limitinf
c0, e0 = mrv_leadterm(e, x)
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/core/cache.py", line 70, in wrapper
retval = cfunc(*args, **kwargs)
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/gruntz.py", line 527, in mrv_leadterm
Omega, exps = mrv(e, x)
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/gruntz.py", line 261, in mrv
s, expr = mrv(d, x)
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/gruntz.py", line 306, in mrv
l = [mrv(a, x) for a in e.args]
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/gruntz.py", line 306, in <listcomp>
l = [mrv(a, x) for a in e.args]
File "/Users/aaronmeurer/Documents/Python/sympy/sympy/./sympy/series/gruntz.py", line 318, in mrv
raise NotImplementedError(
NotImplementedError: Don't know how to calculate the mrv of '(log(1/_p)/(_p**a*a) - 1/(_p**a*a**2), Ne(a, 0))' This this is an instance of the problem described here #13312. If Although in this case, it also looks like it is trying to handle the ExprCondPair from the Piecewise, so for this to work, Gruntz would need to be fixed to be able to handle Piecewise correctly as well. In any case, manually setting the assumptions on |
Wow, great tricks! Thanks |
It seems we would need to implement an |
Doing that without actual support in the algorithm for splitting symbolic constants into piecewise components would lead to the same problems if the piecewise conditions themselves contain symbolic constants (so that the condition containing the point x0 depends on their value). |
Or alternatively if the point x0 itself is symbolic. |
Sympy is unable to integrate this equation
The output from WolframAlpha is
Any idea why Sympy couldn't do it?
The text was updated successfully, but these errors were encountered: