This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts

articleAINumerics

The Runge phenomenon, where more points give a worse fit

Interpolate by a polynomial through equally spaced points and the error grows as you add points. Move the same number of points to and it falls geometrically, at a rate you can work out from where the function's poles are.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

The function has poles at . Polynomial interpolation in Chebyshev points converges like , where is the size of the largest ellipse with foci that the function is analytic inside. The ellipse through has . Both interpolants use the barycentric formula, which is stable in Chebyshev points. With equally spaced points the problem is ill-conditioned (its Lebesgue constant grows exponentially with ), and this formula adds rounding error of its own.

Printed

equi_10: 1.91561
equi_20: 59.8221
cheb_20: 0.0177266
cheb_40: 0.000338655
rate: 1.21883
predicted_rate: 1.2198
Interpolating 1/(1+25x2) at 21 points
1/(1+25x2)equally spacedChebyshev
00.51.0−1.0−0.500.51.0xinterpolant

Tests 3 of 3 pass

  • with equally spaced points, doubling them makes the error more than thirty times larger (passes)
  • with Chebyshev points the same 21 are good to two percent (passes)
  • and the error falls like rho^-n, with rho set by the poles at +-i/5 (passes)

Checked when the site was built: 3 of 3 tests passed, in 0.12 s. Download 2026-09-21-runge-phenomenon.viv