lagrange interpolation implement