def L_k(x, k, xp, yp):
    """
    Evaluates (5.22)
    """
    product = 1.0
    for i, elem_x in enumerate(xp):
        if(i == k):
            continue
        product *= (float((x - elem_x)) / float((xp[k] - elem_x)))
    return product