An Introduction to Polynomial Interpolation
Total Page:16
File Type:pdf, Size:1020Kb
An introduction to polynomial interpolation Eric Gourgoulhon Laboratoire de l’Univers et de ses Th´eories (LUTH) CNRS / Observatoire de Paris F-92195 Meudon, France [email protected] School on spectral methods: Application to General Relativity and Field Theory Meudon, 14-18 November 2005 http://www.lorene.obspm.fr/school/ Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 1 / 50 Plan 1 Introduction 2 Interpolation on an arbitrary grid 3 Expansions onto orthogonal polynomials 4 Convergence of the spectral expansions 5 References Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 2 / 50 Introduction Outline 1 Introduction 2 Interpolation on an arbitrary grid 3 Expansions onto orthogonal polynomials 4 Convergence of the spectral expansions 5 References Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 3 / 50 Introduction Introduction Basic idea: approximate functions R → R by polynomials Polynomials are the only functions that a computer can evaluate exactely. Two types of numerical methods based on polynomial approximations: spectral methods: high order polynomials on a single domain (or a few domains) finite elements: low order polynomials on many domains Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 4 / 50 Introduction Introduction Basic idea: approximate functions R → R by polynomials Polynomials are the only functions that a computer can evaluate exactely. Two types of numerical methods based on polynomial approximations: spectral methods: high order polynomials on a single domain (or a few domains) finite elements: low order polynomials on many domains Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 4 / 50 Introduction Framework of this lecture We consider real-valued functions on the compact interval [−1, 1]: f :[−1, 1] −→ R We denote by P the set all real-valued polynomials on [−1, 1]: n X i ∀p ∈ P, ∀x ∈ [−1, 1], p(x) = ai x i=0 by PN (where N is a positive integer), the subset of polynomials of degree at most N. Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 5 / 50 Introduction Is it a good idea to approximate functions by polynomials ? For continuous functions, the answer is yes: Theorem (Weierstrass, 1885) 0 P is a dense subspace of the space C ([−1, 1]) of all continuous functions on a [−1, 1], equiped with the uniform norm k.k∞. aThis is a particular case of the Stone-Weierstrass theorem The uniform norm or maximum norm is defined by kfk∞ = max |f(x)| x∈[−1,1] Other phrasings: For any continuous function on [−1, 1], f, and any > 0, there exists a polynomial p ∈ P such that kf − pk∞ < . For any continuous function on [−1, 1], f, there exists a sequence of polynomials (pn)n∈ which converges uniformly towards f: lim kf − pnk∞ = 0. N n→∞ Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 6 / 50 Introduction Best approximation polynomial For a given continuous function: f ∈ C0([−1, 1]), a best approximation ∗ polynomial of degree N is a polynomial pN (f) ∈ PN such that ∗ kf − pN (f)k∞ = min {kf − pk∞, p ∈ PN } Chebyshev’s alternant theorem (or equioscillation theorem) 0 ∗ For any f ∈ C ([−1, 1]) and N ≥ 0, the best approximation polynomial pN (f) exists and is unique. Moreover, there exists N + 2 points x0, x1, ... xN+1 in [-1,1] such that ∗ i ∗ f(xi) − pN (f)(xi) = (−1) kf − pN (f)k∞, 0 ≤ i ≤ N + 1 ∗ i+1 ∗ or f(xi) − pN (f)(xi) = (−1) kf − pN (f)k∞, 0 ≤ i ≤ N + 1 ∗ Corollary: pN (f) interpolates f in N + 1 points. Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 7 / 50 Introduction Illustration of Chebyshev’s alternant theorem N = 1 Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 8 / 50 Introduction Illustration of Chebyshev’s alternant theorem N = 1 Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 8 / 50 Interpolation on an arbitrary grid Outline 1 Introduction 2 Interpolation on an arbitrary grid 3 Expansions onto orthogonal polynomials 4 Convergence of the spectral expansions 5 References Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 9 / 50 Interpolation on an arbitrary grid Interpolation on an arbitrary grid Definition: given an integer N ≥ 1, a grid is a set of N + 1 points X = (xi)0≤i≤N in [-1,1] such that −1 ≤ x0 < x1 < ··· < xN ≤ 1. The N + 1 points (xi)0≤i≤N are called the nodes of the grid. Theorem 0 Given a function f ∈ C ([−1, 1]) and a grid of N + 1 nodes, X = (xi)0≤i≤N , X there exist a unique polynomial of degree N, IN f, such that X IN f(xi) = f(xi), 0 ≤ i ≤ N X IN f is called the interpolant (or the interpolating polynomial) of f through the grid X. Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 10 / 50 Interpolation on an arbitrary grid Lagrange form of the interpolant X The interpolant IN f can be expressed in the Lagrange form: N X X X IN f(x) = f(xi) `i (x), i=0 X where `i (x) is the i-th Lagrange cardinal polynomial associated with the grid X: N Y x − xj `X (x) := , 0 ≤ i ≤ N i x − x j=0 i j j6=i The Lagrange cardinal polynomials are such that X `i (xj) = δij, 0 ≤ i, j ≤ N Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 11 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `0 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `1 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `2 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `3 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `4 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `5 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `6 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `7 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials X Uniform grid N = 8 `8 (x) Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Examples of Lagrange polynomials Uniform grid N = 8 Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50 Interpolation on an arbitrary grid Interpolation error with respect to the best approximation error 0 Let N ∈ N, X = (xi)0≤i≤N a grid of N + 1 nodes and f ∈ C ([−1, 1]). X Let us consider the interpolant IN f of f through the grid X. ∗ The best approximation polynomial pN (f) is also an interpolant of f at N + 1 nodes (in general different from X) reminder X How does the error kf − IN fk∞ behave with respect to the smallest possible ∗ error kf − pN (f)k∞ ? The answer is given by the formula: X ∗ kf − IN fk∞ ≤ (1 + ΛN (X)) kf − pN (f)k∞ where ΛN (X) is the Lebesgue constant relative to the grid X: N X X ΛN (X) := max `i (x) x∈[−1,1] i=0 Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 13 / 50 Interpolation on an arbitrary grid Lebesgue constant The Lebesgue constant contains all the information on the effects of the choice of X X on kf − IN fk∞. Theorem (Erd˝os, 1961) For any choice of the grid X, there exists a constant C > 0 such that 2 Λ (X) > ln(N + 1) − C N π Corollary: ΛN (X) → ∞ as N → ∞ 2N+1 In particular, for a uniform grid, Λ (X) ∼ as N → ∞ ! N eN ln N This means that for any choice of type of sampling of [−1, 1], there exists a 0 X continuous function f ∈ C ([−1, 1]) such that IN f does not convergence uniformly towards f. Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 14 / 50 Interpolation on an arbitrary grid Example: uniform interpolation of a “gentle” function X f(x) = cos(2 exp(x)) uniform grid N = 4 : kf − I4 fk∞ ' 1.40 Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50 Interpolation on an arbitrary grid Example: uniform interpolation of a “gentle” function X f(x) = cos(2 exp(x)) uniform grid N = 6 : kf − I6 fk∞ ' 1.05 Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50 Interpolation on an arbitrary grid Example: uniform interpolation of a “gentle” function X f(x) = cos(2 exp(x)) uniform grid N = 8 : kf − I8 fk∞ ' 0.13 Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50 Interpolation on an arbitrary grid Example: uniform interpolation of a “gentle” function X f(x) = cos(2 exp(x)) uniform grid N = 12 : kf − I12 fk∞ ' 0.13 Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50 Interpolation on