Last chance! 50% off unlimited learning
Sale ends in
# 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)
# }
Run the code above in your browser using DataLab