def IntegrateLambdaOrRho(terms):
    """
    IntegrateLambdaOrRho(terms):
    terms:   A hash table containing lambda or rho coefficients.
             For example, if lambda(x) = .4 x^2 + .6 x^3, then
             the input would be {2:.4, 3:.6}.
    Returns  The integral of the argument from 0 to 1.
    """
    sum = 0
    total = 0
    for i in terms.keys():
        sum = sum + terms[i]
        total = total + terms[i]/float(i)
    assert(abs(sum-1.0) < .0001)
    return total