error: Argument order of trapz integration function was the wrong way around. trapz expects y to be the first and x to be the second argument. Fix: Swap x and y.