Weak 2
Weak 2
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 1 / 28
Outline
1 Introduction
3 Lagrange Polynomial
4 Newton Polynomial
Divided Dierences
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 2 / 28
Introduction
One of the most useful and well-known classes of functions mapping the
set of real numbers into itself is the algebraic polynomials, the set of
functions of the form
Pn (x) = an x n + an−1 x n−1 + · · · + a1 x + a0 ,
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 3 / 28
Introduction
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 4 / 28
Theorem 1
Suppose f is dened and continuous on [a, b]. For each ε > 0, there exists
a polynomial P(x) with the property that
|f (x) − P(x)| < ε,
for all x in [a, b]. The proof of this theorem can be found in most
elementary texts on real analysis.
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 5 / 28
Consider the construction of a polynomial of degree at most n that passes
through the n + 1 points
(x0 , f (x0 )), (x1 , f (x1 )), . . . , (xn , f (xn )).
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 6 / 28
Figure: Graph of a typical Lnk (x) (when n is even).
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 7 / 28
The interpolating polynomial is easily described once the form of Lnk is
known. This polynomial, called the n-th Lagrange interpolating polynomial,
is dened in the following theorem:
Theorem 2 (1795)
If x0 , x1 , . . . , xn are n + 1 distinct numbers and f is a function whose values
are given at these numbers, then a unique polynomial P(x) of degree at
most n exists with f (xk ) = P(xk ), for each k = 0, 1, . . . , n. This
polynomial is given by
n
X
P(x) = f (x0 )Ln,0 (x) + · · · + f (xn )Ln,n (x) = f (xk )Ln,k (x),
k=0
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 8 / 28
Example 1
(a) Use the numbers (called nodes) x0 = 2, x1 = 2.75, and x2 = 4 to nd
the second Lagrange interpolating polynomial for f (x) = x1 .
(b) Use this polynomial to approximate f (3) = 13 .
Solution
(a) We rst determine the coecient polynomials L0 (x), L1 (x), and L2 (x).
In nested form, they are
(x − 2.75)(x − 4) 2
L0 (x) = = (x − 2.75)(x − 4),
(2 − 2.75)(2 − 4) 3
(x − 2)(x − 4) 16
L1 (x) = = − (x − 2)(x − 4),
(2.75 − 2)(2.75 − 4) 15
and
(x − 2)(x − 2.75) 2
L2 (x) = = (x − 2)(x − 2.75).
(4 − 2)(4 − 2.75) 5
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 9 / 28
Solution
También, dado que f (x0 ) = 12 , f (x1 ) = 4
11 , y f (x2 ) = 14 , podemos calcular
el polinomio interpolante P(x) como:
2
X
P(x) = f (xk )Lk (x) = f (x0 )L0 (x) + f (x1 )L1 (x) + f (x2 )L2 (x),
k=0
Sustituyendo los valores dados de f (x0 ), f (x1 ), y f (x2 ) junto con sus
respectivos polinomios Lk (x) en la ecuación, obtenemos:
1 64 1
P(x) = (x − 2.75)(x − 4) − (x − 2)(x − 4) + (x − 2)(x − 2.75).
3 165 10
Simplicando esta expresión, obtenemos:
1 2 35 49
P(x) = x − x+ .
22 88 44
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 10 / 28
1
(b) An approximation to f (3) = 3 (see Figure 3.6) is
9 105 49
f (3) ≈ P(3) = − + = 0.32955.
22 88 44
Figure: Example 1
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 11 / 28
Lagrange interpolating polynomial
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 12 / 28
Simulation
Figure: Results.
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 13 / 28
Theorem 3
Suppose x0 , x1 , . . . , xn are distinct numbers in the interval [a, b] and
f ∈ C n+1 [a, b]. Then, for each x in [a, b], a number ξ(x) (generally
unknown) between min{x0 , x1 , . . . , xn } and max{x0 , x1 , . . . , xn } and hence
in (a, b), exists with
f (n+1) (ξ(x))
f (x) = P(x) + (x − x0 )(x − x1 ) · · · (x − xn ),
(n + 1)!
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 14 / 28
Example 2
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 15 / 28
Solution: Because f (x) = x −1 , we have f ′ (x) = −x −2 , f ′′ (x) = 2x −3 , and
f ′′′ (x) = −6x −4 . As a consequence, the second Lagrange polynomial has
the error form:
f ′′′ (ξ(x)) (ξ(x))−4
(x −x0 )(x −x1 )(x −x2 ) = − (x − 2)(x − 2.75)(x − 4), for
3! 16
(ξ(x))−4 1
ξ(x) ∈ (2, 4) The maximum value of on the interval is 16
16 . We now
need to determine the maximum value on this interval of the absolute value
of the polynomial:
35 2 7
g (x) = (x − 2)(x − 2.75)(x − 4) = x 3 − x + x − 22.
4 4
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 16 / 28
Because
35 2 49 35 49 1
Dx x − x + x − 22 = 3x 2 − x +
3
= (3x − 7)(2x − 7),
4 2 2 2 2
the critical points occur at x = 73 with g (7/3) = 25/108 and x = 7
2 with
g (7/2) = −9/16. Hence, the maximum error is
f ′′′ (ξ(x)) 1 −9 9
|(x − x0 )(x − x1 )(x − x2 )| ≤ = ≤ 0.03515625.
3! 16 16 256
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 17 / 28
Divided Dierences
Suppose that Pn (x) is the n-th interpolating polynomial that agrees with
the function f at the distinct numbers x0 , x1 , . . . , xn . Although this
polynomial is unique, there are alternate algebraic representations that are
useful in certain situations. The divided dierences of f with respect to
x0 , x1 , . . . , xn are used to express Pn (x) in the form:
Pn (x) = a0 +a1 (x−x0 )+a2 (x−x0 )(x−x1 )+. . .+an (x−x0 )(x−x1 ) · · · (x−xn−1 ),
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 18 / 28
Similarly, when P(x) is evaluated at x1 , the only nonzero terms in the
evaluation of Pn (x1 ) are the constant and linear terms,
f (x0 ) + a1 (x1 − x0 ) = Pn (x1 ) = f (x1 ),
so
f (x1 ) − f (x0 )
a1 = .
x1 − x0
The zeroth divided dierence of the function f with respect to xi , denoted
f [xi ], is simply the value of f at xi , denoted as f (xi ), given by:
f [xi ] = f (xi ).
The remaining divided dierences are dened recursively; the rst divided
dierence of f with respect to xi and xi+1 is denoted f [xi , xi+1 ] and
dened as:
f [xi+1 ] − f [xi ]
f [xi , xi+1 ] = , xi+1 ̸= xi .
xi+1 − xi
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 19 / 28
The second divided dierence, f [xi , xi+1 , xi+2 ], is dened as:
f [xi+1 , xi+2 ] − f [xi , xi+1 ]
f [xi , xi+1 , xi+2 ] = .
xi+2 − xi
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 20 / 28
We can write a1 = f [x0 , x1 ], just as a0 can be expressed as f [x0 ] = f [x0 ].
Hence, the interpolating polynomial is:
Pn (x) = f [x0 ] + f [x0 , x1 ](x − x0 ) + · · · + an (x − x0 )(x − x1 ) · · · (x − xn−1 ).
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 21 / 28
Divided Dierences
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 22 / 28
Newton Divided Dierences Formula
Step 1: For i = 1, 2, . . . , n
For j = 1, 2, . . . , i
Set Fi,j = Fi,j−1 −Fi−1,j−1
xi −xi−j (where Fi,j = [xi , xi−1 , . . . , xi−j ]).
Step 2: OUTPUT (F0,0 , F1,1 , . . . , Fn,n ); STOP.
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 23 / 28
Example2
Complete the divided dierence table for the data in the Table, and
construct the interpolating polynomial that uses all these data.
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 24 / 28
Solution: The rst divided dierence involving x0 and x1 is
f [x1 ] − f [x0 ] 0.6200860 − 0.7651977
f [x0 , x1 ] = = = −0.4837057.
x1 − x0 1.3 − 1.0
The remaining rst divided dierences are found in a similar manner and
are shown in the fourth column in Table 2
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 25 / 28
The second divided dierence involving x0 , x1 , and x2 is
f [x1 , x2 ] − f [x0 , x1 ] −0.5489460 − (−0.4837057)
f [x0 , x1 , x2 ] = = =
x2 − x0 1.6 − 1.0
−0.1087339. The remaining second divided dierences are shown in the
5th column of Table 2.
The third divided dierence involving x0 , x1 , x2 , and x3 and the fourth
divided dierence involving all the data points are, respectively,
f [x1 , x2 , x3 ] − f [x0 , x1 , x2 ] −0.0494433 − (−0.1087339)
f [x0 , x1 , x2 , x3 ] = =
x3 − x0 1.9 − 1.0
= 0.0658784 and
f [x1 , x2 , x3 , x4 ] − f [x0 , x1 , x2 , x3 ] 0.0680685 − 0.06587
f [x0 , x1 , x2 , x3 , x4 ] = =
x4 − x0 2.2 − 1.0
= 0.0018251
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 26 / 28
Figure: Code in Pyhton.
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 27 / 28
Figure: Results.
Mg. Dennis Quispe Sánchez Interpolation and Polynomial Approximation March 19, 2024 28 / 28