lxvm / HChebInterp.jl

Multi-dimensional h-adaptive Chebyshev interpolation
MIT License
3 stars 1 forks source link

HChebInterp.jl

Documentation Build Status Coverage Version
ver-img
deps-img

This package provides multi-dimensional h-adaptive Chebyshev interpolation with the routine hchebinterp. The routine uses a Chebyshev basis to construct a piecewise polynomial interpolant of an arbitrary smooth function. It depends on FastChebInterp.jl and is inspired by Chebfun.

Usage

To construct a polynomial interpolant p of the function f on the interval [a,b] to a user-specified tolerance can be done with the interface

using HChebInterp
f(x) = sin(exp(x^2))
p = hchebinterp(f, 0, 1; atol=1e-5)

Then p can be evaluated using its functor interface at any point in the interpolation interval, e.g p(0.5).

The same routine also supports interpolation of multidimensional functions, though note that the function must accept SVector inputs. For example, a 2d function can be interpolated as follows:

g(x) = cis(prod(x))
p = hchebinterp(g, (0,0), (1,1); atol=1e-5)

with evaluation at points in the support of the interpolant like p([0.1, 0.4]).

The package can interpolate any numeric or array-valued types. It also supports a batching interface. See the documentation linked above for details.

Algorithm

The algorithm of hchebinterp is based on the one described by Kaye et al., (2023)

Author and Copyright

HChebInterp.jl was written by Lorenzo Van Muñoz, and is free/open-source software under the MIT license.

Related packages