Вы находитесь на странице: 1из 97

uba facultad de ingeniera

ANLISIS NUMRICO I AN
AN

LISIS NUM
LISIS NUM

RICO I
RICO I
INTERPOLACIN
[1]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Si tenemos la siguiente serie de datos:
0,3090 1,257
0,8090 0,628
0,9135 0,419
0,9511 0,314
Y X
[2]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Podemos graficamos los puntos:
0,0
0,1
0,2
0,3
0,4
0,5
0,6
0,7
0,8
0,9
1,0
0,000 0,200 0,400 0,600 0,800 1,000 1,200 1,400
[3]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Con estos datos queremos obtener f(x) para
x=0,500. Cmo hacemos?
Una primera aproximacin puede ser
interpolar linealmente, es decir, construir un
segmento de recta entre los dos puntos
adyacentes al buscado.
Con esto obtenemos:
419 , 0 628 , 0
419 , 0
8090 , 0
628 , 0 419 , 0
628 , 0
9135 , 0 ) f(

=
x x
x
8731 , 0 ) 500 , 0 f( =
[4]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Si este resultado no nos conforma,
busquemos la forma de mejorarlo.
Para ello usemos un polinomio. La idea es
armar un sistema de ecuaciones lineales cuya
forma sea:
n
n
n n n n
n
n
n
n
y x a x a x a a
y x a x a x a a
y x a x a x a a
= + + + +
= + + + +
= + + + +
K
M
K
K
2
2 1 0
1 1
2
1 2 1 1 0
0 0
2
0 2 0 1 0
[5]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Este sistema de ecuaciones se puede
expresar en trminos matriciales:
La matriz A se denomina matriz de
Vandermonde. Es trata de una matriz mal
condicionada.
{ {
B X
A
(
(
(
(

=
(
(
(
(

(
(
(
(
(

n n
n
n n n
n
n
y
y
y
a
a
a
x x x
x x x
x x x
M M
4 4 4 3 4 4 4 2 1
K
M O M M M
K
K
1
0
1
0
2
1
2
1 1
0
2
0 0
1
1
1
[6]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
En lugar de resolver un SEL, existe una forma
simplificada para obtener el polinomio, el
mtodo de Lagrange, cuya expresin o
frmula es:
( )
( )
para ) ( L
0
0
,
j i
x x
x x
x
n
i
i j
n
i
i
j n

=
=
) ( P ) ( P
) ( L ) ( P
0
,
, ,

=
=
=
n
i
i n n
j n j j n
x x
x Y x
[7]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
MTODO DE LAGRANGE MTODO DE LAGRANGE
Con este mtodo se pueden armar polinomios
de diferentes grados:
P
0
(x); P
1
(x); P
2
(x); ...; P
n
(x)
Cada polinomio P
n
(x) est formado por n+1
polinomios P
n,j
(x). As tendremos:

=
=
=
= =
= =
= =
n
j
j n n j n j j n
j
j j j j
j
j j j j
x x x Y x
x x x Y x
x x x Y x
0
, , ,
2
0
, 2 2 , 2 , 2
1
0
, 1 1 , 1 , 1
) ( P ) ( P ) ( L ) ( P
) ( P ) ( P ) ( L ) ( P
) ( P ) ( P ) ( L ) ( P
M
[8]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Si aplicamos estas expresiones para los
datos originales tendremos los polinomios de
Lagrange siguientes:
( )( )( )
( )( )( )
( )( )( )
( )( )( )
( )( )( )
( )( )( )
( )( )( )
( )( )( ) 628 , 0 257 , 1 419 , 0 257 , 1 314 , 0 257 , 1
628 , 0 419 , 0 314 , 0
) ( L
257 , 1 628 , 0 419 , 0 628 , 0 314 , 0 628 , 0
257 , 1 419 , 0 314 , 0
) ( L
257 , 1 419 , 0 628 , 0 419 , 0 314 , 0 419 , 0
257 , 1 628 , 0 314 , 0
) ( L

257 , 1 314 , 0 628 , 0 314 , 0 419 , 0 314 , 0
257 , 1 628 , 0 419 , 0
) ( L
3 , 3
2 , 3
1 , 3
0 , 3


=


=


=


=
x x x
x
x x x
x
x x x
x
x x x
x
[9]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Con los y
j
obtenemos los polinomios P
n,j
(x):
( )( )( )
( )( )( )
( )( )( )
( )( )( )
( )( )( )
( )( )( )
( )( )( )
( )( )( )

=
=



= =


= =


= =


= =
n
j
j
x x
x x x
x y x
x x x
x y x
x x x
x y x
x x x
x y x
0
, 3 3
3 , 3 3 3 , 3
2 , 3 2 2 , 3
1 , 3 1 1 , 3
0 , 3 0 0 , 3
) ( P ) ( P
628 , 0 257 , 1 419 , 0 257 , 1 314 , 0 257 , 1
628 , 0 419 , 0 314 , 0 3090 , 0
) ( L ) ( P
257 , 1 628 , 0 419 , 0 628 , 0 314 , 0 628 , 0
257 , 1 419 , 0 314 , 0 8090 , 0
) ( L ) ( P
257 , 1 419 , 0 628 , 0 419 , 0 314 , 0 419 , 0
257 , 1 628 , 0 314 , 0 9135 , 0
) ( L ) ( P

257 , 1 314 , 0 628 , 0 314 , 0 419 , 0 314 , 0
257 , 1 628 , 0 419 , 0 9511 , 0
) ( L ) ( P
[10]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
La aproximacin que hicimos al empezar es
una interpolacin por el mtodo de Lagrange
tomando slo dos puntos de los cuatro:
419 , 0 628 , 0
419 , 0
8090 , 0
628 , 0 419 , 0
628 , 0
9135 , 0 ) ( P
1

=
x x
x
8731 , 0 ) 500 , 0 ( P
1
=
4 43 4 42 1
4 43 4 42 1
) ( L
1 ; 1 1 1 ; 1
) ( L
0 ; 1 0 0 ; 1
1 ; 1
0 ; 1
419 , 0 628 , 0
419 , 0
8090 , 0 ) ( L ) ( P
628 , 0 419 , 0
628 , 0
9135 , 0 ) ( L ) ( P
x
x
x
x y x
x
x y x

= =

= =
[11]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Este mtodo tiene ventajas y desventajas.
VENTAJAS
Es sencillo de entender.
No incide la distribucin de los puntos.
Las operaciones para armar el polinomio no
dependen de f(x
i
) (y
i
).
DESVENTAJAS
Requiere O(n) operaciones para obtener los
polinomios.
Se debe recalcular todo si se agregan datos.
Es un problema mal condicionado (inestable).
[12]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
En consecuencia, numricamente se prefiere
armar un polinomio interpolante mediante el
mtodo de Newton, cuya expresin general
es:
( ) F ) P(
0
1
0
,
=

=
=
n
i
i
j
j i i
x x x

F F
F con
1 , 1 1 ,
,
j i i
j i j i
j i
x x

=
[13]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
La expresin o frmula matemtica para
obtener el coeficiente F
i,j
es:

) , , , f( ) , , , f(
) , , , f(
i
1 1 2 1
1
j i
i j i j i i j i j i
i j i j i
x x
x x x x x x
x x x

+ + +
+

=
K K
K
y j, i con ) x , , x , f( F
i 1 j - i ,
=
+
K
j i j i
x
[14]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
De esta manera lo que se genera es una tabla
que tiene la forma:
... ... ...
...
...
F(x
3
) x
3
3
F(x
2
)
F(x
1
)
F(x
0
)
F(x
i
) ...
x
2
2
x
0
0
x
1
F(x
i-2
,x
i-1
;x
i
) X
i
1
F(x
i-1
,x
i
) I
( )
( ) ( )
0 1
0 1
1 0
F F
; F
x x
x x
x x

=
( )
( ) ( )
1 2
1 2
2 1
F F
; F
x x
x x
x x

=
( )
( ) ( )
2 3
2 3
3 2
F F
; F
x x
x x
x x

=
( )
( ) ( )
0 2
1 0 2 1
2 1 0
; F ; F
; ; F
x x
x x x x
x x x

=
( )
( ) ( )
1 3
2 1 3 2
3 2 1
; F ; F
; ; F
x x
x x x x
x x x

=
[15]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Tambin se pueden ordenar los puntos en
forma decreciente:
... ... ...
...
...
F(x
n-3
) x
n-3
n-3
F(x
n-2
)
F(x
n-1
)
F(x
n
)
F(x
i
)
x
n-2
n-2
x
n
n
x
n-1
F(x
i-2
,x
i-1
;x
i
) x
i
n-1
F(x
i-1
,x
i
) i
( )
( ) ( )
1
1
1
F F
; F

=
n n
n n
x n
x x
x x
x x
( )
( ) ( )
2
1 2 1
1 2
; F ; F
; ; F

=
n n
n n n n
n n n
x x
x x x x
x x x ( )
( ) ( )
2 1
2 1
1 2
F F
; F


=
n n
n n
n n
x n
x x
x x
( )
( ) ( )
3 2
3 2
2 3
F F
; F


=
n n
n n
n n
x x
x x
x x ( )
( ) ( )
3 1
2 3 1 2
1 2 3
; F ; F
; ; F


=
n n
n n n n
n n n
x x
x x x x
x x x
[16]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
En este caso la expresin general es:
( ) F ) ( P
0
1
0
,
=

=

=
n
i
i
j
j n i i n n
x x x

F F
F con
1 , 1 1 ,
,
j i n i n
j i n j i n
j i n
x x

=
[17]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Si aplicamos el primer caso al ejemplo inicial
obtenemos:
0,3090 1,257 3
0,8090
0,9135
0,9511
F(x
i
) ...
0,628 2
0,314 0
0,419
F(x
i-2
,x
i-1
;x
i
) x
i
1
F(x
i-1
,x
i
) i
( )
314 , 0 419 , 0
9511 , 0 9135 , 0
; F
1 0

= x x
( )
( ) ( )
314 , 0 628 , 0
358 , 0 500 , 0
; ; F
2 1 0


= x x x
( )
419 , 0 628 , 0
9135 , 0 8090 , 0
; F
2 1

= x x
( )
628 , 0 257 , 1
8090 , 0 3090 , 0
; F
3 2

= x x
( )
( ) ( )
419 , 0 257 , 1
500 , 0 745 , 0
; ; F
3 2 1


= x x x
[18]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Si la diferencia entre X
i
sucesivos es constante, se
puede escribir:
entonces

=
|
|

\
|
= + =
n
j
j
j
n n
x x x f h j
j
s
sh x x
0
1 0 0
) , , , ( ! ) ( P ) ( P K
( )
0
1
h s-i x x
sh x x
h x x
i
i i
=
)
`

+ =
=
+
DIFERENCIAS DIVIDIDAS
PROGRESIVAS DE NEWTON
( ) ( )
! j
j s s s
j
s
1 1
y
+
=
|
|

\
| L
[19]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Otra forma es reordenando los valores de X
de n a 0, entonces:
( ) ( )
( ) ( ) ( ) ( )
0 1 2 1
2
1
, , , f 1 1 , , f ) 1 (
, f f ) ( P ) ( P
x x x h n s s s x x x h s s
x x h s x sh x x
n n
n
n n n
n n n n n n
K L

+ + + + +
+ + = + =
( )

h s x x
h i n x x
n
n i
+ =
=
DIFERENCIAS DIVIDIDAS
REGRESIVAS DE NEWTON
[20]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
VENTAJAS
Requiere solamente O(n) operaciones para
obtener los polinomios.
Es numricamente estable.
No requiere recalcular todo si se agregan datos.
DESVENTAJAS
Depende de f(x
i
).
Depende del ordenamiento de los datos.
Con valores de n muy grandes tambin es
numricamente inestable.
[21]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Supongamos que definimos el polinomio L
n
(x)
con la siguiente expresin:
Definamos, a continuacin, un coeficiente
que llamaremos peso baricntrico, y que est
dado por:
( ) ) ( L
0

=
=
n
i
i n
x x x
( )
para
1
0
j i
x x
w
n
i
i j
j

=
[22]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para armar el polinomio L
n,j
(x) segn el
mtodo de Lagrange tradicional, deberamos
hacer:
Y en consecuencia el polinomio completo
tiene la forma:
( )
j
j
n j n
x x
w
x x

= L ) ( L
,
( ) L ) ( P
) ( L ) ( P
0
, ,

=

=
=
n
j
j
j
j
n n
j n j j n
y
x x
w
x x
x y x
MTODO DE
LAGRANGE
MODIFICADO
[23]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
La expresin anterior todava no es la
definitiva. Se puede mejorar y conseguir que
adems sea estable. Supongamos que ahora
interpolamos la funcin constante 1,
entonces:
Pues debemos recordar que:
( ) L ) ( L 1
0 0
,
= =

= =
n
j
j
j
n
n
j
j n
x x
w
x x
1 ) ( L
,
=
j j n
x
[24]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Dividamos la primera expresin por la ltima
hallada:
( )
( )

=
=
=
=

=
n
j
j
j
n
j
j
j
j
n
n
j
j
j
n
n
j
j
j
j
n
n
x x
w
y
x x
w
x
x x
w
x
y
x x
w
x
x
0
0
0
0

) ( P

L
L
) ( P
MTODO DE
LAGRANGE
BARICNTRICO
[25]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para las dos variantes del mtodo tenemos
los siguientes algoritmos:
w j ( ) m 1
m m x
j
x
i

( )
i j if
m m1 otherwise
i 0 3 .. for
w
1
m

:= L x j , ( ) l 1
l l x X i ( ) ( ) i j if
l l 1 otherwise
i 0 3 .. for
L l w j ( )
:=
P
3
x ( )
0
3
j
Y j ( ) L x j , ( )

=
:=
P
b3
x ( )
0
3
j
w j ( ) Y j ( )
x X j ( )

=
0
3
j
w j ( )
x X j ( )

=
:=
[26]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Aplicndolos al ejemplo inicial para x=0,400;
0,500; 0,700 y 1,000; tenemos los siguientes
resultados:
P
3
0.4 ( ) 0.92108176 = P
b3
0.4 ( ) 0.92108176 =
P
3
0.5 ( ) 0.87748106 = P
b3
0.5 ( ) 0.87748106 =
P
3
0.7 ( ) 0.76468481 = P
b3
0.7 ( ) 0.76468481 =
P
3
1.0 ( ) 0.54104746 = P
b3
1.0 ( ) 0.54104746 =
[27]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Tomemos los siguientes puntos
0,933 10,000
0,500 9,000
0,067 8,000
0,933 7,000
0,5 6,000
0,067 5,000
0,933 4,000
0,500 3,000
0,067 2,000
0,933 1,000
0,500 0,000
Y X
[28]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Grafiquemos los puntos segn dos ejes:
2 1 0 1 2 3 4 5 6 7 8 9 10 11 12
2
1.714
1.429
1.143
0.857
0.571
0.286
0.286
0.571
0.857
1.143
1.429
1.714
2
2
2
Y
12 2 X
[29]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Grafiquemos el polinomio obtenido por
Lagrange:
0 1 2 3 4 5 6 7 8 9 10
2
1.714
1.429
1.143
0.857
0.571
0.286
0.286
0.571
0.857
1.143
1.429
1.714
2
2
2
F x ( )
10 0 x
[30]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Pero podemos suponer la curva en azul:
0 1 2 3 4 5 6 7 8 9 10
2
1.714
1.429
1.143
0.857
0.571
0.286
0.286
0.571
0.857
1.143
1.429
1.714
2
2
2
F x ( )
f x ( )
10 0 x
[31]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Evidentemente, hay una diferencia en los
extremos de la curva interpolante. Este
fenmeno se conoce como Fenmeno de
Runge.
Se produce para polinomios de grado alto
(n>4; 5).
Cmo podemos evitar esto interpolando an
con polinomios?
Analizaremos un tipo de interpolacin
polinomial que evite esto.
[32]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Planteemos un conjunto de polinomio que
deben cumplir con lo siguiente:
( ) ( ) ( ) ( )
( ) ( )
( ) ( )
( ) ( )
( ) ( )
1 1 1
1 1 1
1 1 1
3 2
S S
S S
S S
f S
S
+ + +
+ + +
+ + +

=

=
=
+ + + =
j j j j
j j j j
j j j j
j j j
j j j j j j j j
x x
x x
x x
x x
x x d x x c x x b a x
La curva spline pasa por el punto dato
Las curvas son continuas en los puntos comunes
Las primeras derivadas son continuas en los
puntos comunes
Las segundas derivadas son continuas en los
puntos comunes
[33]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Agreguemos condiciones en los extremos.
stas pueden ser:
Algunas variantes pueden ser:
( ) ( )
( ) ( ) ( ) ( ) sujeta) (Frontera f S f S 2)
libre) (Frontera 0 S S 1)
0 0 0
0 0
n n n
n n
x x x x
x x

=

=

( ) ( ) ( ) ( )
( ) ( ) 0 S S 4)
f S f S 3)
0 0
0 0 0
=


=

n n
n n n
x x
x x x x
[34]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
De la condicin:
obtenemos:
que podemos simplificar a
( ) ( ) ( )
1
3
1
2
1 1 + + + +
= + + +
j j j j j j j j j j j
a x x d x x c x x b a
) ( S ) ( S
1 1 1 + + +
=
j j j j
x x
1
3 2
1
+
+
= + + +
=
j j j j j j j j
j j j
a h d h c h b a
x x h
[35]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
De la condicin:
obtenemos:
1
2
3 2
+
= + +
j j j j j j
b h d h c b
) ( S ) ( S
1 1 1 + + +

=

j j j j
x x
[36]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
De la condicin:
obtenemos:
3
2 6 2
1
1
j j
j
j j j j
c c
d
c h d c

=
= +
+
+
) ( S ) ( S
1 1 1 + + +

=

j j j j
x x
[37]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Reemplazando d
j
en ambas ecuaciones anteriores, nos
queda:
y
( )
( )
1 1
1 1
2
+ +
+ +
= + +
= + +
j j j j j
j j j j j j j
b h c c b
b h c c h c b
1
2 1
1
2 1 2
3
2
3
+
+
+
+
=
+
+ +
=

+ + +
j j
j j
j j j
j j
j j
j j j j j
a h
c c
h b a
a h
c c
h c h b a
[38]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Podemos despejar b
j
:
As podemos obtener b
j
con ayuda de b
j-1
j
j j
j
j j
j
j j
j j
j j j
h
c c
h
a a
b
a h
c c
h b a
3
2
3
2
1 1
1
2 1
+ +
+
+
+

=
=
+
+ +
( )
( )
1 1 1
1
1
1 1 1
1 1 1

3
2
3
2

+ +

+ +
+

=
+

+ + =

j j j
b
j
j j
j
j j
b
j
j j
j
j j
j j j j j
h c c h
c c
h
a a
h
c c
h
a a
h c c b b
j j
4 4 4 4 3 4 4 4 4 2 1 4 4 4 4 3 4 4 4 4 2 1
[39]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Entonces, la expresin general para obtener
los polinomios es:
Con esta expresin obtenemos un sistema de
ecuaciones lineales de dimensiones n-1.
( )
( )
j j
j
j j
j
j j
j j j j j j j-
x a
h
a a
h
a a
c h c h h c h
f con
3 2
1
1 1
1 1 1 1
=
(
(

= + + +

+
+
[40]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
El sistema queda:
( )
( )
( )
( )
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(

+
+
+
+



?
h
a a
h
a a
h
a a
h
a a
?
c
c
c
c
c
c
? ?
h h h h
h h h h
h h h h
h h h h
? ?
n
n n
n
n n
n
n
n
n n n n
n n n n
2
2 1
1
1
0
0 1
1
1 2
1
2
2
1
0
1 1 2 2
2 2 3 3
2 2 1 1
1 1 0 0
3
3
0 0
2 0
0 2

2 0
0 0 2
0 0
M
M
K K
O M
M O O O O
M
K
K K
[41]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Si es el caso de frontera libre, tendremos:
( )
( )
( )
( )
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(

+
+
+
+



0
3
3
0
1 0 0 0
2 0
0 2

2 0
0 0 2
0 0 0 1
2
2 1
1
1
0
0 1
1
1 2
1
2
2
1
0
1 1 2 2
2 2 3 3
2 2 1 1
1 1 0 0
n
n n
n
n n
n
n
n
n n n n
n n n n
h
a a
h
a a
h
a a
h
a a
c
c
c
c
c
c
h h h h
h h h h
h h h h
h h h h
M
M
K K
O M
M O O O O
M
K
K K
[42]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Si es el caso de frontera sujeta, tendremos:
( )
( )
( )
( )
( )
( )
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(

+
+
+
+




1
1
2
2 1
1
1
0
0 1
1
1 2
0
0
0 1
1
2
2
1
0
1 1
1 1 2 2
2 2 3 3
2 2 1 1
1 1 0 0
0 0
3
3
3
3
2 0 0
2 0
0 2

2 0
0 0 2
0 0 2
n
n n
n
n
n n
n
n n
n
n
n
n n
n n n n
n n n n
h
a a
x f
h
a a
h
a a
h
a a
h
a a
x f
h
a a
c
c
c
c
c
c
h h
h h h h
h h h h
h h h h
h h h h
h h
M M
K K
O M
M O O O O
M
K
K K
[43]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
En una de las variantes tendremos:
( )
( )
( )
( )
(
(
(
(
(
(
(
(
(
(
(
(
(
(


=
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(

+
+
+
+



2
) (
3
3
2
) (
1 0 0 0
2 0
0 2

2 0
0 0 2
0 0 0 1
2
2 1
1
1
0
0 1
1
1 2
0
1
2
2
1
0
1 1 2 2
2 2 3 3
2 2 1 1
1 1 0 0
n
n
n n
n
n n
n
n
n
n n n n
n n n n
x f
h
a a
h
a a
h
a a
h
a a
x f
c
c
c
c
c
c
h h h h
h h h h
h h h h
h h h h
M M
K K
O M
M O O O O
M
K
K K
[44]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
En la otra variante:
( )
( )
( )
( )
(
(
(
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(

+
+
+
+




1
1
2
2 1
1
1
0
0 1
1
1 2
0
0 1
1
2
2
1
0
1 1
1 1 2 2
2 2 3 3
2 2 1 1
1 1 0 0
0 0
3
3
3
3
2 0 0
2 0
0 2

2 0
0 0 2
0 0 2
n
n n
n
n n
n
n n
n
n
n
n n
n n n n
n n n n
h
a a
h
a a
h
a a
h
a a
h
a a
h
a a
c
c
c
c
c
c
h h
h h h h
h h h h
h h h h
h h h h
h h
M M
K K
O M
M O O O O
M
K
K K
[45]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
En nuestro ejemplo con
( ) ( ) 524 , 0 10 f ; 047 , 1 0 f =

0 1 2 3 4 5 6 7 8 9 10
2
1.714
1.429
1.143
0.857
0.571
0.286
0.286
0.571
0.857
1.143
1.429
1.714
2
2
2
S x ( )
f x ( )
10 0 x
[46]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Una forma alternativa de armar las curvas es:
Con esta expresin obtenemos un sistema de
ecuaciones lineales de dimensiones n-1.
( ) ( ) ( ) ( ) ( )
( )
(
(

= + + +

|
|

\
|
+
|
|

\
|
+ + =

+
+
+ +
+ +
+
1
1 1
1 1 1 1
1 1
1
3
1
3 1
6 2
6 6 6 6
S
j
j j
j
j j
j j j j j j j-
j
j j
j
j
j
j j
j
j
j
j
j
j
j
j
j
h
y y
h
y y
d h d h h d h
x x
h d
h
y
x x
h d
h
y
x x
h
d
x x
h
d
x
[47]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
En el caso de frontera libre, tendremos:
( )
( )
( )
( )
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(

+
+
+
+



0
6
6
0
1 0 0 0
2 0
0 2

2 0
0 0 2
0 0 0 1
2
2 1
1
1
0
0 1
1
1 2
1
2
2
1
0
1 1 2 2
2 2 3 3
2 2 1 1
1 1 0 0
n
n n
n
n n
n
n
n
n n n n
n n n n
h
y y
h
y y
h
y y
h
y y
d
d
d
d
d
d
h h h h
h h h h
h h h h
h h h h
M
M
K K
O M
M O O O O
M
K
K K
[48]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
En el caso de frontera sujeta, tendremos:
( )
( )
( )
( )
( )
( )
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(

+
+
+
+




1
1
2
2 1
1
1
0
0 1
1
1 2
0
0
0 1
1
2
2
1
0
1 1
1 1 2 2
2 2 3 3
2 2 1 1
1 1 0 0
0 0
6
6
6
6
2 0 0
2 0
0 2

2 0
0 0 2
0 0 2
n
n n
n
n
n n
n
n n
n
n
n
n n
n n n n
n n n n
h
y y
x f
h
y y
h
y y
h
y y
h
y y
x f
h
y y
d
d
d
d
d
d
h h
h h h h
h h h h
h h h h
h h h h
h h
M M
K K
O M
M O O O O
M
K
K K
[49]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Supongamos ahora que tenemos la siguiente
serie de datos:
y
n

y
1
y
0
Y
y
n
x
n
...
y
1
x
1
y
0
x
0
Y X
[50]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Podemos usar un polinomio para interpolar,
armando un sistema de ecuaciones lineales
cuya forma ser:
n
m
n m n n
m
m
n
m
n m n n
m
m
y x a m x a x a a
y x a m x a x a a
y x a x a x a a
y x a x a x a a

= + + + +

= + + + +
= + + + +
= + + + +

1 2
3 2 1
0
1
0
2
0 3 0 2 1
2
2 1 0
0 0
2
0 2 0 1 0
3 2
3 2
K
M
K
K
M
K
[51]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Este sistema de ecuaciones se puede
expresar en trminos matriciales:
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(

n
n
m
m
m
n n n
m
m
n n n
m
y
y
y
y
a
a
a
a
x m x x
x m x x
x x x
x x x
M
M
M
M
L
M M M M M M
L
L L
M M M M M M
L L
0
0
1
1
0
1 2
1
0
2
0 0
2
0
2
0 0

3 2 1 0
3 2 1 0
1
1
[52]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Lo primero es fijar el exponente m de este
polinomio.
Puesto que tenemos y
0
, y
1
, ,y
n
, y
0
, y
1
, , y
n
,
contamos con 2(n+1) datos.
Por lo tanto, podemos armar un polinomio de
grado 2(n+1)-1; es decir, m = 2n+1.
Tenemos otra vez un sistema de ecuaciones
lineales que nos facilita resolver el problema.
[53]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Nuestro sistema quedar como:
( )
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(

+
+
+
+
+
+
n
n
n
i
i
n
n n n
n
n
n n n
n
y
y
y
y
a
a
a
a
x n x x
x n x x
x x x
x x x
M
M
M
M
L
M M M M M M
L
L L
M M M M M M
L L
0
0
1 2
1
0
2 2
2
0
2
0 0
1 2 2
1 2
0
2
0 0

) 1 2 ( 3 2 1 0
1 2 3 2 1 0
1
1
[54]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Pero hemos visto que para interpolar los
datos, resulta ms fcil utilizar algn
algoritmo que resolver el sistema en forma
explcita.
Veamos como armar este nuevo mtodo.
Para ello nos ayudaremos de lo que ya hemos
aprendido.
[55]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para empezar, propongamos que nuestro
polinomio interpolante est compuesto por la
suma de dos polinomios:
Si analizamos un poco los dos polinomios
que lo componen, vemos que la forma es
anloga al obtenido por Lagrange.
Por qu no usar entonces un algoritmo que
incluya los polinomios de Lagrange [L
n,i
(x)].
) ( H

) ( H ) ( H
0
;
0
; 1 2
= =
+

+ =
n
i
i n i
n
i
i n i n
x y x y x
[56]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
As, las expresiones para esos polinomios
son:
Veamos si estos nuevos polinomios cumplen
con las condiciones que vimos para
Lagrange, cuando reemplazamos x
i
y x
j
con j
distinto de i.
( ) [ ][ ]
( )[ ]
2
, ,
2
, , ,
) ( L ) ( H

) ( L ) ( L 2 1 ) ( H
x x x x
x x x x x
i n i i n
i n i i n i i n
=

=
[57]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para el primer polinomio tenemos:
Para el segundo tenemos:
( ) [ ][ ] [ ]
( ) [ ][ ]
0 ) ( H ) ( H
0 ) ( L ) ( L 2 1 ) ( H
1 1 0 1 ) ( L ) ( L 2 1 ) ( H
, ,
2
, , ,
2
2
, , ,
=

=
= =

=
j i n i i n
j i n i i n i j j i n
i i n i i n i i i i n
x x
x x x x x
x x x x x
[ ] ( )
[ ] ( ) 0 ) ( L ) ( L 2 ) ( L ) ( H

1 ) ( L ) ( L 2 ) ( L ) ( H

0 ) ( H

) ( H

, ,
2
, ,
, ,
2
, ,
, ,
=

+ =

+ =

= =
j i n j i n i j j i n j i n
i i n i i n i i i i n i i n
j i n i i n
x x x x x x
x x x x x x
x x
[58]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Como vemos, si reemplazamos x
i
en el
polinomio tenemos:
En consecuencia, este algoritmo cumple con
la condicin de pasar por los puntos que son
datos. Este algoritmo se conoce como
Interpolaci Interpolaci n de Hermite n de Hermite.
i i
0
;
0
; 1 2
i i
0
;
0
; 1 2
1 0 ) ( H

) ( H ) ( H
0 1 ) ( H

) ( H ) ( H
y y y x y x y x
y y y x y x y x
i
n
i
i i n i
n
i
i i n i i n
i
n
i
i i n i
n
i
i i n i i n

+ =

+

+ =

+ =


= =
+
= =
+
[59]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Tambin podemos aplicar una adaptacin del
mtodo de Newton para interpolar valores.
Para ello armemos una nueva tabla con los
datos del problema.
Esta tabla se har con una nueva variable z
j
,
cuyos valores cumplirn la siguiente
condicin:
con
{ {
i
z
i
z
i
x z z
j j
= =
+
+
1
1 2 2
1 2 ; 2 ; ; 1 ; 0 ; ; 1 ; 0 + = = n n j n i K K
[60]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
As queda la tabla del mtodo de Newton
adaptado para la interpolacin por Hermite:
F(z
5
)=F(x
2
) x
2
z
5
5
F(z
4
)=F(x
2
) x
2
z
4
4
z
3
z
2
z
1
z
0
Z
i
... ... ...
...
...
F(z
3
)=F(x
1
) x
1
3
F(z
2
)=F(x
1
)
F(z
1
) =F(x
0
)
F(z
0
) =F(x
0
)
F(x
i
) ...
x
1
2
x
0
0
x
0
F(x
i-2
,x
i-1
;x
i
) x
i
1
F(x
i-1
,x
i
) I
( )
( ) ( )
1 2
1 2
2 1
F F
; F
z z
z z
z z

=
( )
( ) ( )
0 2
0 2 1
2 1 0
F ; F
; ; F
z z
x z z
z z z


=
( )
( ) ( )
1 3
2 1 1
3 2 1
; F F
; ; F
z z
z z x
z z z


=
( )
( ) ( )
( )
0
0 1
0 1
1 0
F
F F
; F x
z z
z z
z z =

=
( )
( ) ( )
( )
1
2 3
2 3
3 2
F
F F
; F x
z z
z z
z z =

=
( )
( ) ( )
2 4
1 4 3
4 3 2
F ; F
; ; F
z z
x z z
z z z


=
( )
( ) ( )
3 4
3 4
4 3
F F
; F
z z
z z
z z

=
( )
( ) ( )
3 5
4 3 2
5 4 3
; F F
; ; F
z z
z z x
z z z


= ( )
( ) ( )
( )
2
4 5
4 5
5 4
F
F F
; F x
z z
z z
z z =

=
[61]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Con esta tabla podemos armar nuestro
polinomio interpolante, que ser:
que expresado en trminos de x queda:
( )
( )
( ) ( )
( )
( ) ( )
( )( ) K +

+ =
=

+
=

=
1 0
0 2
1 0 2 1
0
0 1
0 1
0
1 2
0
1
0
,

, F , F F F
F ) ( P
F ) ( P
z z z z
z z
z z z z
z z
z z
z z
z z
z z z
n
n
i
i
j
j i i n
( ) ( )( )
( ) ( )
( ) K +

+ =
2
0
0 1
0 1 0
0 0 0
F , F
F F ) ( P x x
x x
x x x
x x x x x
n
[62]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Conocer ms datos de la funcin permite
mejorar la interpolacin.
Con Lagrange, con n+1 datos, el polinomio
ms grande es de grado n; con Hermite, el
grado del polinomio es 2n+1.
Pero se mantienen los mismos problemas ya
vistos:
Potencialmente mal condicionado.
Con valores de n muy grandes es numricamente
inestable.
[63]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para evitar esto ltimo, es usual interpolar
mediante Hermite pero con fragmentos de
curvas entre dos puntos sucesivos.
Al contar con cuatro datos (y
i
, y
i
, y
i+1
, y
i+1
), la
curva interpolante entre ambos puntos
sucesivos resulta ser una parbola cbica.
Resulta ser similar a la aplicacin de los
trazadores cbicos, slo que no es necesario
imponer condiciones a las derivadas
superiores a uno.
[64]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para este caso tendremos:
Tal como vimos, surgen a partir de un
polinomio de Lagrange de primer orden.
( ) [ ][ ]
( )[ ]
2
, 1 , 1
2
, 1 , 1 , 1
1
0
, 1
1
0
, 1 , 3
) ( L ) ( H

) ( L ) ( L 2 1 ) ( H
) ( H

) ( H ) ( H
x x x x
x x x x x
x y x y x
i i i
i i i i i
i
i i
i
i i i
=

+ =

= =
[65]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Si desarrollamos quedan los polinomios:
( )
( )
( )
( )
2
1
1 1 , 1
2
1
1
, 1
2
1 1
1
1 , 1
2
1
1
1
, 1
) ( H

) ( H

2
1 ) ( H

2
1 ) ( H
(

=
(

=
(

=
(

=
+
+ +
+
+
+ +
+
+
+
+
+
i i
i
i i
i i
i
i i
i i
i
i i
i
i
i i
i
i i
i
i
x x
x x
x x x
x x
x x
x x x
x x
x x
x x
x x
x
x x
x x
x x
x x
x
[66]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
La expresin completa del polinomio es:
con i=0; 1; , n.
Es decir, construimos n segmentos de una
parbola cbica, que pasan por y
i
y por y
i
.
Al igual que para los trazadores cbicos,
obtenemos un conjunto de curvas entre x
0
y
x
n
.
) ( H

) ( H

) ( H ) ( H ) ( H
1 , 1 1 , 1 1 , 1 1 , 1 , 3
x y x y x y x y x
i i i i i i i i + + +

+

+ + =
[67]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Hemos visto varias formas de interpolar con
polinomios un conjunto de datos. Qu error
se comete al aplicarlos?
Debemos tener en cuenta que no conocemos
la funcin que vincula a los x
i
e y
i
, por lo
tanto, el error que estimemos ser terico.
Para determinar este error, supongamos por
un momento que conocemos la funcin f(x).
Con esta suposicin, podemos estimar el
error cuando interpolamos por Lagrange y
por Hermite.
[68]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para el caso de la interpolacin por Lagrange
tenemos:
( )
( )
[ ] [ ]
[ ]. ; C ) f( y
; , ; ; ; ; ; con
! 1
) ( f
) ( P ) f( ) E(
1
2 1 0
0
1
n
b a x
b a b a x x x x x
x x
n
x x x
n
n
n
i
i
n
+
=
+

+
= =

K
[69]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para la interpolacin por trazadores cbicos
(splines) podemos estimar el error con la
siguiente expresin:
[ ]
[ ]
[ ]. ; C ) f( y
; ; ; ; ; , con
) max(
384
) ( f 5
) S( ) f( ) E(
4
1 0 1
4
b a x
b a x x x x x h
h x x x
n i i i
i
iv

=
= =
+

K
[70]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Para el caso de la interpolacin por Hermite
tenemos:
(se deduce del error de la interpolacin de
Lagrange).
( ) [ ]
( )
[ ] [ ]
[ ]. ; C ) f( y
; , ; ; ; ; ; con
! 1 2
) ( f
) ( H ) f( ) E(
) 1 ( 2
2 1 0
0
2
) 1 ( 2
n
b a x
b a b a x x x x x
x x
n
x x x
n
n
n
i
i
n
+
=
+

+
= =

K
[71]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Y en el caso de la interpolacin por Hermite
segmentada tenemos:
Vemos que es similar al error cometido al
interpolar con trazadores cbicos o splines.
[ ]
[ ]. ; C ) f( y
; ; ; ; ; ; , - con
) max(
384
) ( f
) ( H ) f( ) E(
) 1 ( 2
2 1 0 1
4
3
b a x
b a x x x x x x x h
h x x x
n
n i i
i
iv
+
+

= =
= =

K
[72]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Como hemos visto, existen varias formas de
interpolar con polinomios un conjunto de
datos.
No hay una sola solucin al problema de
obtener puntos intermedios de un conjunto
de datos.
Por lo tanto, la seleccin de uno u otro
mtodo est fuertemente inducida e influida
por el origen de esos datos.
Dicho de otro modo, es importante saber en
(o con) qu se est trabajando.
[73]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
INTERPOLACIN INTERPOLACIN
Como ejemplo, en el anlisis estructural, el
mtodo de los elementos finitos utiliza la
interpolacin como estimacin de la funcin
desplazamiento (elstica de deformacin).
El mtodo utiliza alternativamente, la
interpolacin por Lagrange y por Hermite,
para estructuras reticulares y aporticadas.
Ms an, utiliza superficies interpolantes para
estructuras que pueden definirse mediante
estados planos de tensin o deformacin.
[74]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
INTERPOLACIN uba facultad de ingeniera
BIBLIOGRAFA Y ARTCULOS BIBLIOGRAFA Y ARTCULOS
Burden, R.L. y Faires, J.D. Anlisis Numrico.
International Thomson. Sexta edicin. 1998.
Berrut, J.P. y Trefethen, L. N. Barycentric Lagrange
Interpolation. SIAM. 2004.
Higham, N. J. The numerical stability of Barycentric
Lagrange Interpolation. IMA. 2004.
Gonzlez, H. Anlisis numrico. Primer curso. Nueva
Librera. 2002.
Samarski, A.A. Introduccin a los mtodos numricos.
Mir. 1986.
uba facultad de ingeniera
ANLISIS NUMRICO I AN
AN

LISIS NUM
LISIS NUM

RICO I
RICO I
AJUSTE DE CURVAS
[1]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Supongamos que tenemos los siguientes
datos:
x y
4,0 102,56
4,1 115,00
4,2 112,18
4,3 118,36
4,4 128,31
4,5 125,11
4,6 138,41
4,7 150,25
4,8 155,26
4,9 162,39
5,0 165,47
5,1 178,60
5,2 179,65
5,3 182,21
5,4 192,40
5,5 195,14
5,6 200,52
5,7 207,20
5,8 221,36
5,9 220,87
Grfico
50,00
70,00
90,00
110,00
130,00
150,00
170,00
190,00
210,00
230,00
3,5 4,0 4,5 5,0 5,5 6,0 6,5
x
y
[2]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Evidentemente, realizar una interpolacin
polinmica para esta cantidad de datos no
resulta prctico. (Mal condicionamiento del
problema.)
Por lo tanto, lo que conviene hacer es obtener
una curva que se adapte lo mejor posible a
los datos disponibles, proponiendo una
funcin de esta forma:
( ) ( ) ( ) ( ) ( )
( )

=
=
+ + + + =
n
j
j j
n n
x c
x c x c x c x c x
0
2 2 1 1 0 0
h

K
[3]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Esto se suele conocer como Mejor
Aproximacin (Best Approximation).
Para efectuar esta aproximacin vamos a
tomar el residuo, es decir:
Buscaremos alguna manera de minimizar el
residuo.
Recordemos que el residuo es un vector.
( ) m i x y r
i i i
= 0 ; h
[4]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Con un vector, lo que debemos hacer mnimo
es la norma del mismo.
Hay varias normas conocidas:
La norma l
1
:
La norma l

:
La norma l
2
:
( )

= =
= =
m
i
i i
m
i
i
x y r
0 0
1
h r
( )
i i
m i
x y h max
0
=

r
( ) | |

= =
= =
m
i
i i
m
i
i
x y r
0
2
0
2
2
h r
[5]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Cada una tiene su aplicacin:
Norma l
1
: til cuando queremos descartar datos
con errores de medicin.
Norma l

: til cuando debemos considerar el
mayor error en la aproximacin.
Las aproximaciones basadas en las normas
anteriores llevan a problemas de
Programacin Lineal.
Nuestra mejor aproximacin la obtenemos al
hacer mnima la norma l
2
.
[6]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Una particularidad es que si n=m, entonces
hay una sola curva que aproxima a los datos,
pues para las tres normas el mnimo es cero.
Es decir, es el caso de Interpolacin.
En cambio, para m>n, tendremos diferentes
aproximaciones, segn la norma aplicada.
Utilizar la ltima norma para minimizar el
residuo, define el Mtodo de los Mnimos
Cuadrados (o Aproximacin por Cuadrados
Mnimos).
Debera llamarse Mtodo o Aproximacin por el Error Cuadrtico Mnimo.
[7]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Para empezar definamos:
Entonces:
Si aproximamos por mnimos cuadrados
debemos minimizar:
( ) n j y m i x a
i j j i
; ; 2 ; 1 ; 0 ; ; 2 ; 1 ; 0 ;
;
K K = = =
( ) ( )
j i
n
j
j
n
j
i j j i
a c x c x
;
0 0
h

= =
= =
2
0 0

= =
(

m
i
j ; i
n
j
j i
a c y
[8]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Es decir, debemos obtener los coeficientes c
j
que hacen mnima la norma eucldea del
residuo.
Definamos la siguiente matriz:
(
(
(
(
(

=
n m m m
n
n
a a a
a a a
a a a
; 1 ; 0 ;
; 1 1 ; 1 0 ; 1
; 0 1 ; 0 0 ; 0
L
M O M M
L
L
A
[9]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Armemos el siguiente sistema:
Esto significa imponer que el residuo sea
nulo, es decir:
(
(
(
(

=
(
(
(
(

(
(
(
(
(

=
m n
n m m m
n
n
y
y
y
c
c
c
a a a
a a a
a a a
M M
L
M O M M
L
L
1
0
1
0
; 1 ; 0 ;
; 1 1 ; 1 0 ; 1
; 0 1 ; 0 0 ; 0
0 y Ac
0 = r
[10]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Este sistema no tiene solucin nica puesto
que m>n. Por lo tanto, no podemos imponer
esta condicin.
La condicin que se debe imponer que los c
j
minimicen la expresin:
2
2
2
2
Ac y r =
[11]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Recordemos como se obtena un mnimo para
una funcin:
Como:
| |
n ; 2; ; 1 ; 0 ; 0
d
) f( d
K = = j
c
j
c
( )
( )

= =
(

= =
= =
m
i
n
j
j j i i
c a y
0
2
0
;
2
2 2
f
f
r c
Ac y r c
[12]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
La condicin para obtener un mnimo es:
Esto se puede escribir como:
( ) | |
( ) 0 2
d
d
d
f d
0
;
0
;
2
=
(
(

|
|

\
|
= =

= =
m
i
k i
n
j
j j i i
k k
a c a y
c c
r
c

= = =
= =
m
i
i k ; i
m
i
n
j
j j ; i k ; i
n ; ; ; ; k ; y a c a a
0 0 0
2 1 0 K
[13]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
En forma matricial se expresa como:
Si definimos:
Por lo tanto, nos queda:
Es decir, un sistema de ecuaciones lineales.
y A Ac A
T T
=
y A B A A M
T T
= = ;
B c M =
[14]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Por ejemplo, para
M
Mtenemos:
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
(
(
(
(

(
(
(
(

=
(
(
(
(
(

(
(
(
(
(

= =
m n m m
n
n
m n n n
m
m
n m m m
n
n
n m n n
m
m
T
x x x
x x x
x x x
x x x
x x x
x x x
a a a
a a a
a a a
a a a
a a a
a a a






L
M O M M
L
L
L
M O M M
L
L
L
M O M M
L
L
L
M O M M
L
L
1 0
1 1 1 1 0
0 0 1 0 0
1 0
1 1 1 0 1
0 1 0 0 0
; 1 ; 0 ;
; 1 1 ; 1 0 ; 1
; 0 1 ; 0 0 ; 0
; ; 1 ; 0
1 ; 1 ; 1 1 ; 0
0 ; 0 ; 1 0 ; 0
A A M
[15]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Podemos definir entonces que:
Anlogamente:
Una forma de notacin es:
( ) ( )
0

=
=
m
i
i k i j jk
x x M
( )

=
=
m
i
i j i j
x y B
0

( ) ( ) ( ) ( ) ( )
( ) ( ) ( )
i j i
m
i
i j i j
i k i j
m
i
i k i j jk
x y x y B
x x x x M


;
;
0
0
= =
= =

=
=
[16]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Si aplicamos el mtodo a un polinomio,
tendremos:
Podemos ver que la matriz
A
A resultante es la
matriz de Vandermonde:
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
(
(
(
(
(

=
(
(
(
(

n
m m m
n
n
m n m m m
n
n
x x x
x x x
x x x
x x x x
x x x x
x x x x
K
M O M M M
K
K
K
M O M M M
K
K
2
1
2
1 1
0
2
0 0
2 1 0
1 1 2 1 1 1 0
0 0 2 0 1 0 0
1
1
1



( ) ( ) ( )
j
j
n
j
j j
n
n
x x ; x c x c x c x c c x p = = + + + + =

=

0
2
2 1 0
K
[17]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
As, la matriz
M
Mqueda de la forma:
Por lo que las componentes de
M
M se pueden
calcular con la expresin:
(
(
(
(
(

(
(
(
(
(

=
n
m m m
n
n
n
m
n n n
m
x x x
x x x
x x x
x x x x
x x x x
K
M O M M M
K
K
K
M O M M M
K
K
2
1
2
1 1
0
2
0 0
2 1
2 1 0
1
1
1
1 1 1 1
0
M
( ) ( )

= =
= =
m
i
k j
m
i
i k i j jk
i i
x x x x M
0 0

[18]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
La componente M
0;0
es:
Las componentes M
0;1
y M
1;0
son:
( ) ( ) 1 1 1 1
0 0 0
0 0
0
0 0 0 ; 0
+ = = = = =

= = = =
m x x x x M
m
i
m
i
m
i
m
i
i i
i i

( ) ( )

= = = =
= = = =
m
i
m
i
m
i
m
i
i i
i i
i i
x x x x x x M
0 0 0
1 0
0
1 0 1 ; 0
1
( ) ( )

= = = =
= = = =
m
i
m
i
m
i
m
i
i i
i i i i
x x x x x x M
0 0 0
0 1
0
0 1 0 ; 1
1
[19]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
Por lo tanto, se cumple que:
Anlogamente, se tiene:
En consecuencia, la matriz M del sistema de
ecuaciones lineales tiene las siguientes
caractersticas:
Es simtrica.
Es definida positiva.
Es densa (salvo excepciones).
j k k j
M M
; ;
=
( )

= =
= =
m
i
j
i i
m
i
i j i j
x y x y B
0 0

[20]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
AJUSTE DE CURVAS AJUSTE DE CURVAS
VENTAJAS
Es sencillo de entender.
Se pueden usar todo tipo de funciones, inclusive
polinmicas.
Dado que la matriz de coeficientes es simtrica
definida positiva, se puede aplicar el mtodo de
Cholesky.
DESVENTAJAS
La funcin no pasa por los datos, salvo
excepciones.
Si se aproxima con polinomios de grado superior,
el sistema se vuelve mal condicionado e inestable.
[21]
7
5
.
1
2


-
a
n

l
i
s
i
s

n
u
m

r
i
c
o

i
AJUSTE DE CURVAS uba facultad de ingeniera
BIBLIOGRAFA BIBLIOGRAFA
Burden, R.L. y Faires, J.D.. Anlisis Numrico.
International Thomson. Sexta edicin. 1998.
Gonzlez, H.. Anlisis numrico. Primer curso.
Nueva Librera. 2002.
Samarski, A.A.. Introduccin a los mtodos
numricos. Mir. 1986.

Вам также может понравиться