def canonical_piecewise_quadratic_interpolation(x, nodal_vals):
    """
    Piecewise quadratic interpolation of nodes at [0,0.5,1]
    Assumes all values are in [0,1]. 
    """
    assert x.ndim == 1
    assert nodal_vals.shape[0] == 3
    vals = nodal_vals[0] * (1.0 - 3.0 * x + 2.0 * x ** 2) + nodal_vals[1] * (
        4.0 * x - 4.0 * x ** 2) + nodal_vals[2] * (-x + 2.0 * x ** 2)
    return vals
