Can anyone explain how numpy's trapezoidal rule works.
x = [[0,1,2], [1,2,3]]
y = [[0,1,2], [1,1,2], [1,1,2]]
np.trapz(y, x, axis = 0)
Gives:
array([1.5, 2. , 4. ])
when the rows are not equal.
I can understand why this might work:
x = [0,1,2]
np.trapz(y, x, axis = 0)
But I don't understand why this does either:
x = [0, 1]
np.trapz(y, x, axis = 0)