Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
C. Guerra
PUCP
Funcin Interpolante
Dado el conjunto de puntos: Pi ( xi , yi f ( xi )) / i {1, N },
( xN , y N )
( x3 , y3 )
f ( x)
( xN 1 , y N 1 )
( xN 2 , y N 2 )
( x2 , y2 )
( x1 , y1 )
L
X
Pi
Observaciones
x* {x1 ,L , xN }
Interpolacin Polinomial
Dado el conjunto de puntos: Pi ( xi , yi f ( xi )) / i {1, N } se busca un
polinomio cuya grfica pase por todos los puntos Pi
Teorema
Para un conjunto cualquiera de N puntos dados en el espacio,
existe un nico polinomio interpolante P(x) de grado menor que N
Existen diversos algoritmos para determinar P(x)
Algoritmo de Vandermonde
Algoritmo de Newton
Algoritmo de Lagrange
Algoritmo de Neville
Algoritmo de Vandermonde
Sea el polinomio de grado N-1
N
P ( x) ak x k 1 a1 a2 x1 L aN x N 1
k 1
Esta funcin pasa por los N puntos, luego los coeficientes quedan
determinados de:
y1 a1 a2 x11 L aN x1N 1
1
N 1
y2 a1 a2 x2 L aN x2
yi P ( xi )
M
M
y a a x1 L a x N 1
1
2 N
N N
N
Algoritmo de Vandermonde
Este sistema de ecuaciones lineal se puede escribir en la forma
matricial:
1
1
M
1
x1
x2
x3
M
xN
x12
x22
x32
M
xN2
L
L
L
O
L
x1N 1
N 1
x2
x3N 1
M
xNN 1
a1 y1
a2 y2
a3 y3
M M
a y
N N
Algoritmo de Lagrange
Ecuacin de la recta:
x x1
y y1 ( y2 y1 )
x2 x1
x x2
x x1
y y1
y2
x1 x2
x2 x1
Formalmente:
x x2
L1,1 ( x) x x
2
1
2
P( x) yk L1, k ( x) y1 L1,1 ( x ) y2 L1,2 ( x)
k 1
L ( x) x x1
1,2
x2 x1
PN ( x) yk LN 1,k ( x)
k 1
LN 1,k ( xi ) i ,k
Algoritmo de Lagrange
LN 1,k
( x)
N
j 1
j k
N
j 1
jk
(x x j )
( xk x j )
( x x1 )L ( x xk 1 )L ( x xk 1 )L ( x xN )
( xk x1 )L ( xk xk 1 ) L ( xk xk 1 ) L ( xk xN )
PN ( x) yk LN 1,k ( x) y1 LN 1,1 ( x ) L y N LN 1, N ( x)
k 1
x1 x2
x x3
x x 5
x x 4
x1 x3 x1 x4 x1 x5
x6
x
x1 x6
x x1
x2 x1
x x3
x x 5
x x 4
x
x
x
x
x
2
2
4
2 3
5
x x6
x2 x6
x x7
y2
x 2 x7
x x5 x x6
x 3 x5 x3 x6
x x7
y3
x3 x7
y( x)
x x1
x x 2
x
x
x
3
3 1
2
x x4
x3
x
4
x x7
y1
x 1 x7
x x1
x x 5
x x 2 x x3
x
x
x
x
x
x
x
4
4
4 1
2 4 3
5
x x6
x4 x6
x x1
x
5 1
x x6 x x7
y5
x 5 x6 x5 x7
x x2
x x 3
x
x
x
5
5 2
3
x x1
x x 2
x
x
x
6
1
6
2
x x3
x6 x3
x x4
x5
x
4
x x4 x x5
x 6 x4 x6 x5
x x1
x x 2 x x3
x x 4
x6 x1 x6 x2 x6 x3 x6 x4
x x5
x6 x5
x x7
y4
x 4 x7
x x7
y6
x6 x7
x x6
y7
x 6 x6
Algoritmo de Neville
Sean los puntos xi / i {1, N }, el polinomio de interpolacin de orden
N-1 puede ser determinado a partir de la relacin recursiva
Pi (i 1)L ( i m )
donde las cantidades Pi ,(i 1),K ,(i m ) con m = {1, N-1} subscripts son
polinomios de x de orden m-1 y dependen de Ps de menos ndices
y1 P1
P12
P23
P34
y2 P2
y3 P3
y4 P4
P123
P234
P1234
Pi f ( xi )
Con el propsito de mejorar el algoritmo definimos las diferencias
hacia abajo (C) y hacia arriba (D)
Cm ,i PiL (i m ) PiL (i m 1)
Dm ,i PiL (i m ) P(i 1)L ( i m )
con las relaciones de partida:
C1,i yi
D1,i yi
Algoritmo de Neville
Dm 1,i
Cm 1,i
( xi m 1 x)(Cm ,i 1 Dm ,i )
xi xi m 1
( xi x)(Cm ,i 1 Dm ,i )
xi xi m 1
3.
1
1 25 x 2
-1.0
0.038461
-0.6
0.1
-0.2
0.5
0.2
0.5
0.6
0.1
1.0
0.038461
Oscilaciones polinmicas
Aumentar el grado del polinomio no es una buena idea
17th Order
Polynomial
Original
Function
5th Order
Polynomial
9th Order
Polynomial
No siempre es el caso
Para la funcin error, polinomios de
alto grado, tienen error pequeo:
2
erf ( x)
e
0
t 2
dt
P ( x ) qi ( x )
x [ xi , xi 1 ) i {1,K , n 1}
( xN , y N )
( xN 1 , yN 1 )
( x3 , y3 )
( x2 , y2 )
( x1 , y1 )
q1 ( x )
( xN 2 , y N 2 )
qN 1 ( x)
qN 2 ( x )
q2 ( x )
L
X
da
j+1
y A( x) y j B ( x) y j 1
donde
A( x)
x j 1 x
x j 1 x j
B( x) 1 A
x xj
x j 1 x j
y ( x ) A( x ) y j B( x ) y j 1 C ( x) y j D ( x ) y j 1
d 2 y ( x)
C ( x) yj D( x) yj 1
2
dx
que implica que se deben cumplir
C ( x j ) 1
C ( x j 1 ) 0
D( x j ) 0
D( x j 1 ) 1
C ( x) A( x)
D( x) B( x)
C y D son de
primer orden!
C(x j ) 0
C ( x j 1 ) 0
D( x j ) 0
D( x j 1 ) 0
C 16 ( A3 A)( x j 1 x j ) 2
D 16 ( B 3 B )( x j 1 x) 2
y ( x j )
[ x j 1 , x j ]
y( x j )
[ x j , x j 1 ]
donde
dy y j 1 y j 3 A2 1
3B 2 1
( x j 1 x j ) y j
( x j 1 x j ) y j 1
dx x j 1 x j
6
6
Luego tenemos:
1.
2.
a3
0
M
0
c2
b3
a4
M
K
K
0
0
c3
0
b4 c4
M O
0 an 2
0
0
K
K
K
M
bn 2
an 1
0
y 2
d2
0 y3 d3
0 y4 d 4
M M
M
cn 2 yn2 d n 2
bn 1
y
n 1
n 1
donde
0
ai
xi xi 1
i2
i 3,K , n 1
xi 1 xi
ci
0
bi 2( xi 1 xi 1 )
i 2,K , n 2
i n 1
x3 x2
( x2 x1 ) y1
x2 x1
yi 1 yi yi yi 1
di 6
x
x
x
i
i 1
i 1 i
6 yn yn 1 yn 1 yn 2 ( xn xn 1 ) yn
xn xn 1 xn 1 xn 2
i2
i 3,K , n 2
i n 1
p ( x) ax3 bx 2 cx d
Y determinar los coeficientes, requiriendo
p( x1 ) y1
p( x1 ) y1
p ( x2 ) y2
p( x2 ) y2
(1 2( x x1 ))( x x2 ) 2
(1 2( x x2 ))( x x1 ) 2
p( x)
y1
y2
2
2
( x1 x2 )
( x1 x2 )
( x x1 )( x x2 ) 2
( x x2 )( x x1 ) 2
y1
y2
2
2
( x1 x2 )
( x1 x2 )
Si en vez de conocer la fucin y su derivada en 2 puntos, conocemos estos datos en n puntos, podemos construir un polinomio
de orden 2n-1, continuo y con primera derivada continua.
j 1
j 1
p ( x) hn , j ( x) y j g n, j ( x) yj
que a su vez se pueden escribir en terminos de los polinomios de
Lagrange y su primera derivada:
hn , j ( x) [1 2( x x j ) Ln, j ( x j )]L2n , j ( x)
g n , j ( x) ( x x j ) L2n , j ( x )
hk xk 1 xk
yk 1 yk
k
hk
yk 1 0
Si k y k+1 tienen el mismo signo y los intervalos tienen la misma
longitud, definimos:
1
1 1
1
(
)
yk 1 2 k k 1
Si k y k+1 tienen el mismo signo y los intervalos no tienen la misma
longitud, definimos
w1 w2 w1 w2
yk 1
k k 1
w1 2hk 1 hk
w2 hk 1 2hk