在此
上提交了问题https://github.com/sympy/sympy/issues/12994如何避免/解决此错误?
>python
Python 3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
>>> from sympy import *
>>> x,n,a=symbols('x n a')
>>> integrand=x**n*ln(a*x)
>>> anti=integrate(integrand,x)
>>> anti
Piecewise((None, Eq(n, -1)), (n*x*x**n*log(a)/(n**2 + 2*n + 1) +
n*x*x**n*log(x)/(n**2 + 2*n + 1) + x*x**n*log(a)/(n**2 + 2*n + 1) +
x*x**n*log(x)/(n**2 + 2*n + 1) - x*x**n/(n**2 + 2*n + 1), True))
>>> leafCount = count_ops(anti)
给出
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/core/function.py", line 2473, in count_ops
if a.is_Rational:
AttributeError: 'NoneType' object has no attribute 'is_Rational'
count_ops()
应该像这样失败吗?用户应该做什么?