See Section 3 in integration.pdf for a start. There are two places in that code where I am stuck and need to debug. The first is in the integrate function that loops for accuracy - the output shows a Python error that needs to be tracked down. The second is in the commnted alternative to the trapezoid function, where I am trying to remove the inefficiency in trapezoid0 by calculating f(x) just once at each division point.