from scipy import linalg
from scipy.integrate import quad
import numpy as np
a = integrate.quad(lambda x: x**2, 0, 4.5)
print(a)
AttributeError Traceback (most recent call last)
<ipython-input-132-c7f6592004af> in <module>()
2 from scipy.integrate import quad
3 import numpy as np
----> 4 a = integrate.quad(lambda x: x**2, 0, 4.5)
5
6
AttributeError: 'function' object has no attribute 'quad'
我不知道会发生什么,有人可以帮助我吗?谢谢!
解决方法:
代码导入quad;您不需要限定它:
from scipy.integrate import quad # <----
....
a = quad(lambda x: x**2, 0, 4.5)