trapz takes (y,x) not (x,y)