0

When I try to execute the following code from SciPy documentation in Canopy(Enthought Inc):

from scipy import integrate
import numpy as np
N = 5
def f(t, x):
    return np.exp(-x*t) / t**N
print integrate.nquad(f, [[1, np.inf],[0, np.inf]])

I get the following error:

      4 def f(t, x):
      5     return np.exp(-x*t) / t**N
----> 6 print integrate.nquad(f, [[1, np.inf],[0, np.inf]])

AttributeError: 'module' object has no attribute 'nquad'

Is the included SciPy package has a problem? Reinstalling the Canopy/Scipy didn't solve the problem.

Cupitor
  • 11,007
  • 19
  • 65
  • 91
  • 1
    It looks like the `nquad` function was first added in Scipy version `0.13.0 beta1`, and Canopy uses version `0.12.0`. You should probably look into upgrading your scipy distribution. – Michael0x2a Oct 29 '13 at 15:10
  • Oh I see! But they don't provide it with the package manager. And probably that is not a good idea to manually add it to Canopy I think. – Cupitor Oct 29 '13 at 15:19
  • 1
    To avoid issues like this, it's a good idea to read the documentation corresponding to the version of the installed library. The documentation for all versions can be found here: http://docs.scipy.org/doc/ – pv. Oct 29 '13 at 15:30

0 Answers0