fhappx: Floater-Hormann interpolation on a grid

Description Usage Arguments Details Value Examples

View source: R/floater-hormann.R

Description

The Floater-Hormann interpolation.

Usage

1

Arguments

...

Further arguments to the function, if is.function(val).

val

array or function. Function values on a grid, or the function itself. If it is the values, the dim-attribute must be appropriately set.

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.

Details

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.

Value

A function(x) defined on the hypercube, approximating the given function. The interpolant function uses the barycentric Floater-Hormann interpolation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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)

sgaure/chebpol documentation built on Dec. 16, 2019, 9:40 p.m.