| fhappx {chebpol} | R Documentation |
The Floater-Hormann interpolation.
fhappx(...)
... |
Further arguments to the function, if |
val |
array or function. Function values on a grid, or the function
itself. If it is the values, the |
grid |
list. Each element is a vector of ordered grid-points for a dimension. These need not be Chebyshev-knots, nor evenly spaced. |
d |
integer. The degree of the blending polynomial. |
A call fun <- fhappx(val,grid) creates a Floater-Hormann rational
interpolant function fun on the grid. The degree of the blending
polynomial,d, can be a vector, different for each grid-dimension. In
theory, d can be any integer between 0 and the grid-dimension, a
higher d yields a smoother fit. However, increasing d leads to
exponential growth in rounding errors, so there is a tradeoff somewhere
which depends on the analyticity of the function, and not in an obvious way.
Current recommendations is to start low, at 3 or 4, and increase if
necessary.
If val is a function it will be evaluated on the grid.
A function(x) defined on the hypercube, approximating the
given function. The interpolant function uses the barycentric
Floater-Hormann interpolation.
## Not run: ## evenly spaced grid-points su <- seq(0,1,length.out=10) ## irregularly spaced grid-points s <- su^3 ## create approximation on the irregularly spaced grid fh1 <- fhappx(exp,grid=list(s)) ## test it fh1(su) - exp(su) ## two dimensional approximation f <- function(x) exp(sum(x^2)) grid <- list(s,su) fh2 <- fhappx(evalongrid(f,grid=grid),grid=grid) # an equivalent would be fh2 <- fhappx(f,grid) a <- runif(2); fh2(a); f(a) ## End(Not run)