CaratheodoryFejerApprox.RationalApproximant
— Typestruct RationalApproximant{T <: AbstractFloat}
A simple wrapper type representing a rational approximant on an interval. Numerator and denominator coefficients are stored in the Chebyshev basis. Coefficients can be extracted in the Chebyshev basis using chebcoeffs
or in the monomial basis using monocoeffs
. For convenience the approximant is also callable, evaluating the rational approximant p(x) / q(x)
given x
.
CaratheodoryFejerApprox.chebcoeffs
— Functionchebcoeffs(res::RationalApproximant{T}) -> NTuple{2, Vector{T}}
Extract polynomial coefficients of a RationalApproximant
in the Chebyshev basis.
The Chebyshev coefficients always correspond to the linearly transplanted function g(t) = f((x - mid) / rad)
used internally; they are not transplanted to dom
.
CaratheodoryFejerApprox.minimax
— Functionminimax(f, m::Int, n::Int) -> RationalApproximant{Float64}
minimax(f, dom::NTuple{2, T}, m::Int, n::Int) -> RationalApproximant{T}
Compute the type (m, n)
CF approximant and then, if necessary, fine-tune the approximant to become a true minimax approximant using the Remez algorithm. If not specified, dom
defaults to (-1.0, 1.0)
.
CaratheodoryFejerApprox.monocoeffs
— Functionmonocoeffs(res::RationalApproximant{T}; transplant = true) -> NTuple{2, Vector{T}}
monocoeffs(res::RationalApproximant{T1}, ::Type{T2} = BigFloat; transplant = true) -> NTuple{2, Vector{T1}}
Extract polynomial coefficients of a RationalApproximant
in the monomial basis.
Because converting to monomial coefficients can be numerically unstable, optionally pass a higher precision type to monocoeffs
for intermediate computations.
When transplant = true
(the default), the monomial coefficients correspond to the original function f(x)
on the interval dom
. When transplant = false
, the coefficients correspond to the linearly transplanted function g(t) = f((x - mid) / rad)
where mid
and rad
are the midpoint and radius of dom
and -1 <= t <= 1
.
Note that, particularly when |mid|
is large, it can be much more numerically stable to evaluate the approximant via evalpoly(t, p)
using the non-transplanted coefficients p
and t = (x - mid) / rad
.
CaratheodoryFejerApprox.polynomialcf
— Functionpolynomialcf(f, m::Int) -> RationalApproximant{Float64}
polynomialcf(f, dom::NTuple{2, T}, m::Int) -> RationalApproximant{T}
Approximate a function f
with a degree m
polynomial CF approximant on the interval dom
. If not specified, dom
defaults to (-1.0, 1.0)
.
CaratheodoryFejerApprox.rationalcf
— Functionrationalcf(f, m::Int, n::Int) -> RationalApproximant{Float64}
rationalcf(f, dom::NTuple{2, T}, m::Int, n::Int) -> RationalApproximant{T}
Approximate a function f
with a type (m, n)
rational CF approximant on the interval dom
, where m
is the numerator degree and n
is the denominator degree. If not specified, dom
defaults to (-1.0, 1.0)
.