Vous êtes sur la page 1sur 18

Interpolation and Polynomial

Approximation

6/3/2018 by Adam Pamudji R 1


Introduction
 Read page 85 250000

Problems of

Population (x 1000)...

200000
interpolation
150000

100000
1920 1930 1940 1950 1960 1970 1980 1990
year

 Solution: using a
function that fit (best)
?
to the data
6/3/2018 by Adam Pamudji R 2
Algebraic Polynomials
 Uniformly approximate continuous
functions
 Derivative and indefinite integral of any
polynomial are
 easy to determinate and
 results to a polynomial again
 Used for approximating continuous
functions

6/3/2018 by Adam Pamudji R 3


Algebraic Polynomials

Pn(x) = a0 + a1x + … + anx n


n 1 2
a0=
3
0
4 Pn(x) 65 6
x/ai 0.5 0.3 0.3 0.1 0.1 0.1
0 0 0 0 0 0 0
0.1 0.05 5
0.053 0.053038 0.053038 0.053038 0.053038
0.2 0.1 0.112 n=1
0.1123 0.112316 0.112318 0.112318
0.3 0.15 0.177 0.178013 0.178111 0.178129 0.178132
n=2
0.4 0.2 0.248 4 0.250902
0.2504 0.250778 0.250877 n=3
0.5 0.25 0.325 0.329688 0.330803 0.331193 0.331324
n=4

Pn(x)...
0.6 0.3 0.408 0.4161 0.418871 0.420118 0.420658
0.7 0.35 0.497 0.509863 0.515964 0.519409
3 0.521296
0.8 0.4 0.592 0.6112 0.623483 0.632012 0.637886
0.9 0.45 0.693 0.720338 0.743401 0.762796 0.779675
1 0.5 0.8 0.8375 0.87846 0.919663
2 0.965617
1.1 0.55 0.913 0.962913 1.032396 1.115178 1.23626
1.2 0.6 1.032 1.0968 1.210228 1.36895 1.683147
1.3 0.65 1.157 1.239388 1.418586 1.711025
1 2.525979
1.4 0.7 1.288 1.3909 1.66611 2.18668 4.325732
1.5 0.75 1.425 1.551563 1.963906 2.863086 8.60061
1.6 0.8 1.568 1.7216 2.326083 3.838464
0 19.67833
1.7 0.85 1.717 1.901238 2.77036 5.254533 50.46277
0 0.5 1 1.5 2
1.8 0.9 1.872 2.0907 3.318771 7.313236 140.9308
1.9 0.95 2.033 2.290213 3.998455 10.29901 418.9507 x
2 1 2.2 2.5 4.84256 14.60819 1304.193

6/3/2018 by Adam Pamudji R 4


n= 3
a0 = 0.9
a1 = -1.2
a2 = 0.25
e = 0.3 a3 = 0.03
x f(x)-e f(x) f(x)+e Pn(x)
0 0.7 1 1.3 0.9 1.5
0.1 0.518182 0.818182 1.118182 0.78253
0.2 0.366667 0.666667 0.966667 0.67024 f(x)-e
0.3 0.238462 0.538462 0.838462 0.56331 1 f(x)
0.4 0.128571 0.428571 0.728571 0.46192
f(x)+e
0.5 0.033333 0.333333 0.633333 0.36625
0.6 -0.05 0.25 0.55 0.27648 Pn(x)
0.5
0.7 -0.12353 0.176471 0.476471 0.19279
0.8 -0.18889 0.111111 0.411111 0.11536

y
0.9 -0.24737 0.052632 0.352632 0.04437
1 -0.3 0 0.3 -0.02 0
1.1 -0.34762 -0.04762 0.252381 -0.07757
1.2 -0.39091 -0.09091 0.209091 -0.12816
1.3 -0.43043 -0.13043 0.169565 -0.17159 -0.5
1.4 -0.46667 -0.16667 0.133333 -0.20768
1.5 -0.5 -0.2 0.1 -0.23625
1.6 -0.53077 -0.23077 0.069231 -0.25712
-1
1.7 -0.55926 -0.25926 0.040741 -0.27011
0 0.5 1 1.5 2
1.8 -0.58571 -0.28571 0.014286 -0.27504
1.9 -0.61034 -0.31034 -0.01034 -0.27173 x
2 -0.63333 -0.33333 -0.03333 -0.26
6/3/2018 by Adam Pamudji R 5
Polynomials and Interpolation
 The Taylor Polynomials
 The Lagrange Polynomials
 Interpolation
 Lagrange interpolating polynomials
 Iterated interpolation
 Devided-difference methods
 Hermite interpolation
 Cubic spline interpolation
 Piecewise polynomial approximation

6/3/2018 by Adam Pamudji R 6


Taylor Polynomials

 Approximating at a single point


 Read page 86 and 87
 Rethink the answer of the question no 19
a of Exercise Set 1.1 on page 9

6/3/2018 by Adam Pamudji R 7


Lagrange Polynomials

Ln ,k ( x) 
 x  x0  x  xk 1 x  xk 1  x  xn 
xk  x0 xk  xk 1 xk  xk 1 xk  xn 
Ln ,k ( x)  
n
 x  xi 
.
i  0  xk  xi 
ik

n: degree of polynomial
k: the th point number
Lagrange polynomial of n degree passes to n+1 points

Example: n = 1, no. of points = 2 means k = 0 and 1 (two polynomials)

6/3/2018 by Adam Pamudji R 8


Lagrange Polynomial of degree 1

linear, n = 1
x0 = 0 1.2
L1,0(x)
x1 = 1
1 L1,1(x)
k= 0 1
x L1,0(x) L1,1(x) 0.8
Ln,k(x)...

0 1 0
0.1 0.9 0.1 0.6
0.2 0.8 0.2
0.3 0.7 0.3 0.4
0.4 0.6 0.4
0.2
0.5 0.5 0.5
0.6 0.4 0.6
0
0.7 0.3 0.7
0 0.2 0.4 0.6 0.8 1
0.8 0.2 0.8
0.9 0.1 0.9 x
1 0 1

6/3/2018 by Adam Pamudji R 9


Lagrange Polynomial of degree 2
quadratic, n = 2
x0 = 0 1.2
x1 = 0.5
1
x2 = 1
k= 0 1 2 0.8
x L2,0(x) L2,1(x) L2,2(x) Ln,k(x)... L2,0(x)
0.6
0 1 0 0 L2,1(x)
0.1 0.72 0.36 -0.08 0.4 L2,2(x)
0.2 0.48 0.64 -0.12
0.3 0.28 0.84 -0.12 0.2
0.4 0.12 0.96 -0.08
0.5 0 1 0 0
0.6 -0.08 0.96 0.12
-0.2
0.7 -0.12 0.84 0.28
0 0.5 1
0.8 -0.12 0.64 0.48
0.9 -0.08 0.36 0.72 x
1 0 0 1
6/3/2018 by Adam Pamudji R 10
Lagrange Interpolating Polynomials
The approximating polynomial of degree n is set so that
it has exactly same values with the function at n+1 points

f(xk) = Pn(xk), for each k = 0, 1, … , n

Pn ( x)  f ( x0 ) Ln ,0 ( x)    f ( xn ) Ln,n ( x)
n
Pn ( x)   f ( xk ) Ln,k ( x)
k 0

6/3/2018 by Adam Pamudji R 11


The Lagrange Interpolation Function
Lagrange Interpolation, n = 1
f(x) = 1/x the function to be approximated
take two points
x0 = 2 f(x0) = 0.5
x1 = 3 f(x1) = 0.333333
k= 0 1 0 1
x L1,0 (x) L1,1 (x) f(x0)L1,0 (x) f(x1)L1,1 (x) Pn(x) f(x)
2 1 0 0.50 0.00 0.500 0.500
2.1 0.9 0.1 0.45 0.03 0.483 0.476
2.2 0.8 0.2 0.40 0.07 0.467 0.455
2.3 0.7 0.3 0.35 0.10 0.450 0.435
2.4 0.6 0.4 0.30 0.13 0.433 0.417
2.5 0.5 0.5 0.25 0.17 0.417 0.400
2.6 0.4 0.6 0.20 0.20 0.400 0.385
2.7 0.3 0.7 0.15 0.23 0.383 0.370
2.8 0.2 0.8 0.10 0.27 0.367 0.357
2.9 0.1 0.9 0.05 0.30 0.350 0.345
3 0 1 0.00 0.33 0.333 0.333
6/3/2018 by Adam Pamudji R 12
The Lagrange Interpolation Function
1

L1,0(x)
0.9
L1,1(x)
f(x0)L1,0(x)
0.8
f(x1)L1,1(x)
Pn(x)
0.7
f(x)

0.6
y...

0.5

0.4

0.3

0.2

0.1

0
2 2.2 2.4 2.6 2.8 3
x
6/3/2018 by Adam Pamudji R 13
Lagrange Interpolation, n = 2
f(x) = 1/x the function to be approximated
take three points
x0 = 2 f(x 0) = 0.5
x1 = 2.5 f(x 1) = 0.4
x2 = 4 f(x 2) = 0.25
k= 0 1 2 0 1 2
x L2,0(x) L2,1(x) L2,2(x) f(x 0)L2,0(x) f(x 1)L2,1(x) f(x 2)L2,2(x) Pn(x) f(x)
2 1.00 0.00 0.00 0.500 0.000 0.000 0.500 0.500
2.1 0.76 0.25 -0.01 0.380 0.101 -0.003 0.478 0.476
2.2 0.54 0.48 -0.02 0.270 0.192 -0.005 0.457 0.455
2.3 0.34 0.68 -0.02 0.170 0.272 -0.005 0.437 0.435
2.4 0.16 0.85 -0.01 0.080 0.341 -0.003 0.418 0.417
2.5 0.00 1.00 0.00 0.000 0.400 0.000 0.400 0.400
2.6 -0.14 1.12 0.02 -0.070 0.448 0.005 0.383 0.385
2.7 -0.26 1.21 0.05 -0.130 0.485 0.012 0.367 0.370
2.8 -0.36 1.28 0.08 -0.180 0.512 0.020 0.352 0.357
2.9 -0.44 1.32 0.12 -0.220 0.528 0.030 0.338 0.345
3 -0.50 1.33 0.17 -0.250 0.533 0.042 0.325 0.333
3.1 -0.54 1.32 0.22 -0.270 0.528 0.055 0.313 0.323
3.2 -0.56 1.28 0.28 -0.280 0.512 0.070 0.302 0.313
3.3 -0.56 1.21 0.35 -0.280 0.485 0.087 0.292 0.303
3.4 -0.54 1.12 0.42 -0.270 0.448 0.105 0.283 0.294
3.5 -0.50 1.00 0.50 -0.250 0.400 0.125 0.275 0.286
3.6 -0.44 0.85 0.59 -0.220 0.341 0.147 0.268 0.278
3.7 -0.36 0.68 0.68 -0.180 0.272 0.170 0.262 0.270
3.8 -0.26 0.48 0.78 -0.130 0.192 0.195 0.257 0.263
3.9 -0.14 0.25 0.89 -0.070 0.101 0.222 0.253 0.256
4 0.00 0.00 1.00 0.000 0.000 0.250 0.250 0.250
6/3/2018 by Adam Pamudji R 14
1.50
L2,0(x)
L2,1(x)
L2,2(x)
1.00
f(x0)L2,0(x)
f(x1)L2,1(x)
f(x2)L2,2(x)
0.50 Pn(x)
f(x)
y..

0.00

-0.50

-1.00
2 2.5 3 3.5 4

6/3/2018 by Adam Pamudji R 15


Cubic Spline Interpolation

 Piecewise polynomial approximation


 Read page 126 to 138

6/3/2018 by Adam Pamudji R 16


Two Dimensional Case

n
Ln ,k , j ( x, y )  
 x  xi  n  y  yi 

i  0  xk  xi  i  0  y j  yi 
ik i j

n n
Pn ( x, y)   f ( xk , y j ) Ln,k , j ( x, y)
j 0 k 0

6/3/2018 by Adam Pamudji R 17


The Algorithm

 See the excel file

6/3/2018 by Adam Pamudji R 18

Vous aimerez peut-être aussi