def midpointint(f,a,b,n):
    """
    Computes the midpoint rule
    """
    s = 0
    h = (b-a) / float(n)
    sum_array = []
    for i in range(1,n):
        s += f(a-0.5*h+i*h)
        sum_array.append(f(a-0.5*h+i*h))
    s *= (b-a)/float(n)
    return s, sum_array