You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to find simple pole expansion that maintains high acuracy? #21
The script below builds a AAA approximation with very high accuracy. Great!
using LinearAlgebra
using RationalFunctionApproximation
import DoubleFloats: Double64
import ComplexRegions: Segment
f(x) =1/ (1+exp(1_000* x))
bounds = (-10, 10)
segment =Segment{Double64}(bounds...)
# Large refinement and stagnation seem to be required. Are there heuristics# to pick them or to otherwise mark the near-singular point at x=0?
r =approximate(f, segment, refinement=100, stagnation=100, tol=1e-10)
xs =range(bounds..., length=10_000)
norm(r.(xs) -f.(xs), Inf) # 5.9e-11
My ultimate goal is to find poles/residues for a simple pole expansion that maintains this high level of accuracy. Unfortunately, when I try to get that with residues(r) plus an inferred constant shift, there is significant degradation in accuracy (several orders of magnitude).
With the hope of recovering that lost accuracy, I tried building a continued fraction approximation using fixed poles. When f(x) is not too singular, the procedure can work well. However, in this example:
Here the error depends sensitively on the choice of init. The best I could achieve is order 1e-6, which is far worse than the 1e-10 achieved by AAA. Pushing the init value past a threshold generates a BoundsError.
Is there a way to get a simple pole expansion that keeps the high accuracy of the original barycentric approximation?
Another curious phenomenon is that if I rescale x as it appears in both f and bounds, I can get an overall much better approximation. Specifically, the alternative definitions,
changed the title [-]How to achieve high acuracy when approximating with fixed poles?[/-][+]How to find simple pole expansion that maintains high acuracy?[/+]on Dec 16, 2025
That's a great catch, thanks. There is still a deeper issue that the eigenvalue problem is not scale-invariant for nodes and values. Pending any mathematical insight to that problem, I may add one or two Newton iterations to the roots and poles methods to improve the accuracy in such cases.
That’s great! Looking forward to the next release.
Regarding the broken scale invariance — are there any hidden parameters in the algorithm that are implicitly assuming that the size of the domain is order 1? If so, they could be rescaled according to some characteristic size of the domain.
Activity
[-]How to achieve high acuracy when approximating with fixed poles?[/-][+]How to find simple pole expansion that maintains high acuracy?[/+]kbarros commentedon Dec 17, 2025
I isolated the numerical stability problem to the "catch" fallback in the poles calculation:
RationalFunctionApproximation.jl/src/barycentric.jl
Lines 211 to 217 in f2878f5
Instead of
eigvals(E\B), this is much more stable:With this change, I'm able to extract good
residues(r)from the original barycentric approximation atDouble64precision. Here is the test case:tobydriscoll commentedon Dec 30, 2025
That's a great catch, thanks. There is still a deeper issue that the eigenvalue problem is not scale-invariant for nodes and values. Pending any mathematical insight to that problem, I may add one or two Newton iterations to the roots and poles methods to improve the accuracy in such cases.
kbarros commentedon Dec 31, 2025
That’s great! Looking forward to the next release.
Regarding the broken scale invariance — are there any hidden parameters in the algorithm that are implicitly assuming that the size of the domain is order 1? If so, they could be rescaled according to some characteristic size of the domain.