[Scipy-tickets] [SciPy] #1324: scipy.integrate.romberg fails for array-valued functions.

SciPy Trac scipy-tickets@scipy....
Fri Nov 5 16:15:27 CDT 2010

#1324: scipy.integrate.romberg fails for array-valued functions.
 Reporter:  cgranade  |       Owner:  somebody
     Type:  defect    |      Status:  new     
 Priority:  normal    |   Milestone:  0.9.0   
Component:  Other     |     Version:  0.7.0   
 Keywords:            |  
 I have a function that accepts a scalar and returns a 2D array, and upon
 trying to integrate using
 scipy.integrate.romberg], I get a ValueError:

 Traceback (most recent call last):
   File "wqc.py", line 148, in <module>
     H_cycle = (m.pi / wt) * scipy.integrate.romberg(H_if, 0, m.pi / wt)
   File "/usr/lib/python2.6/site-packages/scipy/integrate/quadrature.py",
 line 471, in romberg
     while (abs(result - lastresult) > tol) and (i <= divmax):
 ValueError: The truth value of an array with more than one element is
 ambiguous. Use a.any() or a.all()

 Would changing quadrature.py to use array.all() be an appropriate fix?

Ticket URL: <http://projects.scipy.org/scipy/ticket/1324>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list