[Numpy-discussion] A correction to numpy trapz function

Charles R Harris charlesr.harris@gmail....
Sun Jul 13 00:49:06 CDT 2008

On Sat, Jul 12, 2008 at 10:30 PM, Nadav Horesh <nadavh@visionsense.com>

> I am aware that the error is related to the broadcasting, and that it can
> be solved by matching the shape of x to that of y --- this is how I solved
> it in the first place. I was thinking that the function "promises" to
> integrate over an array given a x vector and the axis, so let obscure the
> broadcasting rules and just enable it to do the work. There is a reason to
> leave trapz as it is (or even drop it) since numpy should stay as close as
> possible to "bare metal", but this function is borrowed also by scipy
> integration package, thus I rather give it a face lift.

I think you can pretty much borrow the average function to do this, all you
need to do is generate the proper weights and scaling. It's in

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080712/8c085502/attachment.html 

More information about the Numpy-discussion mailing list