def l2_projection(f, basis, lim):
    r = 0
    for b in basis:
        r += l2_inner_product(f, b, lim) * b
    return r
L2 projects the function f on the basis over the domain lim.
dataset/ETHPy150Open sympy/sympy/examples/advanced/gibbs_phenomenon.py/l2_projection