I have the following triple integral:
the data are: t 1D array(size 124) , pr 1D array(size 10), lat 1D array(241) and lon 1D array(size 480) V 4D array (124, 10, 241, 480)
I want to integrate v over t, pr and lon at each lat So, I used the following code:
def M(T, lam, P, V, phi):
return integrate.tplquad(V*R*np.cos(phi), 0, T,
lambda T: 0, lambda T: lam,
lambda T,lam: 0, lambda T,lam: P)[0]
for i in range(lat.shape[0]):
a = M(t, lon, pr, v[:, :, i, :], lat[i])
But I got error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
How tplquad works is still confusing for me. Any help with doing the integral with tplquad or other functions?