Chebyshev Approximation Polynomial
Source inspiration: (Mathew 2000-2019).
Description
A Chebyshev approximation polynomial approximates a function \(f\) on an interval \([a,b]\) by the polynomial \(P_{n-1}\) of degree at most \(n-1\) that interpolates \(f\) at \(n\) Chebyshev nodes, \(P_{n-1}(x_k)=f(x_k)\). Chebyshev-node interpolation uses clustered nodes near interval endpoints to reduce oscillation compared with equally spaced interpolation at the same degree. This is why Chebyshev-based polynomial approximation is a standard remedy for Runge-type endpoint blow-up.
On an interval \([a,b]\), the \(n\) Chebyshev nodes are the roots \(t_k=\cos\bigl((2k-1)\pi/(2n)\bigr)\) of the Chebyshev polynomial \(T_n(t)=\cos(n\arccos t)\), mapped from \([-1,1]\) to \([a,b]\):
\[ x_k = \frac{a+b}{2} + \frac{b-a}{2}\cos\!\left(\frac{(2k-1)\pi}{2n}\right),\qquad k=1,\ldots,n. \]
Mathews writes the interpolant as a sum of Chebyshev polynomials in \(t\), where \(x=\frac{a+b}{2}+\frac{b-a}{2}t\), with coefficients computed from the node values:
\[ P_{n-1}(x)=\sum_{j=0}^{n-1}c_j\,T_j(t),\qquad c_0=\frac1n\sum_{k=1}^{n}f(x_k),\qquad c_j=\frac2n\sum_{k=1}^{n}f(x_k)\cos\!\left(\frac{j(2k-1)\pi}{2n}\right). \]
The animations evaluate the same polynomial in barycentric Lagrange form.
Building \(P_{n-1}\) needs only the values \(f(x_k)\). The error bound needs more: in general, Mathews’ Lagrange–Chebyshev theorem states that if \(f\in C^{n}[a,b]\), then for every \(x\in[a,b]\)
\[ |f(x)-P_{n-1}(x)| \le \frac{2\,(b-a)^{n}}{4^{n}\,n!}\max_{a\le x\le b}\bigl|f^{(n)}(x)\bigr|. \]
Its factor \(2(b-a)^n/4^n\) is the largest value of \(\bigl|\prod_{k=1}^{n}(x-x_k)\bigr|\) on \([a,b]\), and no other choice of \(n\) nodes in \([a,b]\) makes that largest value smaller; for 16 nodes on \([-1,1]\), equally spaced nodes make it 44 times larger. For \(e^x\) on \([-2,3]\) (Case 15), the largest error with 16 nodes is \(7.1\times10^{-12}\), within the bound’s \(6.8\times10^{-11}\). For \(1/(1+10x^2)\) on \([-1,1]\) (Case 08), the error falls by a factor of about 3.47 for every four nodes added, from \(1.4\times10^{-2}\) at 16 nodes to \(9.5\times10^{-5}\) at 32, while 16 equally spaced nodes leave an error of 0.48. There the bound misleads: it is about 3050 at 16 nodes and grows with \(n\), so it says nothing although the error shrinks.
Two failures matter in the cases below. The bound covers only \([a,b]\): beyond it the interpolant is extrapolation and leaves \(f\) quickly, as in Case 04, where 16 nodes on \([0,2]\) give \(P_{15}(3)\approx 5.0\times10^{4}\) against \(\sqrt3\approx1.73\). And when \(f\) has an infinite derivative at an endpoint, the theorem does not apply and convergence is slow: for \(\sqrt{x}\) on \([0,2]\) (Case 04) and \(\arcsin x\) on \([-1,1]\) (Case 19), the largest error sits at an endpoint and only halves when the number of nodes doubles from 8 to 16.
The same interpolation with equally spaced nodes is on the Lagrange and Newton pages, and Newton’s Case 08 shows the Runge oscillation of \(1/(1+10x^2)\); Rational Approximation also uses Chebyshev nodes, and Least-Squares Polynomials and Legendre Polynomials fit by least squares instead.
Animations
Each animation steps through 2, 3, 4, 5, 6, 8, 10, 12, 14 and 16 Chebyshev nodes (case 08 continues to 20, 24, 28 and 32) for a fixed function and approximation interval. With \(n\) nodes the interpolant has degree at most \(n-1\); for an even function on a symmetric interval and even \(n\) it is at most \(n-2\). Green dashed vertical lines mark the ends of the approximation interval. Outside them the blue curve is extrapolation and can leave the frame; with 8 or fewer nodes its overshoot can also leave the frame inside the interval (cases 08, 12, 13, 22, 23 and 27).
Case 01

Case 02

Case 03

Case 04

Case 05

Case 06

Case 07

Case 08

Case 09

Case 10

Case 11

Case 12

Case 13

Case 14

Case 15

Case 16

Case 17

Case 18

Case 19

Case 20

Case 21

Case 22

Case 23

Case 24

Case 25

Case 26

Case 27

Case 28

Case 29
