NLA-lib Explorer

Polynomial approximation and interpolation bounds

Approximation and interpolation estimates turn regularity of a function into quantitative polynomial error. They feed into matrix-function approximation and spectral filters.

Results

Theorem (Polynomial approximation of analytic functions on an interval).

On [a,b] with a<b, a compatible extension of the affine pullback of f, holomorphic and bounded by M on the open Bernstein ellipse, gives a polynomial of degree at most N with uniform error \frac{2M}{\rho^N(\rho-1)}\,. An affine-rescaling corollary of [Trefethen2019, Theorem 8.2], generalized to RCLike values. The polynomial is obtained from the canonical truncation, including N=0.

Lean statement and details
NLAlib.exists_degree_le_isUniformApproxOn_Icc_of_differentiableOn.{u_1} {𝕜 : Type u_1} [RCLike 𝕜]
  {f : ℝ → 𝕜} {F : ℂ → ℂ} {a b ρ M : ℝ} (hab : a < b) (hρ : 1 < ρ)
  (hFd : DifferentiableOn ℂ F (openBernsteinEllipse ρ))
  (hM : Metric.IsUniformApproxOn F (fun x ↦ 0) (openBernsteinEllipse ρ) M)
  (hExt :
    Set.EqOn (fun t ↦ RCLike.toComplex (f (((b - a) * t + b + a) / 2))) (fun t ↦ F ↑t)
      (Set.Icc (-1) 1))
  (N : ℕ) :
  ∃ p,
    p.degree ≤ ↑N ∧
      Metric.IsUniformApproxOn (fun x ↦ Polynomial.eval (↑x) p) f (Set.Icc a b)
        (2 * M / (ρ ^ N * (ρ - 1)))

Full source on GitHub

Copy link

Theorem (The best approximation interpolates).

for a < b, f continuous on [a, b] and p a best approximation of degree at most n, there are n + 1 distinct points of (a, b) at which p = f; p is the Lagrange interpolant of f there (Lagrange.eq_interpolate_of_eval_eq). [Trefethen2019, Ch. 10] (locator to check); there on [-1, 1].

Lean statement and details
NLAlib.exists_eval_eq_of_isUniformApproxOn_minimaxError {f : ℝ → ℝ} {a b : ℝ} (hab : a < b)
  (hf : ContinuousOn f (Set.Icc a b)) {n : ℕ} {p : Polynomial ℝ} (hp : p.degree ≤ ↑n)
  (hbest :
    Metric.IsUniformApproxOn (fun x ↦ Polynomial.eval x p) f (Set.Icc a b)
      (minimaxError f (Set.Icc a b) n)) :
  ∃ t, t.card = n + 1 ∧ ↑t ⊆ Set.Ioo a b ∧ ∀ x ∈ t, Polynomial.eval x p = f x

Full source on GitHub

Copy link

Theorem (A best approximation exists).

for s compact and f continuous on s there is a real polynomial p of degree at most n with \lvert f(x) - p(x) \rvert \le E_n(f; s) on s. This is how a bound stated for an arbitrary approximant is restated with E_n. [Trefethen2019, Theorem 10.1]; [Rivlin1981, Ch. 1] (locators to check); there on [-1, 1] or an interval, here on any compact set, the empty set included.

Lean statement and details
NLAlib.exists_degree_le_isUniformApproxOn_minimaxError {f : ℝ → ℝ} {s : Set ℝ} (hs : IsCompact s)
  (hf : ContinuousOn f s) (n : ℕ) :
  ∃ p,
    p.degree ≤ ↑n ∧ Metric.IsUniformApproxOn (fun x ↦ Polynomial.eval x p) f s (minimaxError f s n)

Full source on GitHub

Copy link

Theorem (Every best approximation is the chosen one).

for a < b, f continuous on [a, b] and p a real polynomial of degree at most n with \lvert f - p \rvert \le E_n(f; [a, b]) on [a, b], p = \mathrm{minimaxPoly}\ f\ [a, b]\ n. [Trefethen2019, Theorem 10.1].

Lean statement and details
NLAlib.eq_minimaxPoly_of_isUniformApproxOn_minimaxError {f : ℝ → ℝ} {a b : ℝ} (hab : a < b)
  (hf : ContinuousOn f (Set.Icc a b)) {n : ℕ} {p : Polynomial ℝ} (hp : p.degree ≤ ↑n)
  (hbest :
    Metric.IsUniformApproxOn (fun x ↦ Polynomial.eval x p) f (Set.Icc a b)
      (minimaxError f (Set.Icc a b) n)) :
  p = minimaxPoly f (Set.Icc a b) n

Full source on GitHub

Copy link

Theorem (Chebyshev coefficient decay for analytic functions).

A compatible extension holomorphic and bounded by M on the OPEN Bernstein ellipse gives \|a_k\|\le\frac{2M}{\rho^k}\quad(k>0). [Trefethen2019, Theorem 8.1], generalized to RCLike values via the compatible complex extension. The proof takes smaller radii up to \rho; no outer-boundary continuity is assumed. The zero coefficient has the more general bound norm_chebyshevCoeff_zero_le.

Lean statement and details
NLAlib.norm_chebyshevCoeff_le_of_differentiableOn.{u_1} {𝕜 : Type u_1} [RCLike 𝕜] {f : ℝ → 𝕜}
  {F : ℂ → ℂ} {ρ M : ℝ} (hρ : 1 < ρ) (hFd : DifferentiableOn ℂ F (openBernsteinEllipse ρ))
  (hM : Metric.IsUniformApproxOn F (fun x ↦ 0) (openBernsteinEllipse ρ) M)
  (hExt : Set.EqOn (fun x ↦ RCLike.toComplex (f x)) (fun x ↦ F ↑x) (Set.Icc (-1) 1)) {k : ℕ}
  (hk : 0 < k) : ‖chebyshevCoeff f k‖ ≤ 2 * M / ρ ^ k

Full source on GitHub

Copy link

Theorem (The minimax error of \mathbf{x}^{n + 1}).

on [-1, 1], the best approximation of x^{n + 1} by polynomials of degree at most n has error E_n(x^{n + 1}; [-1, 1]) = 2^{-n}, attained by x^{n + 1} - 2^{-n}T_{n + 1}; equivalently, 2^{-n}T_{n + 1} is the monic polynomial of degree n + 1 of least uniform norm on [-1, 1]. [GolubMeurant2010, §2.5.1, Theorem 2.15]; [Trefethen2019, Ch. 10].

Lean statement and details
NLAlib.minimaxError_pow_Icc_neg_one_one (n : ℕ) :
  minimaxError (fun x ↦ x ^ (n + 1)) (Set.Icc (-1) 1) n = (2 ^ n)⁻¹

Full source on GitHub

Copy link

Theorem (Chebyshev truncation reproduces polynomials).

Every polynomial of degree at most N is recovered by its degree-N Chebyshev truncation. This finite-basis consequence of [Trefethen2019, p. 16 and Exercise 3.7] is generalized to RCLike coefficients using Mathlib's polynomial-sequence span and Chebyshev orthogonality. It includes zero polynomials and N=0; polynomial continuity supplies integrability.

Lean statement and details
NLAlib.chebyshevTrunc_eval.{u_1} {𝕜 : Type u_1} [RCLike 𝕜] {p : Polynomial 𝕜} {N : ℕ}
  (hp : p.degree ≤ ↑N) : chebyshevTrunc (fun x ↦ Polynomial.eval (↑x) p) N = p

Full source on GitHub

Copy link

Theorem (De la Vallée Poussin's lower bound).

If \deg p \le n, p is within some finite \eta of f on s, and f - p alternates on s at n + 2 points with level \varepsilon, then \varepsilon \le E_n(f; s). The set s is arbitrary (a finite spectrum, a union of intervals); the finite \eta only excludes the junk value of minimaxError. [Rivlin1981, Ch. 1]; [Trefethen2019, Ch. 10] (locators to check).

Lean statement and details
NLAlib.AlternatesOn.le_minimaxError {f : ℝ → ℝ} {s : Set ℝ} {n : ℕ} {p : Polynomial ℝ} {ε : ℝ}
  (h : AlternatesOn (fun x ↦ f x - Polynomial.eval x p) s (n + 2) ε) (hp : p.degree ≤ ↑n) {η : ℝ}
  (hη : Metric.IsUniformApproxOn (fun x ↦ Polynomial.eval x p) f s η) : ε ≤ minimaxError f s n

Full source on GitHub

Copy link

Theorem (An equioscillating error is the minimax error).

if \deg p \le n, \lvert f - p \rvert \le \varepsilon on s and f - p alternates on s at n + 2 points with level \varepsilon, then E_n(f; s) = \varepsilon, and p is a best approximation. On any set, for any f: the certificate direction of the equioscillation theorem. [Trefethen2019, Theorem 10.1]; [Rivlin1981, Ch. 1] (locators to check).

Lean statement and details
NLAlib.AlternatesOn.minimaxError_eq {f : ℝ → ℝ} {s : Set ℝ} {n : ℕ} {p : Polynomial ℝ} {ε : ℝ}
  (h : AlternatesOn (fun x ↦ f x - Polynomial.eval x p) s (n + 2) ε) (hp : p.degree ≤ ↑n)
  (hε : Metric.IsUniformApproxOn (fun x ↦ Polynomial.eval x p) f s ε) : minimaxError f s n = ε

Full source on GitHub

Copy link

Theorem (The Hermite interpolation remainder).

let a < b, m a nonempty multiset of points of [a, b] with every point of multiplicity at least 2 in (a, b), f continuous on [a, b] and C^{\lvert m\rvert} on (a, b), and H a real polynomial of degree less than \lvert m\rvert with H^{(k)}(y) = f^{(k)}(y) for every y \in m and every k below the multiplicity of y. Then for every x \in [a, b] there is \xi \in (a, b) with f(x) - H(x) = \frac{f^{(\lvert m\rvert)}(\xi)}{\lvert m\rvert!}\prod_{y\in m}(x - y)\,. [Davis1975, Theorem 3.5.1]; [Gautschi2004, §1.4.2] (locators to check); there for distinct nodes of multiplicity at most 2 with \xi in the hull of the nodes and x; here any multiplicities, simple nodes allowed at the endpoints.

Lean statement and details
NLAlib.exists_sub_eval_eq_iteratedDeriv_mul {a b : ℝ} (hab : a < b) {m : Multiset ℝ} (hm : m ≠ 0)
  (hmem : ∀ y ∈ m, y ∈ Set.Icc a b) (hrep : ∀ y ∈ m, 1 < Multiset.count y m → y ∈ Set.Ioo a b)
  {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) (hf' : ContDiffOn ℝ (↑m.card) f (Set.Ioo a b))
  {H : Polynomial ℝ} (hH : H.degree < ↑m.card)
  (hjet :
    ∀ y ∈ m,
      ∀ k < Multiset.count y m,
        Polynomial.eval y ((⇑Polynomial.derivative)^[k] H) = iteratedDeriv k f y)
  {x : ℝ} (hx : x ∈ Set.Icc a b) :
  ∃ ξ ∈ Set.Ioo a b,
    f x - Polynomial.eval x H =
      iteratedDeriv m.card f ξ / ↑m.card.factorial *
        Polynomial.eval x (Multiset.map (fun y ↦ Polynomial.X - Polynomial.C y) m).prod

Full source on GitHub

Copy link

Theorem (Polynomial approximation of the inverse).

For 0<a<b, there is a polynomial of degree less than q such that \left\lvert p(x)-x^{-1}\right\rvert\le\frac2a \left(\frac{\sqrt b-\sqrt a}{\sqrt b+\sqrt a}\right)^q\quad(x\in[a,b]). This is a scalar inverse-approximation corollary of [Saad2003, Theorem 6.25 and proof of Theorem 6.29], obtained by factoring 1-r_q=Xp. The WithBot degree includes q=0: the zero polynomial has degree \bot<0, and error at most 1/a\le2/a.

Lean statement and details
NLAlib.exists_degree_lt_isUniformApproxOn_inv {a b : ℝ} (q : ℕ) (ha : 0 < a) (hab : a < b) :
  ∃ p,
    p.degree < ↑q ∧
      Metric.IsUniformApproxOn (fun x ↦ Polynomial.eval x p) (fun x ↦ x⁻¹) (Set.Icc a b)
        (2 / a * ((√b - √a) / (√b + √a)) ^ q)

Full source on GitHub

Copy link

Theorem (Jackson's theorem on an interval).

an L-Lipschitz f on [a, b], a < b, is within \frac{\pi L(b - a)}{2(N + 2)} of a polynomial of degree at most N on [a, b] (the constant is jacksonApproximationConstant). The affine image of isUniformApproxOn_jacksonApprox_of_lipschitz. [ChenTrogdonUbaru2022, Appendix C, Theorem 38]; there on [-1, 1] with the factor \pi^2/2.

Lean statement and details
NLAlib.exists_degree_le_isUniformApproxOn_Icc_of_lipschitzOnWith.{u_1} {𝕜 : Type u_1} [RCLike 𝕜]
  {f : ℝ → 𝕜} {L : ℝ≥0} {a b : ℝ} (hab : a < b) (hf : LipschitzOnWith L f (Set.Icc a b)) (N : ℕ) :
  ∃ p,
    p.degree ≤ ↑N ∧
      Metric.IsUniformApproxOn (fun x ↦ Polynomial.eval (↑x) p) f (Set.Icc a b)
        (jacksonApproximationConstant * ↑L * (b - a) / (2 * (↑N + 2)))

Full source on GitHub

Copy link

Theorem (Lagrange basis polynomials below relatively separated nodes).

let \lambda_0, \dots, \lambda_{t-1} be real nodes with \lambda_{k+1} \le (1 - \Delta)\lambda_k for k + 1 < t and some \Delta > 0, and let 0 \le x \le \lambda_k for every k (so the nodes are nonnegative and non-increasing, and x is at most the smallest). Then every Lagrange basis polynomial \ell_i(x) = \prod_{k \ne i}(x - \lambda_k)/(\lambda_i - \lambda_k) of the nodes has \lvert\ell_i(x)\rvert \le \Delta^{-(t-1)}\,. Each of the t - 1 factors is at most \Delta^{-1}: for k < i, \lvert x - \lambda_k\rvert \le \lambda_k and \lambda_k - \lambda_i \ge \Delta\lambda_k; for k > i, \lvert x - \lambda_k\rvert \le \lambda_{k-1} and \lambda_i - \lambda_k \ge \Delta\lambda_{k-1}. Positivity of the nodes is not assumed: where nodes coincide (necessarily at 0) the division convention a/0 = 0 makes the factor vanish. The exponent is in \mathbb{N}; for t = 0 there is no basis polynomial. [MeyerMuscoMusco2023, Theorem 3 (proof)], there for the squared head singular values of a positive semidefinite matrix, with the gap relative to the smaller of two consecutive singular values; constants differ.

Lean statement and details
NLAlib.abs_eval_basis_le_inv_pow {t : ℕ} {v : Fin t → ℝ} {Δ : ℝ} (hΔ : 0 < Δ)
  (hgap : ∀ (i j : Fin t), ↑i + 1 = ↑j → v j ≤ (1 - Δ) * v i) {x : ℝ} (hx0 : 0 ≤ x)
  (hx : ∀ (i : Fin t), x ≤ v i) (i : Fin t) :
  |Polynomial.eval x (Lagrange.basis Finset.univ v i)| ≤ Δ⁻¹ ^ (t - 1)

Full source on GitHub

Copy link

Theorem (The Lagrange interpolation remainder).

for a < b, a nonempty finite set s of nodes in [a, b], f continuous on [a, b] and C^{\lvert s\rvert} on (a, b), and every x \in [a, b], there is \xi \in (a, b) with f(x) - p_s(x) = \frac{f^{(\lvert s\rvert)}(\xi)}{\lvert s\rvert!}\prod_{y\in s}(x - y)\,, p_s the Lagrange interpolant of f at s (Mathlib's Lagrange.interpolate s id f). [Davis1975, Theorem 3.1.1]; [Trefethen2019, Ch. 11] (locators to check); there with \xi in the hull of s and x.

Lean statement and details
NLAlib.exists_sub_eval_interpolate_eq_iteratedDeriv_mul {a b : ℝ} (hab : a < b) {s : Finset ℝ}
  (hs : s.Nonempty) (hsab : ↑s ⊆ Set.Icc a b) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b))
  (hf' : ContDiffOn ℝ (↑s.card) f (Set.Ioo a b)) {x : ℝ} (hx : x ∈ Set.Icc a b) :
  ∃ ξ ∈ Set.Ioo a b,
    f x - Polynomial.eval x ((Lagrange.interpolate s id) f) =
      iteratedDeriv s.card f ξ / ↑s.card.factorial * Polynomial.eval x (Lagrange.nodal s id)

Full source on GitHub

Copy link

Theorem (Convergence of the perturbed Newton–Schulz iteration).

(Lemma 2.5): if 0 < \varepsilon \le 3/80, 10u \le \varepsilon, x_0 \ne 0 with 20u \le \lvert x_0 \rvert \le 3/2, and \lvert x_{k+1} - g(x_k) \rvert \le u for every k, then for every natural N \ge N(x_0, \varepsilon) (NLAlib.newtonSchulzSteps), \lvert 1 - x_N^2 \rvert \le \varepsilon \,. [Shah2024, Lemma 2.5]; there x_0 \ne 0 is implicit in u > 0.

Lean statement and details
NLAlib.abs_one_sub_sq_le_of_newtonSchulzSteps_le {u ε : ℝ} {x : ℕ → ℝ} (hε : 0 < ε)
  (hε₁ : 10 * u ≤ ε) (hε₂ : ε ≤ 3 / 80) (h₀ : 0 < |x 0|) (h₂₀ : 20 * u ≤ |x 0|)
  (hx₀ : |x 0| ≤ 3 / 2) (hstep : ∀ (k : ℕ), |x (k + 1) - newtonSchulz (x k)| ≤ u) {N : ℕ}
  (hN : newtonSchulzSteps (x 0) ε ≤ ↑N) : |1 - x N ^ 2| ≤ ε

Full source on GitHub

Copy link

Theorem (Quadratic decrease of the defect under perturbation).

(Lemma 2.4, first part): if 20\lvert \xi \rvert \le \lvert x \rvert \le 1 - \sqrt{10\lvert \xi \rvert}, then \lvert 1 - (g(x) + \xi)^2 \rvert \le \lvert 1 - x^2 \rvert^2 \,. [Shah2024, Lemma 2.4].

Lean statement and details
NLAlib.abs_one_sub_newtonSchulz_add_sq_le {x ξ : ℝ} (h₁ : 20 * |ξ| ≤ |x|)
  (h₂ : |x| ≤ 1 - √(10 * |ξ|)) : |1 - (newtonSchulz x + ξ) ^ 2| ≤ |1 - x ^ 2| ^ 2

Full source on GitHub

Copy link

Theorem (The defect bound with an additive error).

(Lemma 2.4, second part): if \lvert x \rvert \le \sqrt2 and \lvert \xi \rvert \le 1, then \lvert 1 - (g(x) + \xi)^2 \rvert \le \lvert 1 - x^2 \rvert^2 + 4\lvert \xi \rvert \,. [Shah2024, Lemma 2.4].

Lean statement and details
NLAlib.abs_one_sub_newtonSchulz_add_sq_le_add {x ξ : ℝ} (hx : |x| ≤ √2) (hξ : |ξ| ≤ 1) :
  |1 - (newtonSchulz x + ξ) ^ 2| ≤ |1 - x ^ 2| ^ 2 + 4 * |ξ|

Full source on GitHub

Copy link

Theorem (The perturbed Newton–Schulz step keeps the sign).

(Lemma 2.3, first part): if \lvert \xi \rvert \le u and u < \lvert x \rvert < \sqrt3 - (\sqrt3 - 1)u, then g(x) + \xi has the sign of x, that is x(g(x) + \xi) > 0. [Shah2024, Lemma 2.3], there with u \le 3/16, not needed here.

Lean statement and details
NLAlib.mul_newtonSchulz_add_pos {u x ξ : ℝ} (hξ : |ξ| ≤ u) (hux : u < |x|)
  (hx : |x| < √3 - (√3 - 1) * u) : 0 < x * (newtonSchulz x + ξ)

Full source on GitHub

Copy link

Theorem (The perturbed Newton–Schulz step does not decrease the modulus).

(Lemma 2.3, second part): if \lvert \xi \rvert \le u and \tfrac83 u \le \lvert x \rvert \le 1 - \tfrac83 u, then \lvert x \rvert \le \lvert g(x) + \xi \rvert. [Shah2024, Lemma 2.3].

Lean statement and details
NLAlib.abs_le_abs_newtonSchulz_add {u x ξ : ℝ} (hξ : |ξ| ≤ u) (h₁ : 8 / 3 * u ≤ |x|)
  (h₂ : |x| ≤ 1 - 8 / 3 * u) : |x| ≤ |newtonSchulz x + ξ|

Full source on GitHub

Copy link

Formal definitions

Broader topics