提交的问题https://github.com/sympy/sympy/issues/12993
这是一个错误吗?为什么会产生此错误?
>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
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import *
>>> A,B,y=symbols('A B y')
>>> integrate(-(A**2+B**2*(-y**2+1))**(1/2)/(-y**2+1),y)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/integrals.py", line 1295, in integrate
risch=risch, manual=manual)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/integrals.py", line 486, in doit
conds=conds)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/integrals.py", line 919, in _eval_integral
result = manualintegrate(g, x)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/manualintegrate.py", line 1223, in manualintegrate
return _manualintegrate(integral_steps(f, var))
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/manualintegrate.py", line 1013, in integral_steps
fallback_rule)(integral)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 85, in do_one_rl
result = rl(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 85, in do_one_rl
result = rl(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 65, in null_safe_rl
result = rule(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/manualintegrate.py", line 212, in _alternatives
result = rule(integral)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 33, in conditioned_rl
return rule(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/manualintegrate.py", line 176, in _rewriter
substep = integral_steps(rewritten, symbol)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/manualintegrate.py", line 1013, in integral_steps
fallback_rule)(integral)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 85, in do_one_rl
result = rl(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 65, in null_safe_rl
result = rule(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 95, in switch_rl
return rl(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 85, in do_one_rl
result = rl(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 65, in null_safe_rl
result = rule(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/manualintegrate.py", line 335, in mul_rule
next_step = integral_steps(f, symbol)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/manualintegrate.py", line 1013, in integral_steps
fallback_rule)(integral)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 85, in do_one_rl
result = rl(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 85, in do_one_rl
result = rl(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/strategies/core.py", line 65, in null_safe_rl
result = rule(expr)
File "/home/me/anaconda3/lib/python3.6/site-packages/sympy/integrals/manualintegrate.py", line 743, in trig_substitution_rule
a = match[a]
TypeError: 'NoneType' object is not subscriptable
>>>
有趣的是,如果我再次发出相同的命令,则错误不会显示
>>> integrate(-(A**2+B**2*(-y**2+1))**(1/2)/(-y**2+1),y)
Integral((A**2 - B**2*y**2 + B**2)**0.5/((y - 1)*(y + 1)), y)
它仅在第一次使用时出现!它看起来像第一次使用它将内容加载到内存中,因此下次错误不会显示出来。
知道发生了什么事吗?