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 rule.
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 the
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
modification (correction?) to let it accept a vector x for integration along
any axis:
def
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 pyshell#4, line 1, in module
מקורית-
מאת: [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
import numpy as np
np
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