def riemann_sum(f, a, b, h):
    """Computes the integral of f in [a, b] with step size h."""

    assert h > 0, 'Step size must be a positive number!'
    s = 0
    x = a + h / 2
    while x < b:
        s += h * f(x)
        x += h
    return s