Re: [Numpy-discussion] A correction to numpy trapz function

2008-07-12 Thread Charles R Harris
On Sat, Jul 12, 2008 at 10:30 PM, Nadav Horesh <[EMAIL PROTECTED]> wrote: > 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

Re: [Numpy-discussion] A correction to numpy trapz function

2008-07-12 Thread Nadav Horesh
ace lift. Nadav. -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם Ryan May נשלח: ש 12-יולי-08 22:24 אל: Discussion of Numerical Python נושא: Re: [Numpy-discussion] A correction to numpy trapz function Nadav Horesh wrote: > Here is what I get with the orriginal trapz function: > > IDLE 1.2.2

Re: [Numpy-discussion] A correction to numpy trapz function

2008-07-12 Thread Ryan May
Nadav Horesh wrote: > Here is what I get with the orriginal trapz function: > > IDLE 1.2.2 import numpy as np np.__version__ > '1.1.0' y = np.arange(24).reshape(6,4) x = np.arange(6) np.trapz(y, x, axis=0) > > Traceback (most recent call last): > File "", line 1,

Re: [Numpy-discussion] A correction to numpy trapz function

2008-07-12 Thread Nadav Horesh
; Nadav. -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם Ryan May נשלח: ש 12-יולי-08 18:31 אל: Discussion of Numerical Python נושא: Re: [Numpy-discussion] A correction to numpy trapz function Nadav Horesh wrote: > The function trapz accepts x axis vector only for axis=-1. Here is my >

Re: [Numpy-discussion] A correction to numpy trapz function

2008-07-12 Thread Ryan May
Nadav Horesh wrote: > The function trapz accepts x axis vector only for axis=-1. Here is my > modification (correction?) to let it accept a vector x for integration along > any axis: > > def trapz(y, x=None, dx=1.0, axis=-1): > """ > Integrate y(x) using samples along the given axis and

[Numpy-discussion] A correction to numpy trapz function

2008-07-12 Thread Nadav Horesh
The function trapz accepts x axis vector only for axis=-1. Here is my modification (correction?) to let it accept a vector x for integration along any axis: def trapz(y, x=None, dx=1.0, axis=-1): """ Integrate y(x) using samples along the given axis and the composite trapezoidal rul