Sunteți pe pagina 1din 45

UNIVERSIDAD DE GRANADA

DEPARTAMENTO DE MATEMTICA APLICADA www.ugr.es/local/mateapli

INTERPOLACIN

2006-2007

Jos Martnez Aroza

Introduccin

Interpolar (D.R.A.E.): Averiguar el valor aproximado de una magnitud en un intervalo cuando se conocen algunos de los valores que toma a uno y otro lado de dicho intervalo, y no se conoce la ley de variacin de la magnitud.

Interpolacin

2/90

Introduccin
ventas

800

600

400

200

meses

Interpolacin

3/90

Introduccin
ventas

800

600

400

200

meses

Interpolacin

4/90

Interpolacin Lagrangiana
Problema de Interpolacin Lagrangiana (versin previa): Dados los nodos { x0 , x1 ,, x n } y sus valores respectivos { y 0 , y1 ,, y n }, obtngase una funcin

p(x ) sencilla que verifique p( xi ) = yi , i = 0,1,, n .

10

1 -5

Interpolacin

5/90

Interpolacin Lagrangiana

p : funcin interpoladora o interpolante


Sencilla = hay que fijar un espacio de funciones F . Problema bien planteado dim F = n + 1 = n de datos. Problema de Interpolacin Lagrangiana (P.I.L.): Dados los nodos { x0 , x1 ,, x n } y sus valores respectivos { y 0 , y1 ,, y n }, y dado (o fijado) un espacio de funciones F con dim F = n + 1, obtngase una funcin p F que verifique p ( xi ) = yi , i = 0,1,, n . Problema de Interpolacin Polinomial Lagrangiana (P.I.P.L.): Dados los nodos { x0 , x1 ,, x n } y sus valores respectivos { y 0 , y1 ,, y n }, obtngase un polinomio

p P tal que p( x i ) = y i , i = 0,1, , n . n

Interpolacin

6/90

Interpolacin Lagrangiana
Resolucin del P.I.L.: Se escoge una base { 0 , 1 ,, n } de F y se busca condiciones de interpolacin

p = a j j que cumpla las


j =0

+ an n ( x0 ) = y0 p( x1 ) = y1 a0 0 ( x1 ) + a11 ( x1 ) + + an n ( x1 ) = y1 p( xn ) = y0 a0 0 ( xn ) + a11 ( xn ) + + an n ( xn ) = yn
(Sistema lineal

p( x0 ) = y0 a0 0 ( x0 ) + a11 ( x0 ) +

( n + 1) ( n + 1) con incgnitas a j .)

El P.I.L. es unisolvente (solucin nica)

el sistema es C.D.

Solucin = coeficientes de la funcin interpoladora.

Interpolacin

7/90

Interpolacin Lagrangiana
Ejemplo:

x 1 y 0

3 4

1 2

, F = P = 1, x, x , x 3
2

Polinomio buscado: Sistema:

p ( x ) = a 0 + a1 x + a 2 x 2 + a 3 x 3 .
+ a1 a1 + + a2 a2 + a3 a3 0 = 1 = 2 = 4 =

a0 a0 a0 a0

+ 3a1

+ 9a 2

+ 27a 3

p ( x ) = x 3 2 x 2 2 x + 1.

Interpolacin

8/90

Interpolacin Lagrangiana

-2

-1

-5

- 10

Interpolacin

9/90

Interpolacin Lagrangiana
Unisolvencia del P.I.P.L.: Usando la base {1, x,, x }, el determinante de la matriz de coeficientes es el det. de Vandermonde
n

1 x 0 1 x1 det 1 x n

2 x0 x12

2 xn

n x0 n x1 = ( xi x j ); i> j n xn

det 0 las abscisas x i no se repiten (no hay dos iguales).


Demostracin: restando a cada columna la anterior

x0 ,
x1n 1 n ( xi x0 ) . n 1 x n i =1
10/90

0 1 1 x x 1 0 = det 1 xn x0
Interpolacin

0 1 x1 x ( x1 x0 ) = det 1 xn n xn 1 ( xn x0 )
n 1 1

Interpolacin Lagrangiana
Para no tener que resolver s.e.l. se emplean frmulas de interpolacin, que dan directamente el polinomio de interpolacin. Frmulas clsicas: la Frmula de Lagrange y la Frmula de Newton. Diferentes expresiones, pero el mismo objetivo: el polinomio de interpolacin.

Interpolacin

11/90

Frmula de Lagrange

FRMULA DE LAGRANGE

Interpolacin

12/90

Frmula de Lagrange
Dados los nodos {x0 , x1 ,, x n }, los polinomios fundamentales de Lagrange
0

,,

P son aquellos que verifican n


0

( xn ) = 0 1 ( xn ) = 0 , es decir, n ( x0 ) = 0, n ( x1 ) = 0, n ( xn ) = 1
0 0

( x0 ) = 1, 1 ( x0 ) = 0,

( x1 ) = 0, 1 ( x1 ) = 1,

1 si i = j ( xi ) = ij = 0 si i j

(delta de Kronecker). Una vez obtenidos, la solucin del P.I.P.L. es la Frmula de Lagrange

p( x ) = y 0
En efecto, p ( x i ) =
Interpolacin
n

( x ) + y1 1 ( x ) +
n

+ yn

( x) = y j
j =0

( x).

y
j =0

( x i ) = y j ij = y i .
j =0

13/90

Frmula de Lagrange
Construccin de los polinomios fundamentales de Lagrange:
0

se anula en x1 , , x n es divisible por ( x x1 ), ( x x 2 ), , ( x x n ) 0 = K ( x x1 )( x x 2 ) ( x x n ) , con K = cte.

Se escoge K para que

( x0 ) = 1 K =

1 ( x 0 x1 )( x 0 x 2 )

( x0 xn )

por tanto

x x1 x x2 0 ( x) = x0 x1 x0 x2
j ( x) = i =0 n

n x xn x xi = . x0 xn i =1 x0 xi

En general

x xi (hay un error). x j xi

Ejercicio: demostrar que Interpolacin

{ 0 , 1 , , n } es una base de P . n
14/90

Frmula de Lagrange
Ejemplo:

x 1 y 0

3 4

1 2

, unisolvente en P . 3

x 0 x 1 x 3 0 1 0 11 1 3 x +1 x 1 x 3 = 1 0 +1 0 1 0 3 x +1 x 0 x 3 = 2 1+1 1 0 1 3 x +1 x 0 x 1 3 = 3 +1 3 + 0 3 1 = p=0
0

1 3 ( x 4 x 2 + 3x ) 8 1 = ( x 3 2 x 2 x + 4) 3 1 = ( x 3 2 x 2 3x ) 4 1 = ( x3 x) 24

+1 1 2

+4

= x3 2 x2 2 x + 1

Interpolacin

15/90

Frmula de Lagrange

3 2 1

-2

-1 -1 -2

Interpolacin

16/90

Frmula de Lagrange
Ventaja de la frmula de Lagrange: Los polinomios fundamentales slo dependen de los nodos {x0 , x1 ,, x n }; varios P.I.P.L. con el mismo conjunto de abscisas comparten los mismos polinomios fundamentales.
600 500 400 300 200 100 Gastos 1 2 3 4 Contado Crdito

Inconveniente de la frmula de Lagrange: Si se aade nueva informacin (un nuevo punto), hay que reconstruir casi todo. Interpolacin 17/90

Frmula de Newton

FRMULA DE NEWTON

Interpolacin

18/90

Frmula de Newton
Objetivo: construir el pol. de interp. p (x ) gradualmente, partiendo de un solo dato ( x 0 , y 0 ) e ir aadiendo datos progresivamente.

p 0 P : polin. que interpola en {x 0 }, 0


p1 P : polin. que interpola en {x 0 , x1 }, 1

p 2 P : polin. que interpola en {x 0 , x1 , x 2 }, 2

p n = p P : polin. que interpola en {x 0 , x1 , , x n }. n


Se trata de obtener pk conocido pk 1 , k = 1,, n .

Interpolacin

19/90

Frmula de Newton
4

-1

Interpolacin

20/90

Frmula de Newton
4

-1

Interpolacin

21/90

Frmula de Newton
4

-1

Interpolacin

22/90

Frmula de Newton
4

-1

Interpolacin

23/90

Frmula de Newton
4

-1

Interpolacin

24/90

Frmula de Newton
Construccin progresiva

p 0 ( x ) = y 0 P interpola en x 0 (cumple p 0 ( x 0 ) = y 0 ). 0 p1 ( x ) P interpola en {x0 , x1}; q1 = p1 p0 P se anula en x 0 1 1 q1 ( x ) = A1 ( x x 0 ) , con A1 adecuado para que y p 0 ( x1 ) . p1 ( x1 ) = p 0 ( x1 ) + q1 ( x1 ) = y1 A1 = 1 x1 x 0 p 2 = p1 + q 2 P interpola en x0 , x1 , x2 ; q 2 P se anula en x 0 y x1 2 2 q 2 ( x ) = A2 ( x x 0 )( x x1 ) con A2 adecuado para que

p 2 ( x 2 ) = p1 ( x 2 ) + q 2 ( x 2 ) = y 2 A2 =
en general

p k = p k 1 + q k P , q k se anula en x 0 , , x k 1 k y k p k 1 ( x k ) q k ( x ) = Ak ( x x 0 ) ( x x k 1 ) con Ak = . ( x k x 0 ) ( x k x k 1 )
25/90

y 2 p1 ( x 2 ) . ( x 2 x 0 )( x 2 x1 )

Interpolacin

Frmula de Newton
Conviniendo A0 = y 0 se tiene

p( x ) = p n ( x ) = A0 + A1 ( x x 0 ) + A2 ( x x 0 )( x x1 ) +
es decir

+ An ( x x 0 )

( x x n 1 )

p( x ) = Ak ( x x i ) ,
k =0 i =0

k 1

que es la frmula de Newton (preliminar).

Interpolacin

26/90

Frmula de Newton
Ejemplo:

x 1 y 0

3 4

1 2

A0 = y0 = 0 p0 ( x ) = 0;

A1 =
A2 =

y1 p0 ( x1 ) 1 0 = = 1 p1 ( x ) = 0 + 1( x + 1) = x + 1; x1 x0 0 +1
y2 p1 ( x2 ) 22 = = 2 ( x2 x0 )( x2 x1 ) (1 + 1)(1 0) 4 + 20 y3 p2 ( x3 ) = =1 ( x3 x0 )( x3 x1 )( x3 x2 ) 4 3 2 = x 3 2 x 2 2 x + 1.

p2 ( x ) = p1 ( x ) 2( x + 1)( x 0) = ( x + 1) 2( x + 1) x; A3 =

p3 ( x ) = p2 ( x ) + 1( x + 1) x ( x 1)

Interpolacin

27/90

Diferencias divididas
Notacin:

Ak = f [ x 0 , , x k ] diferencia dividida de f en x 0 , , x k .
k 1 i =0

Frmula de Newton: (definitiva)

p( x ) = f [ x 0 , , x k ] ( x x i ) .
k =0

Interpolacin

28/90

Diferencias divididas
Propiedad de las diferencias divididas:

f [ x0 , , x n ] =
k =0

f ( xk )

(x
i =0 i k

xi )

Consecuencia:

f [ x0 ,, xn ] es simtrica respecto de x0 ,, xn .

Demostracin: identificando coef. de gr.


n k 1 i =0

n en las frmulas de Lagrange y Newton:


n n j =0 i =0 i j

p( x ) = f [ x0 ,, xk ] ( x xi ) = y j
k =0

x xi . x j xi

Interpolacin

29/90

Diferencias divididas
Propiedad de las diferencias divididas:

f [ x0 , , x n ] =

f [ x1 ,, xn ] f [ x0 ,, xn 1 ] . x n x0

Demostracin: identificando coef. de gr. inversa de gr. n :


n k 1 i =0

n 1 en las frmulas de Newton directa e


n n

p( x ) = f [ x0 ,, xk ] ( x xi ) = f [ xn ,, xn k ] ( x xi )
k =0 k =0 i = k +1

f [ x0 ,, xn 1 ] f [ x0 ,, xn ] xi = f [ xn ,, x1 ] f [ x0 ,, xn ] xi .
i =0 i =1

n 1

Interpolacin

30/90

Diferencias divididas
Tabla de diferencias divididas

x0 x1 x2

f [ x0 ] = y0 f [ x1 ] = y1 f [ x2 ] = y 2 f [ x0 , x1 ] f [ x0 , x1 , x2 ] f [ x1 , x2 ] f [ x0 , , x n ]

xn

f [ xn ] = y n

f [ x n 1 , x n ]

Interpolacin

31/90

Diferencias divididas
Ejemplo:

x 1 y 0

3 4

1 2
1 0 1 3

0 1 1 2 4 3 3 2 1 2

p( x ) = 0 + 1( x + 1) 2( x + 1) x + 1( x + 1) x ( x 1) .

Interpolacin

32/90

El error de interpolacin

EL ERROR DE INTERPOLACIN EN EL P.I.P.L.

Interpolacin

33/90

El error de interpolacin
Sean

zi = f ( xi ) los datos de un P.I.P.L., provenientes de una funcin f ( x ) . E ( x ) = f ( x ) p( x ) .


n

Definicin: Error de interpolacin

Teorema:

E ( x ) = f [ x0 , x1 ,, xn , x ] ( x ) , donde ( x ) = ( x xi ) .
i =0

Demostracin: Ampliando la frmula de Newton con

xn +1 se tiene

f [ x0 , , xn +1 ] =

yn +1 p( xn +1 )

(x
i =0

n +1

xi )

f [ x0 , , xn +1 ] ( xn +1 ) = E ( xn +1 ) ,

vlido xn +1 .

Interpolacin

34/90

El error de interpolacin
Teorema: Sea f C [a , b] y
n

x0 , , xn [a, b]. Entonces [a, b] tal que

f ( n ) ( ) . f [ x0 , , xn ] = n!
Demostracin: E ( x ) C [a , b] y se anula en
n

x0 , , xn n + 1 veces;

aplicando el T. de Rolle E ( x ) C

n 1

[a , b] se anula n veces;

E ( n ) ( x ) C 0 [a , b] se anula 1 vez.
Consecuencia: Si f C
n +1

[a , b] entonces

f ( n +1) ( ) E ( x) = ( x) . ( n + 1)!
Interpolacin 35/90

Interpolacin por recurrencia

INTERPOLACIN POR RECURRENCIA

Interpolacin

36/90

Interpolacin por recurrencia


Interpolacin por recurrencia:

C {x0 , x1 ,, xn }, sea pC (x ) el interpolante en los puntos de C .


Teorema (Lema de Aitken): Sean xi , x j C . Entonces

pC { x i , x j } ( x ) =

( x x j ) pC { x i } ( x ) ( x xi ) pC { x j } ( x ) xi x j

Demostracin: basta comprobar. Principal aplicacin: evaluacin del interpolante sin construirlo.

Interpolacin

37/90

Interpolacin por recurrencia


Mtodo de Neville:

x x0 x x1 x x2

p{ x 0 } ( x ) = y0 p{ x1 } ( x ) = y1 p{ x 2 } ( x ) = y2 p{ x 0 , x1 } ( x ) p{ x 0 , x1 , x 2 } ( x ) p{ x1 , x 2 } ( x ) p{ x 0 ,, x n } ( x ) p{ x n 1 , x n } ( x )

x xn

p{ x n } ( x ) = yn

Interpolacin

38/90

Interpolacin por recurrencia


Ejemplo del mtodo de Neville:

x 1 y 0

3 4

1 2

en

x=2

3 2 1 1

0 3 1 2 4 5 1 9 1 3 p ( 2 ) = 3

Interpolacin

39/90

Interpolacin por recurrencia


Mtodo de Aitken:

x x0 x x1 x x2 x xn

p{ x 0 } ( x ) = y0 p{ x1 } ( x ) = y1 p{ x 2 } ( x ) = y2 p{ x n } ( x ) = yn

p{ x 0 , x1 } ( x ) p{ x 0 , x 2 } ( x ) p{ x 0 , x n } ( x )

p{ x 0 , x1 , x 2 } ( x ) p{ x 0 , x1 , x n } ( x ) p{ x 0 ,, x n } ( x )

Ejemplo del mtodo de Aitken:

3 2 1 1

0 1 3 p ( 2 ) = 3 2 3 9 4 3 3 3

Interpolacin

40/90

Resumen de soluciones para el P.I.P.L.

RESUMEN DE SOLUCIONES PARA EL P.I.P.L.

Interpolacin

41/90

Resumen de soluciones para el P.I.P.L.


Con la base cannica {1, x, x ,, x }
2 n

Solucin: (sistema de ecuaciones lineales) p ( x ) =

a x
j =0 j

Con la base de Lagrange {

, 1 , , n }

Solucin: frmula de Lagrange p ( x ) =

y
j =0

( x) ( x xn 1 )}

Con base de Newton {1, ( x x0 ), ( x x0 )( x x1 ),, ( x x0 ) Solucin: frmula de Newton


n k =0

p( x ) = f [ x 0 , , x k ] ( x x i ) .
i =0

k 1

Interpolacin

42/90

Evaluacin de polinomios

EVALUACIN DE POLINOMIOS

Interpolacin

43/90

Evaluacin de polinomios
Para evaluar p ( x ) = an x + an 1 x
n n 1

+ a1 x + a0 se requieren:

n( n 1) multiplicaciones para potencias 2 n


multiplicaciones por coeficientes sumas de monomios

n 2 + 3n operaciones 2
...y los errores de redondeo se amplifican.

Interpolacin

44/90

Evaluacin de polinomios
Expresin equivalente:

p( x ) = a0 + x ( a1 + x ( a2 + x ( ( an 1 + x ( an ) ))) .
Algoritmo de Horner para evaluar p ( x ) en el punto x = r :
s = a[[n]]; For[i=n-1, i>=0, i--, s = s*r+a[[i]] ];

Algoritmo de Horner para la frmula de Newton

p( x ) = A0 + ( x x0 )( A1 + ( x x1 )(

( An 1 + ( x xn 1 )( An ) )))

s = A[[n]]; For[i=n-1, i>=0, i--, s = s*(r-x[[i]]) + A[[i]] ];

Interpolacin

45/90

Otros Problemas de Interpolacin

OTROS PROBLEMAS DE INTERPOLACIN

Interpolacin

46/90

Otros Problemas de Interpolacin


Problema de Interpolacin de Taylor Obtngase p P conocidos los valores de p ( a ), p( a ), p( a ),, p n
Solucin 1: Con la base cannica {1, x, x 2 ,, x n } resulta el sistema triangular superior:
(n)

(a ) .

Solucin 2: Con la base de Newton

{1, ( x a ), ( x a ) 2 ,, ( x a ) n }

resulta el sistema diagonal:

1 a a2 0 1 2a 0 0 0

an na n 1 n!

p(a ) p( a ) p ( n ) (a )

0! 0 0 1! 0 0

p(a ) p( a ) n! p ( n ) ( a ) 0 0

Solucin: el desarrollo polinomial de Taylor.

Interpolacin

47/90

Otros Problemas de Interpolacin


Problema de Interpolacin de Hermite clsico Obtngase p Pn +1 conocidos los valores de 2

p( x0 ), p( x0 ), p( x1 ), p( x1 ),, p( xn ), p( xn ) .

Solucin: Con la base de Newton

{1, ( x x0 ), ( x x0 ) 2 , ( x x0 ) 2 ( x x1 ), ( x x0 ) 2 ( x x1 ) 2 , , ( x x0 ) 2 ( x x1 ) 2 x 1 2 3 2 1 2 3 Ejemplo: y 1.5 y 1 1 1


1

( x xn )}

unisolvente en P . 5

0.5

0.5

1.5

Interpolacin

48/90

Otros Problemas de Interpolacin


Enfoque de Langrange en el caso polinomial con datos tipo Hermite clsico:

Datos: z0 , z1 , , zn , z0 , z1 , , zn ; espacio interpolador: V = Pn +1 . 2


Base de Lagrange: { A0 , A1 , , An , B0 , B1 , , Bn } cumpliendo

Aj ( xi ) = ij , A ( xi ) = 0, j B j ( xi ) = 0, B ( xi ) = ij . j
Sean
j ( x) = k =0 k j n

x xk los polinomios fundamentales del problema clsico; x j xk


Aj = (1 2( x x j ) j ( x j ) ) B j = ( x x j ) 2j ( x ).
2 j

( x ),

Frmula de Lagrange:
Ejercicio: comprobar. Interpolacin

p( x ) = z j Aj ( x ) + z j B j ( x ) .
j j

49/90

Otros Problemas de Interpolacin


Diferencia dividida generalizada: sup.

f C n [a , b] y x0 x1 xn ; f [ x1 , , xn ] f [ x0 , , xn 1 ] si x0 < xn xn x0 f [ x0 , , xn ] = (n) 1 si x0 = xn ( x0 ) n! f

Enfoque de Newton: cada serie

f ( xi ), f ( xi ), , f ( k ) ( xi ) genera el fragmento
f [ xi , xi , xi ] = f ( xi )
1 k!

xi f [ xi ] = f ( xi ) xi f [ xi ] = f ( xi ) xi f [ xi ] = f ( xi )

f [ xi , xi ] = f ( xi ) f [ xi , xi ] = f ( xi )

1 2!

f ( k ) ( xi )

xi f [ xi ] = f ( xi )
Interpolacin

f [ xi , xi ] = f ( xi )
50/90

Otros Problemas de Interpolacin

x
Ejemplo:

y 1 2 3 unisolvente en P . 5 y 1 1 1
2 2 2 2 2 2

Base: {1,( x 1),( x 1) ,( x 1) ( x 2),( x 1) ( x 2) ,( x 1) ( x 2) ( x 3)} Tabla de diferencias divididas generalizadas:

1 1 2 2 3 3
Interpolacin

1 1 1 2 1 4 2 3 2 1 3 2 3 2 2 4 1 2 3 1 3
51/90

El Problema General de Interpolacin

EL PROBLEMA GENERAL DE INTERPOLACIN

Interpolacin

52/90

El Problema General de Interpolacin


Definicin: Dado V espacio vectorial sobre L :V R verificando

R , una forma lineal sobre V es

L( f + g ) = L( f ) + L( g ) , R f , g V .
Ejemplos: (V

= espacio de funciones R R )
L1 ( f ) = f (7), L2 ( f ) = f ( x0 ), L3 ( f ) = f ( 2), L4 ( f ) = f ( x ) dx,
a b

L5 ( f ) = f (0).

Interpolacin

53/90

El Problema General de Interpolacin


Problema General de Interpolacin (P.G.I.):

Sea V un espacio vectorial real de dimensin finita n . Dadas las formas lineales {L1 , L2 , , Ln } sobre V y los valores reales {z1 , z2 , , zn }, obtngase p V que verifique

Li ( p ) = zi , i = 1, 2, , n .

Teorema: Sea {v1 , v2 , , vn } una base de V . El P.G.I. es unisolvente si y slo si el determinante de Gram

det( Li ( v j ))
es no nulo.
Demostracin: Si

p = a j v j , entonces a j Li ( v j ) = zi , i = 1, 2,, n es un
j j

sistema de ecuaciones lineales cuyo determinante es el de Gram.


Interpolacin 54/90

El Problema General de Interpolacin


Casos particulares usuales:

V = P interpolacin polinomial n V = 1,cos x,sen x,cos 2 x,sen 2 x, interpolacin trigonomtrica

Li ( f ) = f ( xi ) datos lagrangianos L2i ( f ) = f ( xi ), L2 i 1 ( f ) = f ( xi ) datos tipo Hermite clsico Li ( f ) = f ( i ) ( x0 ) datos tipo Taylor
Caractersticas del P.G.I.: el n de datos es finito las condiciones de interpolacin son lineales la dimensin del espacio interpolador es igual al n de datos.

Interpolacin

55/90

El Problema General de Interpolacin


Construccin de la solucin del P.G.I. Enfoque directo: con el sistema de Gram Enfoque de Lagrange: sea una base {

a L (v ) = z , i = 1, 2,, n .
j i j i j
2

entonces

p = zj
j

, , n } de V tal que Li ( j ) = ij ;

(frmula de Lagrange).

Enfoque de Newton: sea una base {w1 , w2 , , wn } de V con

y L j ( w j ) 0 j ; entonces

p = a j w j (frmula de Newton), donde


j

Li ( w j ) = 0 i < j

k 1 zk Lk a j w j z1 j =1 , k = 2, , n . a1 = , ak = Lk ( wk ) L1 ( w1 )
Ejercicio: Comprobar todo. Interpolacin 56/90

Interpolacin mediante splines

INTERPOLACIN MEDIANTE FUNCIONES SPLINE

Interpolacin

57/90

Interpolacin mediante splines


Los polinomios de alto grado interpolacin adoptan comportamientos anmalos.

20

15

10

10

15

20

Interpolacin

58/90

Interpolacin mediante splines


Los polinomios de alto grado interpolacin adoptan comportamientos anmalos.

20

15

10

10

15

20

Interpolacin

59/90

Interpolacin mediante splines


Los polinomios de alto grado interpolacin adoptan comportamientos anmalos.

20

15

10

10

15

20

Interpolacin

60/90

Funciones spline
Definicin: Un spline de grado

n y clase m con nodos {x0 ,, x N } es una funcin s(x ) definida en [a , b] = [ x0 , x N ] verificando:


1. 2.

si = s [ xi 1 , xi ] es un polinomio de grado n (i = 1,2,, N )


s C m [ a , b] .

Convenio: salvo indicacin expresa, se sobreentiende Espacios de splines en los nodos {x0 ,, x N }

m = n 1.

n y clase m : S n m ( x0 ,, x N ) . de grado n (y clase m = n 1): S n ( x0 ,, x N ) .


de grado Casos usuales: spline lineal n = 1: grado 1 (clase 0 = continua) poligonal n = 2 : grado 2 (clase 1 = derivable) spline cuadrtico n = 3: grado 3 (clase 2 = derivable 2 veces) spline cbico n = 3, m = 1: spline cbico de clase 1 (caso especial). Interpolacin 61/90

Funciones spline
5

Interpolacin

62/90

Funciones spline
5

Interpolacin

63/90

Funciones spline
5

Interpolacin

64/90

Funciones spline
4

Interpolacin

65/90

Construccin de splines por trozos

CONSTRUCCIN DE SPLINES POR TROZOS

Interpolacin

66/90

Construccin de splines por trozos


Expresin a trozos:

s1 ( x ) P si x [ x 0 , x1 ] n s ( x ) P si x [ x1 , x 2 ] n s( x ) = 2 s N ( x ) P si x [ x N 1 , x N ] n

Restricciones de suavidad:
k) si( k ) ( xi ) = si(+1 ( xi ) i = 1,, N 1, k = 0,, m

por tanto

dim S n m ( x0 ,, x N ) = ( n + 1) N ( m + 1)( N 1) = N (n m) + m + 1

Interpolacin

67/90

Construccin de splines por trozos


Caso lineal ( n = 1): Cada trozo

si ( x ) = ai x + bi aporta dos incgnitas; dos ecuaciones: si ( xi 1 ) = yi 1 (extremo izdo.) y si ( xi ) = yi (extremo dcho.) subproblema 2 2 . si ( x ) = yi x xi l x x + yi 1 i , i = 1,, N hi hi

Construccin directa:

con

hi = xi xi 1 , i = 1,, N .
x 1 y 0 0 1 3 4 1 2

Ejemplo:

s1 ( 1) = 0, s1 (0) = 1 s1 ( x ) = x + 1 s2 ( 0) = 1, s2 (1) = 2 s2 ( x ) = 3x + 1 s3 ( 1) = 2, s3 (3) = 4 s3 ( x ) = 3x 5


Interpolacin 68/90

Construccin de splines por trozos


Caso cuadrtico ( n = 2 ): Cada trozo total 3N ;

si ( x ) = ai x 2 + bi x + ci aporta tres incgnitas

Ecuaciones: Interpolacin (clase 0 ): 2 por trozo (extremos izdo. y dcho.) Clase 1: si( xi ) = si+1 ( xi ) i = 1,, N 1 son N 1 ecuaciones.

total 2 N + N 1 = 3N 1 ecuaciones falta una ecuacin!. Se aade una ecuacin adicional para cuadrar el problema.
Construccin directa con

s( x0 ) = d 0 : wi d i 1 ( x xi 1 ) 2 , i = 1,, N hi

si ( x ) = yi 1 + d i 1 ( x xi 1 ) +
con

wi =

y i yi 1 , d i = 2 wi d i 1 , i = 1,, N , d 0 = y0 . hi
69/90

Interpolacin

Construccin de splines por trozos


Caso cbico ( n = 3): Cada trozo incgnitas total 4 N ;

si ( x ) = ai x 3 + bi x 2 + ci x + d i aporta cuatro

Ecuaciones: Interpolacin (clase 0 ): 2 por trozo (extremos izdo. y dcho.) Clase 1: si( xi ) = si+1 ( xi ) i = 1,, N 1 son N 1 ecuaciones.
Clase

2 : si( xi ) = si+1 ( xi ) i = 1,, N 1 son N 1 ecuaciones.

total 2 N + 2( N 1) = 4 N 2 ecuaciones faltan dos ecuaciones!.


Ecuaciones adicionales tpicas: s( a ) = s(b) = 0 spline natural prolongable mediante rectas de clase 2 en todo R . s( a ) = y0 , s(b) = y spline de extremo sujeto N pendientes fijas de entrada y salida. s( a ) = s(b), s( a ) = s(b) spline peridico prolongable por periodicidad de clase 2 en todo R . Interpolacin 70/90

Construccin de splines por trozos


Construccin directa del spline cbico natural o sujeto:

si ( x ) = yi 1 + d i 1 ( x xi 1 ) + +
siendo

wi d i 1 ( x xi 1 ) 2 hi

d i 1 + d i 2 wi ( x xi 1 ) 2 ( x xi ), i = 1,, N 2 hi

d i la solucin del s.e.l. tridiagonal simtrico


1 w 1 1 1 w d i 1 + 2 + d i +1 = 3 i +1 + i , i = 1,, N 1 d i + hi hi +1 hi hi +1 hi +1 hi

con las ecuaciones adicionales

d 0 = y0 , d N = y ; N sujeto: 2d 0 + d1 = 3w1 , d N 1 + 2d N = 3wN .


natural:

Interpolacin

71/90

Construccin de splines por trozos


Caso especial:

n = 3, m = 1 para datos tipo Hermite clsico (valor y derivada en cada punto). Para cada trozo si ( x ) se tienen 4 incgnitas y 4 ecuaciones ( 2 valores y 2 derivadas), formando un subproblema 4 4 .
m

Caso general (P.I.L. en S n

( x0 ,, x N ) ): Hay N ( n + 1) incgnitas;

Ecuaciones: Interpolacin+continuidad: 2 N ( = Suavidad de clase 1: N 1 Suavidad de clase 2: N 1


Suavidad de clase

N + 1 interpolacin + N 1 clase 0 ).

m: N 1

Total ecuaciones: 2 N + m( N 1) = ( m + 2) N m ; si m = n 1 entonces siempre faltan m ecuaciones adicionales. Se obtiene un sistema


Interpolacin

N ( n + 1) N ( n + 1) .
72/90

Construccin de splines por trozos


Teoremas de unisolvencia: P.I.L. en S1 ( x0 ,, x N ) P.I.L. en S 2 ( x0 ,, x N ) con

s( xi ) = d i para algn i {0,1,, N }

P.I.L. en S 3 ( x0 ,, x N ) natural P.I.L. en S 3 ( x0 ,, x N ) sujeto P.I.L. en S 3 ( x0 ,, x N ) peridico Hermite clsico en S 3


1

( x0 ,, x N )

Interpolacin

73/90

Construccin de splines mediante Potencias truncadas

CONSTRUCCIN DE SPLINES POR POTENCIAS TRUNCADAS

Interpolacin

74/90

Construccin de splines mediante Potencias truncadas


Potencia truncada

xn ( x) = 0
n +

si si

x0 x<0

Ejemplos:

( x ) + , ( x 2) 2 , ( x 2 2) + , ( 2 x 2 ) + , ( x 3)3 , ( x 4)3 + + +
5 4 3 2 1

-2

Interpolacin

75/90

Construccin de splines mediante Potencias truncadas


Ejercicios: Propiedad:

x = ( x)+ + ( x)+ , x = ( x)+ ( x)+ . ( x r ) n es un spline de grado n con un nodo en r . +

Bases de splines:

S1 ( x0 ,, x N ) = 1, x, ( x x1 ) + , ( x x2 ) + ,, ( x x N 1 ) + S 2 ( x0 ,, x N ) = 1, x, x 2 , ( x x1 ) 2 , ( x x2 ) 2 ,, ( x x N 1 ) 2+ + +

S 3 ( x0 ,, x N ) = 1, x, x 2 , x 3 , ( x x1 )3 , ( x x2 )3 ,, ( x x N 1 )3+ + +
S n ( x0 ,, x N ) = 1, x, x 2 ,, x n , ( x x1 ) n , ( x x2 ) n ,, ( x x N 1 ) n+ + +

S 31 ( x0 ,, x N ) = 1, x, x 2 , x 3 , ( x x1 ) 2 , ( x x2 ) 2 ,, ( x x N 1 ) 2+ , + + ( x x1 )3 , ( x x2 )3 ,, ( x x N 1 )3+ + +
Interpolacin 76/90

Construccin de splines mediante Potencias truncadas


Ejemplo: Spline cbico natural para

x 1 y 0

3 4

1 2

s ( x ) = a + bx + cx 2 + dx 3 + A( x )3 + B ( x 1)3 + +
sistema lineal


Solucin:

1 1 1 0 1 1 1 3 0 0 0 0

1 1 0 0 0 0 0 0 0 1 1 1 1 0 2 9 27 27 8 4 2 6 0 0 0 2 18 18 12 0

s( x ) =

1 (23 37 x 90 x 2 30 x 3 + 88( x )3+ 72( x 1)3+ ) 23


77/90

Interpolacin

Construccin de splines mediante Potencias truncadas


Ejemplo: Spline cbico sujeto horizontal para

x 1 y 0

3 4

1 2

s ( x ) = a + bx + cx 2 + dx 3 + A( x )3 + B ( x 1)3 + +
sistema lineal


Solucin:

1 1 1 1 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 0 2 1 3 9 27 27 8 4 0 1 2 3 0 0 0 0 1 6 27 27 12 0

s( x ) =

1 (22 27 x 120 x 2 71x 3 + 152( x )3+ 120( x 1)3+ ) 22


78/90

Interpolacin

Construccin de splines mediante Potencias truncadas


4 3 2 1

-1 -1 -2

Interpolacin

79/90

Construccin de splines mediante Potencias truncadas


4 3 2 1

-1 -1 -2

Interpolacin

80/90

Construccin de splines mediante Potencias truncadas


4 3 2 1

-1 -1 -2

Interpolacin

81/90

Construccin de splines mediante Potencias truncadas


4 3 2 1

-1 -1 -2

Interpolacin

82/90

Interpolacin de Hermite con Splines

INTERPOLACIN DE HERMITE CON SPLINES

Interpolacin

83/90

Interpolacin de Hermite con Splines

x Ejemplo: y y

0 1 0.5 1 0 0
2 1.5 1 0.5

2 2 0

4 1.5 en S 31 (0,1,2,4) 0

- 0.5

Interpolacin

84/90

Propiedades extremales de los splines cbicos

PROPIEDADES EXTREMALES DE LOS SPLINES CBICOS

Interpolacin

85/90

Propiedades extremales de los splines cbicos


Condiciones comunes:

< x N = b . Sea s(x ) el spline cbico natural o sujeto que interpola los nodos con datos y 0 , , y N , y adicionales s( a ) = s(b) = 0 o bien s( a ) = y0 , s(b) = y . N 2 Sea f C [a , b] cualquier otra funcin que interpole los mismos datos, incluyendo los adicionales. Sea E ( x ) = f ( x ) s ( x ) .
Sean los nodos
Lema:

a = x0 < x1 <

s( x ) E ( x )dx = 0.
a

Interpolacin

86/90

Propiedades extremales de los splines cbicos


Demostracin:

s( x ) E ( x )dx =
i =1 N

= s( x ) E ( x ) xii 1
x i =1

(por partes) s( x ) E ( x )dx = x i 1 u = s, dv = E dx


xi xi

x i 1

s( x ) E ( x )dx
N xi

= s(b) E (b) s( a ) E ( a ) Ki
i =1

x i 1

E ( x )dx

si es natural:

s( a ) = s(b) = 0 , si es sujeto: E ( a ) = E (b) = 0 , y adems

xi

x i 1

E ( x )dx = E ( x ) xi = 0 .
x
i 1

Interpolacin

87/90

Propiedades extremales de los splines cbicos


Teorema (propiedad extremal):

Demostracin:

s( x ) 2 dx f ( x ) 2 dx .
a

f ( x ) 2 dx = (E ( x ) + s( x ) ) dx
b

= E ( x ) 2 dx + s( x ) 2 dx + 0
a a

s( x ) 2 dx.
a

Interpolacin

88/90

Propiedades extremales de los splines cbicos


Teorema (estudio del error):

E ( x) h
1 i N

3 2

( f (t)dt ) x [a, b]
b 1 2 a

donde h = max ( xi xi 1 ) es el dimetro de la particin.


Demostracin:

E ( xi ) = 0 i ci [ xi 1 , xi ]
luego

E ( ci ) = 0 , i = 1,, N ,

ci

E (t )dt = E ( x ) x [a , b].

Interpolacin

89/90

Propiedades extremales de los splines cbicos


Por otro lado (abreviando) se tiene

ci

E 2 E 2 = ( f s ) = f 2 s 2 2 s E f 2 ;
b b

por la desigualdad de Cauchy-Schwarz

u, v u v
x

fg
b

f 2 g2

E ( x )
y como

ci

E (t ) 2 dt 12 dt h E (t ) 2 dt h f (t ) 2 dt
ci xi a

x i 1

E (t )dt = E ( x ) E ( xi 1 ) = E ( x ) , entonces se tiene

E ( x) =

x i 1 3 2

E (t )dt
b 2 1 2 a

x i 1

E (t ) dt h

1 2

( f (t) dt ) ( x x
b 2 1 2 a

i 1

h
Interpolacin

( f (t) dt ) .
90/90

S-ar putea să vă placă și