# Tabulated grid points for function sin(x)
x <- seq(0,3*pi/2,length=20)
f <- sin(x)
# Grid of interpolated points
x0 <- seq(0,3*pi/2,length=200)
# Interpolation using all 20 tabulated points
ltmp <- polydivdif(x0,x,f)
plot(ltmp$x,ltmp$f,pch=16)
points(x0,ltmp$f0,type="l")
# Interpolation using only five points (dangerous!)
ltmp <- polydivdif(x0,x,f,np=5)
points(ltmp$x,ltmp$f,col=2,cex=1.5)
points(x0,ltmp$f0,type="l",col=2)
Run the code above in your browser using DataLab