Your program: def romberg(f, a, b, n): '''Estimate the integral of a function f between a and b using n levels using Romberg integration (n = jmax+1). If n > 1, estimate the fractional error based on the two most accurate estimates. For example, I, err = romberg(lambda x: 1/x, 1, 2, 3) should return I = 0.69317, err = 1.1E-4'''