BaryRational.aaaMethod

aaa rational approximation of data F on set Z r = aaa(Z, F; tol=1e-13, mmax=100, verbose=false, clean=true, do_sort=false)

Input: Z = vector of sample points F = vector of data values at the points in Z tol = relative tolerance tol, set to 1e-13 if omitted mmax: max type is (mmax-1, mmax-1), set to 100 if omitted verbose: print info while calculating default = false clean: detect and remove Froissart doublets default = true do_sort: sort the x values (and f) by ascending value default = false

Output: r = an AAA approximant as a callable struct with fields z, f, w = vectors of support pts, function values, weights errvec = vector of errors at each step

Note 1: Changes from matlab version: switched order of Z and F in function signature added verbose and clean boolean flags pol, res, zer = vectors of poles, residues, zeros are now only calculated on demand by calling prz(z::AAAapprox)

Note 2: This does (more or less) work with BigFloats. Caveats: since prz has not been made generic, you must set clean=false. Also, must set tol to a tiny BigFloat value rather than use the defaults.

using BaryRational
xrat = [-1//1:1//100:1//1;];
xbig = BigFloat.(xrat);
fbig = sin.(xbig);
sf = aaa(xbig, fbig, verbose=true, clean=false, tol=BigFloat(1/10^40));

julia @v1.10> sin(BigFloat(-1//3))
-0.3271946967961522441733440852676206060643014068937597915900562770705763744817618

julia @v1.10> sf(BigFloat(-1//3))
-0.3271946967961522441733440852676206060643014068937597915900562770705763744817662
BaryRational.baryMethod
bary(z, f, x, w)

evaluate f(z)

Arguments

  • z::T: the point at which to evaluate f
  • f::Vector{T}: vector of function values at x
  • x::Vector{T}: vector of eval locations of f (sorted)
  • w::Vector{T}: weights for locations x
BaryRational.chebptsMethod

Return the n + 1 chebychev points on the [-1, 1] interval

A shifted sin is used to make sure the points are symmetric

BaryRational.floater_weightsMethod
floater_weights(x, d=0)

Calculate the Floater-Hormann weights for grid x and mixing degree d. For many applications d = 3 or 4 works well.

if we had a regular grid the values would be...
x: points at which we have function values
d: mixing degree        weights
d = 0                 1,1,...,1,1  
d = 1               1,2,2,...,2,2,1
d = 2             1,3,4,4,...,4,4,3,1
d = 3           1,4,7,8,8,...,8,8,7,4,1
d = 4     1,5,11,15,16,16,...,16,16,15,11,5,1

But note, if you do have a regularly spaced grid, it is much better to call the floater_weights(n, order)