[SciPy-user] Prob with romberg integration?

Neal Becker ndbecker2 at gmail.com
Thu Oct 12 13:49:17 CDT 2006

This is scipy-0.5.1:
from scipy.integrate import romberg
from math import sqrt, log, exp

def F (x):
    return x

def G (v):
    return exp (v) * F (exp (v))

gain = 1/sqrt (2*romberg (G, log (1e-7), log (0.5)))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/tmp/python-MSHhoK.py", line 11, in ?
    gain = 1/sqrt (2*romberg (G, log (1e-7), log (0.5)))
  File "/usr/lib64/python2.4/site-packages/scipy/integrate/quadrature.py", line 377, in romberg
    ordsum = ordsum + _difftrap(vfunc, interval, n)
  File "/usr/lib64/python2.4/site-packages/scipy/integrate/quadrature.py", line 326, in _difftrap
    s = sum(function(points),0)
  File "/usr/lib64/python2.4/site-packages/scipy/integrate/quadrature.py", line 54, in vfunc
    output = empty((n,), dtype=y0.dtype)
AttributeError: 'float' object has no attribute 'dtype'

More information about the SciPy-user mailing list