
function val = poly_val(x0, x, coef)

    val = coef(1);
    for jj = 2:length(coef)
        tmp = 1.0;
        for kk = 1:jj-1
            tmp = tmp * ( x0 - x(kk) );
        end
        val = val + coef(jj) * tmp;
    end
