def trapzint(f, a, b, n):
    """Estimates integral by the construction of n evenly spaced trapezoids on the interval [a, b]"""
    h = (b-a) / float(n)
    sum = 0
    for i in range(n):
        #h serves double duty as both the x-distance width and the x-distance increment
        sum = sum + (1.0/2)*h*(f(a + h*i) + f(a + h*(i + 1)))
    return sum