# Tabulated values: f(x)=x^3-4x^2+3x+2
x <- c(-1,1,2,4)
f <- c(-6,2,0,14)
# Matrix filled with divided differences and zeros
P <- divdif(x,f)
print(P)
# Add two tabulated points to previous set
x <- c(x,0,3)
f <- c(f,2,2)
# New divided differences appear, but
# the old ones are unchanged
P <- divdif(x,f)
print(P)
Run the code above in your browser using DataLab