# AI generated code
def trapezoidal_ai(func, a, b, Np):
    """
    Numerical integration using the trapezoidal rule.

    Parameters:
    func: function to integrate
    a: lower limit of integration
    b: upper limit of integration
    Np: number of points (intervals = Np - 1)

    Returns:
    Approximation of the integral
    """
    # Calculate step size
    h = (b - a) / (Np - 1)

    # Evaluate function at endpoints
    integral = 0.5 * (func(a) + func(b))

    # Sum the interior points
    for i in range(1, Np - 1):
        x = a + i * h
        integral += func(x)

    # Multiply by step size
    integral *= h

    return integral
