def midpointint(f,a,b,n):
    """This function takes in a function and 3 integer parameters representing
    an interval and the number of subintervals to be made in that interval 
    and returns the approximate value of the integral of the given function 
    in the given interval """
    
    h = (b-a)/float(n)
    s = 0.0
    for i in range (n+1):
        s += f(a - (1.0/2)*h + i*h)
        
    midpoint = h*s
    return midpoint