def def_integral(func, a, b, n):
    """Approximates the definite integral of a function over the interval
    [a, b] via Riemann sums."""
    delta_x = (b - a) / n
    c = a
    total = 0
    for i in range(n + 1):
        total += func(c) * delta_x
        c += delta_x
    return total