Approximation of functions by polynomials Why? Sometimes the analytic expression of a function is complicated, and it might be difficult to integrate it or to differentiate it. Sometimes the analytic expression is not available, the function is known only at some points at we need to reconstruct the underlyning function. A way to overcome problems of this kind is to approximate functions with polynomials (easy to deal with). December 3, 2019 1 / 20
Lagrange interpolation Theorem 1 Let g : [ c , d ] → R be a smooth enough function. Given k + 1 distinct points x 1 , x 2 , · · · , x k +1 in [ c , d ] , there exists a unique polynomial Π k ( x ) of degree ≤ k such that Π k ( x i ) = g ( x i ) i = 1 , 2 , · · · , k + 1 . ( ∗ ) Π k is called “Lagrange interpolant of g with respect to the points x 1 , x 2 , · · · , x k +1 ”. The points x 1 , x 2 , · · · , x k +1 are called “interpolation nodes”. December 3, 2019 2 / 20
Proof Existence . We shall write explicitely the expression of Π k . For this, let L i ( x ) , i = 1 , 2 , · · · , k + 1 be k + 1 polynomials, of degree exactly k , defined by: k +1 ( x − x j ) � L i ( x ) = i = 1 , 2 , · · · , k + 1 ( x i − x j ) j =1 j � = i For example, for k = 3 and nodes x 1 , x 2 , x 3 , x 4 : ( x − x 2 )( x − x 3 )( x − x 4 ) L 1 ( x ) = ( x 1 − x 2 )( x 1 − x 3 )( x 1 − x 4 ) ( x − x 1 )( x − x 3 )( x − x 4 ) L 2 ( x ) = ( x 2 − x 1 )( x 2 − x 3 )( x 2 − x 4 ) ( x − x 1 )( x − x 2 )( x − x 4 ) L 3 ( x ) = ( x 3 − x 1 )( x 3 − x 2 )( x 3 − x 4 ) ( x − x 1 )( x − x 2 )( x − x 3 ) L 4 ( x ) = ( x 4 − x 1 )( x 4 − x 2 )( x 4 − x 3 ) December 3, 2019 3 / 20
Proof Existence . We shall write explicitely the expression of Π k . For this, let L i ( x ) , i = 1 , 2 , · · · , k + 1 be k + 1 polynomials, of degree exactly k , defined by: k +1 ( x − x j ) � L i ( x ) = i = 1 , 2 , · · · , k + 1 ( x i − x j ) j =1 j � = i These are characteristic Lagrange polynomials. It is easy to check that � 1 for i = j L i ∈ P k : L i ( x j ) = δ ij = i = 1 , 2 , · · · . k + 1 0 for i � = j Claim: k +1 � Π k ( x ) := g ( x i ) L i ( x ) i =1 Indeed, it is easy to check that Π k verifies ( ∗ ), and this proves existence . December 3, 2019 3 / 20
Uniqueness . The problem of finding the polynomial Π k ( x ) := α 1 x k + . . . + α k x + α k +1 that interpolate g at the k + 1 distinct nodes x 1 , x 2 , · · · , x k +1 is a linear problem, that takes the form: x k − 1 x k . . . 1 α 1 g ( x 1 ) 1 1 x k − 1 x k . . . 1 α 2 g ( x 2 ) 2 2 = . . . . . . . . . . . . . 1 . . x k − 1 x k α k +1 g ( x k +1 ) . . . 1 k +1 k +1 The linear system has dimension k + 1 × k + 1. Since the problem has always a solution (existence is proved in the previous slide) then the solution is unique . December 3, 2019 4 / 20
Example of characteristic polynomials Ex. 1: 2 points x 1 � = x 2 ( k + 1 = 2) L 1 ( x ) = ( x − x 2 ) L 2 ( x ) = ( x − x 1 ) ( x 1 − x 2 ) , ( x 2 − x 1 ) degree k = 1. 1 L 2 L 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0.5 1 1.5 December 3, 2019 5 / 20
Example of characteristic polynomials Ex. 2: 3 points x 1 � = x 2 � = x 3 ( k + 1 = 3) L 1 ( x ) = ( x − x 2 )( x − x 3 ) L 2 ( x ) = ( x − x 1 )( x − x 3 ) ( x 1 − x 2 )( x 1 − x 3 ) , ( x 2 − x 1 )( x 2 − x 3 ) L 3 ( x ) = ( x − x 1 )( x − x 2 ) ( x 3 − x 1 )( x 3 − x 2 ) degree k = 2. 1.4 1.2 L 2 L 1 L 3 1 0.8 0.6 0.4 0.2 0 −0.2 −0.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 December 3, 2019 6 / 20
Cases of interest Case 1: g approximated by a constant (a polynomial of degree 0) 1 point: x 1 = c + d (midpoint of the interval) 2 g ( x ) ≃ Π 0 ( x ) = g ( x 1 ) Case 2: g approximated by a polynomial of degree 1(straight line) 2 point: x 1 = c , x 2 = d g ( x ) ≃ Π 1 ( x ) = g ( x 1 ) L 1 ( x ) + g ( x 2 ) L 2 ( x ) = g ( x 1 ) ( x − x 2 ) ( x 1 − x 2 ) + g ( x 2 ) ( x − x 1 ) ( x 2 − x 1 ) Remark: in both cases, if we change the nodes we obtain a different interpolant December 3, 2019 7 / 20
Example 1 0.6 0.4 0.2 g(x) 0 x 1 −0.2 Π 0 (x)=g(x 1 ) −0.4 0 0.2 0.4 0.6 0.8 1 1.2 December 3, 2019 8 / 20
Example 2 0.6 0.4 0.2 g(x) 0 Π 1 (x) −0.2 −0.4 0 0.2 0.4 0.6 0.8 1 1.2 December 3, 2019 9 / 20
Exercise December 3, 2019 10 / 20
General interpolation error In both cases, the approximation induces an error that we want to estimate. How big is it? Is the approximation satisfactory? The following Theorem gives a precise expression of the error. Theorem 2 Let g ∈ C k +1 ([ c , d ]) , and let x 1 , x 2 , · · · , x k +1 be k + 1 distinct points in [ c , d ] . For any generic point x ∈ [ c , d ] there exists a ξ ∈ [ c , d ] (depending on x) such that the interpolation error is given by k +1 e k ( x ) := g ( x ) − Π k ( x ) = g ( k +1) ( ξ ) � ( x − x j ) (1) ( k + 1)! j =1 December 3, 2019 11 / 20
Proof. Let x be fixed and t ∈ [ c , d ]. Define the function ω k +1 ( t ) = � k +1 j =1 ( t − x j ) let us introduce G ( t ) := e k ( t ) − ω k +1 ( t ) e k ( x ) /ω k +1 ( x ) . Since g ∈ C k +1 ([ c , d ]) and ω k +1 is a polynomial, G ∈ C k +1 ([ c , d ]) and vanishes at the k + 2 distinct points x 1 , x 2 , · · · , x k +1 and x . Indeed: G ( x i ) = e k ( x i ) − ω k +1 ( x i ) e k ( x ) /ω k +1 ( x ) = 0 i = 1 , 2 , · · · , k + 1 G ( x ) = e k ( x ) − ω k +1 ( x ) e k ( x ) /ω k +1 ( x ) = 0 Thanks to the meanvalue theorem a , G ′ will have k + 1 distinct zeros, and going recursively, G ( j ) will have k + 2 − j distinct zeros. Hence, G ( k +1) will have one zero, say ξ . Since ω ( k +1) k +1 ( t ) = ( k + 1)! and e ( k +1) ( t ) = g ( k +1) ( t ) we obtain the result k G ( k +1) ( ξ ) = g ( k +1) ( ξ ) − ( k + 1)! e k ( x ) /ω k +1 ( x ) = 0 and the proof is concluded. a https://en.wikipedia.org/wiki/Mean value theorem December 3, 2019 12 / 20
From (1) we can deduce for instance the following bound: [ c , d ] | e k ( x ) | ≤ ( d − c ) k +1 x ∈ [ c , d ] | g ( k +1) ( x ) | max max ( ∗ ) ( k + 1)! If we know the position of the nodes we can have sharper estimates for k +1 � the term ( x − x j ) that appears in (1). For instance, for the Case 1 we j =1 would obtain Case 1 (constant approximation): Relation (1) in this case gives x 1 = c + d e 0 ( x ) = g ′ ( ξ )( x − x 1 ) 2 No matter where x is situated within [ c , d ], its distance from the midpoint will be smaller than or equal to the length of half the interval (that is, ( d − c ) / 2). Hence x ∈ [ c , d ] | e 0 ( x ) | ≤ d − c x ∈ [ c , d ] | g ′ ( x ) | = ⇒ max max (2) 2 (( d − c ) / 2 instead of d − c ) December 3, 2019 13 / 20
Case 2 (linear approximation): For x 1 = c and x 2 = d we can observe that the function x → | ( x − c )( x − d ) | , in the interval [ c , d ] has its maximum for x = ( c + d ) / 2 and such a maximum is (( d − c ) / 2) 2 . Hence x ∈ [ c , d ] | e 1 ( x ) | ≤ ( d − c ) 2 x ∈ [ c , d ] | g ′′ ( x ) | max max (3) 2! · 4 (and we have ( d − c ) 2 / 8 instead of ( d − c ) 2 / 2). December 3, 2019 14 / 20
Runge function Apparently, increasing the degree k of the Lagrange polynomial should improve the error, which should become smaller and smaller. This is not always the case if the nodes are equally spaced. The classical example is given by the so-called Runge’s function: 1 g ( x ) = 1 + x 2 This is what happens Grado del polinomio interpolatore n=8 Grado del polinomio interpolatore n=20 1 10 0 0.5 − 10 0 − 20 − 30 − 0.5 − 40 − 1 − 50 − 1.5 − 60 − 1 − 0.8 − 0.6 − 0.4 − 0.2 0 0.2 0.4 0.6 0.8 1 − 1 − 0.8 − 0.6 − 0.4 − 0.2 0 0.2 0.4 0.6 0.8 1 degree 8 degree 20 December 3, 2019 15 / 20
A simple remedy: Composite Lagrange interpolation Use of Lagrange interpolation (piecewise) to have a good approximation of a function. Given f : [ a , b ] → R (smooth enough), subdivide [ a , b ] in N subintervals, for simplicity of notation all equal. We have then a uniform subdivision of [ a , b ] into intervals of length h = ( b − a ) / N . In each subinterval we approximate f with a Lagrange interpolant polynomial. To fix ideas, let us consider again Cases 1 and 2. Case 1: N → h = ( b − a ) / N , x 1 = a , x 2 = x 1 + h , · · · , x N +1 = b I 1 = [ x 1 , x 2 ] , · · · , I j = [ x j , x j +1 ] , · · · , I N = [ x N , x N +1 ] x M =midpoint of the interval I j : x M = ( x j + x j +1 ) / 2 j j f ( x ) | [ a , b ] ≃ f 0 ( x ) piecewise constant function given by f 0 ( x ) | I j = f ( x M j ) j = 1 , 2 , · · · , N December 3, 2019 16 / 20
Piecewise constant interpolation 0.6 a=0, b=1, N=4, h=1/N, I 1 , I 2 , I 3 , I 4 0.4 0.2 f(x) 0 f 0 (x) -0.2 -0.4 0 0.2 0.4 0.6 0.8 1 1.2 December 3, 2019 17 / 20
Recommend
More recommend