tema 5 (i)

91
Interpolación Tema 5 (I)

Upload: anton-sitnikov

Post on 22-Jun-2015

12 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Tema 5 (I)

Interpolación

Tema 5 (I)

Page 2: Tema 5 (I)

Interpolación

● Concepto y Teorema de la Aproximación

Page 3: Tema 5 (I)

Consiste en la obtención de nuevos puntos intermedios para una función a partir de un conjunto limitado de puntos conocidos.

Más allá del concepto puramente analítico, las aplicaciones de la interpolación en informática son inmensas utilizándose por ejemplo en compresión de vídeo, cambio de frecuencia de muestreo en sonido, cambio de tamaño de imágenes, animación de parámetros en realidad virtual, etc.

Interpolación de una función

Page 4: Tema 5 (I)

A partir de un conjunto de n puntos (xk,yk) llamamos interpolación f(x) a la función que verifica: f(xk)=yk para k=1,…,n

Interpolación de una función

Page 5: Tema 5 (I)

Interpolación de una función

La interpolación más sencilla sería conectar dos puntos con una recta, se trataría de una interpolación lineal y es poco precisa.

La interpolación mediante un polinomio será más precisa al poder ajustar sus curvas a la función que se pretende interpolar.

Page 6: Tema 5 (I)

Teorema de la Aproximación de Weiestrass

Sea f(x) definida y continua en [a,b]. Para todo ε>0 existe un polinomio P(x) tal que

|f(x)-P(x)|<ε para todo xє[a,b] El teorema nos garantiza que siempre existirá

un polinomio con el que poder interpolar cualquier función, con la precisión que queramos. El problema es encontrarlo.

Page 7: Tema 5 (I)

Interpolación

● Concepto y Teorema de la Aproximación

● Interpolación de Lagrange

Page 8: Tema 5 (I)

Polinomios de Lagrange

Para que un polinomio tenga una raíz en xi debe tener un factor (x-xi) que se haga 0 al sustituir x por xi.

El polinomio con raíces en x0,x1,…,xn debe tener la forma P(x)= (x-x0)(x-x1)…(x-xn)

Page 9: Tema 5 (I)

Polinomios de Lagrange

Dado los valores x0,x1,…,xn llamamos a Ln,k(x) polinomio de Lagrage de grado n para k al polinomio que tiene n raíces en x0,…,xk-1,xk+1,…,xn y cumple que Ln,k(xk)=1

)())(()(

)())(()()(

110

110,

nkkkkkk

nkkkn

xxxxxxxx

xxxxxxxxxL

Page 10: Tema 5 (I)

Polinomio de Interpolación de Lagrange

Se llama polinomio de interpolación de Lagrange de grado n a

donde

)())(()(

)())(()()(

110

110,

nkkkkkk

nkkkn

xxxxxxxx

xxxxxxxxxL

)()(...)()()( ,0,0 xLxfxLxfxP nnnnn

n

k

knkn xLxfxP0

, )()()(

Page 11: Tema 5 (I)

Polinomio de Interpolación de Lagrange

Por ejemplo, conocidos 2 valores: x0 y x1, y sus valores en f(x): f(x0) y f(x1) podemos interpolar f(x) mediante el polinomio de interpolación de Lagrange de grado 1 P1(x)

Es una interpolación lineal.

)(

)()(

01

01,1

xx

xxxL

)()()()()()()( 1,110,10

1

0

,11 xLxfxLxfxLxfxPk

kk

)(

)()(

)(

)()()(

01

01

10

101

xx

xxxf

xx

xxxfxP

)(

)()(

10

10,1

xx

xxxL

Page 12: Tema 5 (I)

Polinomio de Interpolación de Lagrange

Con 3 valores: x0, x1, x2, f(x0), f(x1) y f(x2) la interpolación de Lagrange de grado 2 P2(x)

)()()()()()()()( 2,221,210,20

2

0

,2 xLxfxLxfxLxfxLxfk

kk

))((

))(()(

))((

))(()()(

2101

201

2010

2102

xxxx

xxxxxf

xxxx

xxxxxfxP

))((

))(()(

2010

210,2

xxxx

xxxxxL

))((

))(()(

2101

201,2

xxxx

xxxxxL

))((

))(()(

1202

102,2

xxxx

xxxxxL

))((

))(()(

1202

102

xxxx

xxxxxf

Page 13: Tema 5 (I)

Polinomio de Interpolación de Lagrange

Comparación P1(x) con P2(x): Los L2,k(x) incorporan una raíz más que los L1,k(X) y el polinomio P1(x) suma un término más que P2(x)

))((

))(()(

))((

))(()()(

2101

201

2010

2102

xxxx

xxxxxf

xxxx

xxxxxfxP

))((

))(()(

1202

102

xxxx

xxxxxf

)(

)()(

)(

)()()(

01

01

10

101

xx

xxxf

xx

xxxfxP

Page 14: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Calcula con un polinomio de interpolación de Lagrange de grado 1 (lineal) la función f(x)=(x/2)(x-2) para x=5/2 conocidos los valores f(2)=1 y f(3)=3/2 xi f(xi)

x0=2 1

x1=3 3/2

)())(()(

)())(()()(

110

110,

nkkkkkk

nkkkn

xxxxxxxx

xxxxxxxxxL

Page 15: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Calcula con un polinomio de interpolación de Lagrange de grado 1 (lineal) la función f(x)=(x/2)(x-2) para x=5/2 conocidos los valores f(2)=1 y f(3)=3/2

)3()32(

)3(

)(

)()(

10

10,1 x

x

xx

xxxL

)2()23(

)2(

)(

)()(

01

01,1 x

x

xx

xxxL

xi f(xi)

x0=2 1

x1=3 3/2

)())(()(

)())(()()(

110

110,

nkkkkkk

nkkkn

xxxxxxxx

xxxxxxxxxL

n

k

knkn xLxfxP0

, )()()(

Page 16: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Calcula con un polinomio de interpolación de Lagrange de grado 1 (lineal) la función f(x)=(x/2)(x-2) para x=5/2 conocidos los valores f(2)=1 y f(3)=3/2

)3()32(

)3(

)(

)()(

10

10,1 x

x

xx

xxxL

)2()23(

)2(

)(

)()(

01

01,1 x

x

xx

xxxL

xi f(xi)

x0=2 1

x1=3 3/2

n

k

knkn xLxfxP0

, )()()(

)()()()()( 1,110,101 xLxfxLxfxP

22

)2(3

2

)3(2)(1

xxxxP

Page 17: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Calcula con un polinomio de interpolación de Lagrange de grado 1 (lineal) la función f(x)=(x/2)(x-2) para x=5/2 conocidos los valores f(2)=1 y f(3)=3/2 xi f(xi)

x0=2 1

x1=3 3/2

22

)2(3

2

)3(2)(1

xxxxP

118,12

5

2

2/5)2/5(

22

5

f

25,14

5)2/5(1P

Page 18: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Calcula con un polinomio de interpolación de Lagrange de grado 1 (lineal) la función f(x)=(x/2)(x-2) para x=5/2 conocidos los valores f(2)=1 y f(3)=3/2 xi f(xi)

x0=2 1

x1=3 3/2

22

)2(3

2

)3(2)(1

xxxxP

118,12

5

2

2/5)2/5(

22

5

f

25,14

5)2/5(1P

132,0)2/5(1P

Page 19: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(1)=2 y recalcula con el polinomio de grado 2

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

)())(()(

)())(()()(

110

110,

nkkkkkk

nkkkn

xxxxxxxx

xxxxxxxxxL

Page 20: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(1)=2 y recalcula con el polinomio de grado 2

)31)(21(

)3)(2(

))((

))(()(

2010

210,2

xx

xxxx

xxxxxL

)())(()(

)())(()()(

110

110,

nkkkkkk

nkkkn

xxxxxxxx

xxxxxxxxxL

)32)(12(

)3)(1(

))((

))(()(

2101

201,2

xx

xxxx

xxxxxL

)23)(13(

)2)(1(

))((

))(()(

1202

102,2

xx

xxxx

xxxxxL

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

n

k

knkn xLxfxP0

, )()()(

Page 21: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(1)=2 y recalcula con el polinomio de grado 2

)31)(21(

)3)(2()(0,2

xxxL

)32)(12(

)3)(1()(1,2

xxxL

)23)(13(

)2)(1()(2,2

xxxL

)()()()()()()( 2,221,210,202 xLxfxLxfxLxfxP

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

n

k

knkn xLxfxP0

, )()()(

Page 22: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(1)=2 y recalcula con el polinomio de grado 2

)()()()()()()( 2,221,210,202 xLxfxLxfxLxfxP

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2 )32)(12(

)3)(1()( 1

xxxf

)31)(21(

)3)(2()()( 02

xxxfxP

)23)(13(

)2)(1()( 2

xxxf

Page 23: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(1)=2 y recalcula con el polinomio de grado 2

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2 )32)(12(

)3)(1()( 1

xxxf

)31)(21(

)3)(2()()( 02

xxxfxP

)23)(13(

)2)(1()( 2

xxxf

2

)2/1)(2/3(

2

3

1

)2/1)(2/3(

2

)2/1)(2/1(2)2/5(2P

0625,116/1716

9

16

8

16

9

4

3

4

1)2/5(2P

Page 24: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(1)=2 y recalcula con el polinomio de grado 2

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

0625,116/1716

9

16

8

16

9

4

3

4

1)2/5(2P

118,12

5

2

2/5)2/5(

22

5

f 0555,0)2/5(2P

Page 25: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(4)=4 y recalcula f(x) en x=5/2 con grado 3

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

x3=4 4

)())(()(

)())(()()(

110

110,

nkkkkkk

nkkkn

xxxxxxxx

xxxxxxxxxL

Page 26: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(4)=4 y recalcula f(x) en x=5/2 con grado 3

)41)(31)(21(

)4)(3)(2()(0,3

xxxxL xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

x3=4 4

)())(()(

)())(()()(

110

110,

nkkkkkk

nkkkn

xxxxxxxx

xxxxxxxxxL

)42)(32)(12(

)4)(3)(1()(1,3

xxxxL

)43)(23)(13(

)4)(2)(1()(2,3

xxxxL

)34)(24)(14(

)3)(2)(1()(2,3

xxxxL

Page 27: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(4)=4 y recalcula f(x) en x=5/2 con grado 3

Si sólo queremos aproximar un valor, lo mejor es, en vez de obtener el polinomio, establecer una matriz del cálculo.

)41)(31)(21(

)4)(3)(2()(0,3

xxxxL xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

x3=4 4

x4=5 125

8

)42)(32)(12(

)4)(3)(1()(1,3

xxxxL

)43)(23)(13(

)4)(2)(1()(2,3

xxxxL

)34)(24)(14(

)3)(2)(1()(2,3

xxxxL

Page 28: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(4)=4 y recalcula f(x) en x=5/2 con grado 3

)34)(24)(14(

)3)(2)(1(44

)43)(23)(13(

)4)(2)(1(2/33

)42)(32)(12(

)4)(3)(1(12

)41)(31)(21(

)4)(3)(2(21

)()(

3

2

1

0

,3

xxxx

xxxx

xxxx

xxxx

xLxfx iii xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

x3=4 4

)()()()()()()()( 3,332,321,310,30 xLxfxLxfxLxfxLxf

3

0

,3 )()(i

ik xLxf

)(3 xP

Page 29: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

12

3

6

8/34

)34)(24)(14(

)3)(2)(1(44

32

27

2

8/9

2

3

)43)(23)(13(

)4)(2)(1(2/33

16

9

2

8/91

)42)(32)(12(

)4)(3)(1(12

24

3

6

8/32

)41)(31)(21(

)4)(3)(2(21

)2/5()()()(

3

2

1

0

.3,3

xxxx

xxxx

xxxx

xxxx

LxfxLxfx iiiii

32

33

96

24

96

81

96

54

96

12)2/5()()2/5(

3

0

.33

i

ii LxfP

Page 30: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Añade el valor f(4)=4 y recalcula f(x) en x=5/2 con grado 3

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

x3=4 4

118,12

5)2/5(f 0868,0)2/5(3P

03125,132

33)2/5()()2/5(

3

0

.33

i

ii LxfP

Page 31: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

… con grado 4

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

x3=4 4

x4=5 125

8

Page 32: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

… con grado 4

)45)(35)(25)(15(

)4)(3)(2)(1(

8

1255

)54)(34)(24)(14(

)5)(3)(2)(1(44

)53)(43)(23)(13(

)5)(4)(2)(1(2/33

)52)(42)(32)(12(

)5)(4)(3)(1(12

)51)(41)(31)(21(

)5)(4)(3)(2(21

)()(

4

3

2

1

0

,4

xxxxx

xxxxx

xxxxx

xxxxx

xxxxx

xLxfx iii

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

x3=4 4

x4=5 125

8

Page 33: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

1024

375

24

16/9

8

125

)45)(35)(25)(15(

)4)(3)(2)(1(

8

1255

8

5

6

16/154

)54)(34)(24)(14(

)5)(3)(2)(1(44

128

135

4

16/45

2

3

)53)(43)(23)(13(

)5)(4)(2)(1(2/33

32

15

6

16/451

)52)(42)(32)(12(

)5)(4)(3)(1(12

192

15

24

16/152

)51)(41)(31)(21(

)5)(4)(3)(2(21

)2/5()()()( .4,4

xxxx

xxxx

xxxx

xxxx

xxxx

LxfxLxfx iiiii

Page 34: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

… con grado 4

xi f(xi)

x0=1 2

x1=2 1

x2=3 3/2

x3=4 4

x4=5 125

8

118,1)2/5(f 0684,0)2/5(3P

1024

375

8

5

128

135

32

15

192

15)2/5(4P

1865,13072

3645

3072

1125192032401440240

Page 35: Tema 5 (I)

Ejemplo de Interpolación de Lagrange

Los grados 3 y 4 no mejoran el error del grado 2 en x=5/2:

0868,0)2/5(3P 0684,0)2/5(4P

0555,0)2/5(2P132,0)2/5(1P

Page 36: Tema 5 (I)

Error de Interpolación de Lagrange

Si f(x) es una función interpolada con un polinomio Pn(x) de Lagrange, entonces:

donde ε es un número desconocido perteneciente al menor intervalo que contenga a x0, x1,…, xn y x

es decir,

)())(()!1(

)()()( 10

)1(

n

n

n xxxxxxn

fxPxf

)],(),,([ xxmáxxxmín ii

Page 37: Tema 5 (I)

Interpolación de Lagrange

Problemas: – No necesariamente gana precisión

aumentando de orden.

– Es complicado su cálculo manual.

Page 38: Tema 5 (I)

Interpolación

● Concepto y Teorema de la Aproximación

● Interpolación de Lagrange

● Tablas de interpolación

Page 39: Tema 5 (I)

Tablas de Interpolación En el ejemplo hemos visto ,

calculando f(x)=(x/2)(x-2), que podemos aplicar tablas para calcular el valor de la interpolación en un x concreto, en el ejemplo x=5/2.

Cada vez que añadimos un punto (un grado

más al polinomio de interpolación) podemos crear una nueva columna en la tabla a partir de la columna anterior, salvo el último elemento de la columna, el de la nueva fila, que se calcula completamente.

Page 40: Tema 5 (I)

Crear la columna L2,i(x) para el polinomio P2(x) a partir de la columna L1,i(x) del polinomio P1(x):

Tablas de Interpolación

)(

)()(

)(

)()(

)(

01

01

10

10

1

xx

xxxf

xx

xxxf

xP

)(

)()(

)(

)()(

)()(

01

011

10

100

,1

xx

xxxfx

xx

xxxfx

xLxfx iii

Page 41: Tema 5 (I)

Crear la columna L2,i(x) para el polinomio P2(x) a partir de la columna L1,i(x) del polinomio P1(x):

Tablas de Interpolación

)(

)()(

)(

)()(

)(

01

01

10

10

1

xx

xxxf

xx

xxxf

xP

)(

)()(

)(

)()(

)()(

01

011

10

100

,1

xx

xxxfx

xx

xxxfx

xLxfx iii

))((

))(()(

1202

102

xxxx

xxxxxf

))((

))(()(

))((

))(()()(

2101

201

2010

2102

xxxx

xxxxxf

xxxx

xxxxxfxP

Page 42: Tema 5 (I)

Tablas de Interpolación Crear la columna L2,i(x) para el polinomio P2(x)

a partir de la columna L1,i(x) del polinomio P1(x):

))((

))(()(

)(

)()(

)(

)()(

)(

)()(

)(

)()(

)()()(

1202

1022

21

21,1

01

011

20

20,1

10

100

,2,1

xxxx

xxxxxfx

xx

xxxL

xx

xxxfx

xx

xxxL

xx

xxxfx

xLxLxfx iiii

Page 43: Tema 5 (I)

Tablas de Interpolación Calcular los L3,i(x) para el polinomio P3(x): Si el calculo lo hacemos para un x en concreto, los

Ln,i se pueden calcular de los anteriores sin arrastrar la variable x, y el calculo se simplifica.

))((

))(()(

)(

)()(

)(

)()(

)(

)()(

)(

)()(

)()()(

1202

1022

21

21,1

01

011

20

20,1

10

100

,2,1

xxxx

xxxxxfx

xx

xxxL

xx

xxxfx

xx

xxxL

xx

xxxfx

xLxLxfx iiii

Page 44: Tema 5 (I)

)()(

)()()(

)(

)()(

))((

))(()(

)(

)()(

)(

)()(

)(

)()(

)(

)()(

)(

)()(

)(

)()(

)()()()(

2303

2033

32

32,2

1202

1022

31

31,2

21

21,1

01

011

30

30,2

20

20,1

10

100

,3,2,1

xxxx

xxxxxfx

xx

xxxL

xxxx

xxxxxfx

xx

xxxL

xx

xxxL

xx

xxxfx

xx

xxxL

xx

xxxL

xx

xxxfx

xLxLxLxfx iiiii

Tablas de Interpolación Calcular los L3,i(x) para el polinomio P3(x):.

)()()()()()()()()( 3,332,321,310,303 xLxfxLxfxLxfxLxfxP

Page 45: Tema 5 (I)

)()(

)()()(

)(

)()(

))((

))(()(

)(

)()(

)(

)()(

)(

)()(

)(

)()(

)(

)()(

)(

)()(

)()()()(

2303

2033

32

32,2

1202

1022

31

31,2

21

21,1

01

011

30

30,2

20

20,1

10

100

,3,2,1

xxxx

xxxxxfx

xx

xxxL

xxxx

xxxxxfx

xx

xxxL

xx

xxxL

xx

xxxfx

xx

xxxL

xx

xxxL

xx

xxxfx

xLxLxLxfx iiiii

Ejemplo de Tabla de Interpolación Calcula f(x)=(x/2)(x-2) en x=5/2 a partir del polinomio

de interpolación de grado 1 para x0=1 y x1=2

)()()()()( 1,110,101 xLxfxLxfxP

Page 46: Tema 5 (I)

)()(

)()()(

)(

)()(

))((

))(()(

)(

)()(

)(

)()(

2

312

)(

)()(

)(

)()(

2

121

)()()2/5()(

2303

2033

32

32,2

1202

1022

31

31,2

21

21,1

30

30,2

20

20,1

,3,2,1

xxxx

xxxxxfx

xx

xxxL

xxxx

xxxxxfx

xx

xxxL

xx

xxxL

xx

xxxL

xx

xxxL

xLxLLxfx iiiii

Ejemplo de Tabla de Interpolación Calcula f(x)=(x/2)(x-2) en x=5/2 a partir del polinomio

de interpolación de grado 1 para x0=1 y x1=2

2/1)2/3(1)2/1(2)(1 xP

Page 47: Tema 5 (I)

)()(

)()()(

)(

)()(

))((

))(()(

)(

)()(

)(

)()(

2

312

)(

)()(

)(

)()(

2

121

)()()2/5()(

2303

2033

32

32,2

1202

1022

31

31,2

21

21,1

30

30,2

20

20,1

,3,2,1

xxxx

xxxxxfx

xx

xxxL

xxxx

xxxxxfx

xx

xxxL

xx

xxxL

xx

xxxL

xx

xxxL

xLxLLxfx iiiii

Ejemplo de Tabla de Interpolación Calcula f(x)=(x/2)(x-2) en x=5/2 a partir de los valores

para x0=1, x1=2 y x2=3

2/1)(1 xP 2,221,210,202 )()()()( LxfLxfLxfxP

Page 48: Tema 5 (I)

))()((

))()(()(

)(

)()(

8

3

2

33

)(

)()(

4

3

2

312

)(

)()(

8

1

2

121

)()2/5()2/5()(

23103

21033

32

32,2

31

31,2

30

30,2

,3,2,1

xxxxxx

xxxxxxxfx

xx

xxxL

xx

xxxL

xx

xxxL

xLLLxfx iiiii

Ejemplo de Tabla de Interpolación Calcula f(x)=(x/2)(x-2) en x=5/2 a partir de los valores

para x0=1, x1=2 y x2=3/2

2/1)(1 xP 16/17)8/3)(2/3()4/3(1)8/1(2)(2 xP

Page 49: Tema 5 (I)

Ejemplo de Tabla de Interpolación Calcula f(x)=(x/2)(x-2) en x=5/2 a partir de los valores

para x0=1, x1=2 , x2=3 y x3=4

)()()()()()()()()( 3,332,321,310,303 xLxfxLxfxLxfxLxfxP

))()((

))()(()(

)(

)()(

8

3

2

33

)(

)()(

4

3

2

312

)(

)()(

8

1

2

121

)()2/5()2/5()(

23103

21033

32

32,2

31

31,2

30

30,2

,3,2,1

xxxxxx

xxxxxxxfx

xx

xxxL

xx

xxxL

xx

xxxL

xLLLxfx iiiii

Page 50: Tema 5 (I)

Ejemplo de Tabla de Interpolación Calcula f(x)=(x/2)(x-2) en x=5/2 a partir de los valores

para x0=1, x1=2 , x2=3 y x3=4

16/14

16/98/32/33

16/94/32/312

16/18/12/121

)2/5()2/5()2/5()(

3

,3,2,1

x

LLLxfx iiiii

16/17)8/3)(2/3()4/3(1)8/1(2)(2 xP

32/33)16/1(4)16/9)(2/3()16/9(1)16/1(2)(3 xP

2/1)2/3(1)2/1(2)(1 xP

Page 51: Tema 5 (I)

Tablas de Interpolación Otras construcciones de tablas son posibles

(Neville, Aitken, etc.) Algoritmo de Neville: Sea pi,j(x) el valor en x del polinomio de grado j-i

que pasa por los puntos (xk,yk) con k=i,i+1,…,j pi,j(x) satisface la siguiente relación de recurrencia: de forma que p0,n(x) es el valor de Pn(x) en x.

niyxp iii 0)(,

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

Page 52: Tema 5 (I)

Tabla de Interpolación de Neville Por ejemplo, p1,2(x) será

niyxp iii 0)(,

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

Page 53: Tema 5 (I)

Tabla de Interpolación de Neville Por ejemplo, p1,2(x) será

niyxp iii 0)(,

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

21

2,211,12

2,1

)()()()()(

xx

xpxxxpxxxp

Page 54: Tema 5 (I)

Tabla de Interpolación de Neville Por ejemplo, p1,2(x) será

21

2,211,12

2,1

)()()()()(

xx

xpxxxpxxxp

21

2112 )()(

xx

yxxyxx

niyxp iii 0)(,

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

Page 55: Tema 5 (I)

Tabla de Interpolación de Neville Por ejemplo, p1,2(x) será Como se puede ver,

se trata de una recta pasa por los puntos (x1, y1) y (x2, y2)

21

2,211,12

2,1

)()()()()(

xx

xpxxxpxxxp

21

2112 )()(

xx

yxxyxx

Page 56: Tema 5 (I)

Pirámide de Neville Los valores de Pn(x) están en la diagonal superior:

33,33

22,22

11,11

00,00

)(

)(

)(

)(

)(

yxpx

yxpx

yxpx

yxpx

xfyx iii

)(

)(

)(

3,2

2,1

1,0

xp

xp

xp

)(

)(

3,1

2,0

xp

xp)(3,0 xp

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

Page 57: Tema 5 (I)

Pirámide de Neville Para f(x)=(x/2)(x-2) en x=5/2 con x0=1 y x1=2

33,33

22,22

11,11

00,00

)(

)(

)(

)(

)(

yxpx

yxpx

yxpx

yxpx

xfyx iii

)(

)(

)(

3,2

2,1

1,0

xp

xp

xp

)(

)(

3,1

2,0

xp

xp)(3,0 xp

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

Page 58: Tema 5 (I)

Pirámide de Neville Para f(x)=(x/2)(x-2) en x=5/2 con x0=1 y x1=2

33,33

22,22

1,11

0,00

)(

)(

1)(2

2)(1

)(

yxpx

yxpx

xpx

xpx

xfyx iii

)(

)(

2

1)(

3,2

2,1

1,0

xp

xp

xp

)(

)(

3,1

2,0

xp

xp

)(3,0 xp

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

2

1)(1 xP

Page 59: Tema 5 (I)

Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2 y x2=3

2

1)(1 xP

Pirámide de Neville

)(

16

17)(

3,1

2,0

xp

xp)(3,0 xp

16

17)(2 xP

)(

2

3)(3

1)(2

2)(1

)(

3,33

2,22

1,11

0,00

xpx

xpx

xpx

xpx

xfyx iii

)(

4

5)(

2

1)(

3,2

2,1

1,0

xp

xp

xp

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

Page 60: Tema 5 (I)

Pirámide de Neville Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2, x2=3 y x3=4

4)(4

2

3)(3

1)(2

2)(1

)(

3,33

2,22

1,11

0,00

xpx

xpx

xpx

xpx

xfyx iii

4

1)(

4

5)(

2

1)(

3,2

2,1

1,0

xp

xp

xp

1)(

16

17)(

3,1

2,0

xp

xp

32

33)(3,0 xp

32

33)(3 xP

ji

jiijij

jixx

xpxxxpxxxp

)()()()()(

,11,

,

2

1)(1 xP

16

17)(2 xP

Page 61: Tema 5 (I)

Interpolación

● Concepto y Teorema de la Aproximación

● Interpolación de Lagrange

● Tablas de interpolación

● Diferencias divididas

Page 62: Tema 5 (I)

Diferencias divididas

Si con las tablas de los métodos anteriores intentamos obtener una expresión genérica del polinomio Pn(x), es decir, en función de x, esta nos va a resultar compleja y difícil de manejar.

El siguiente método permite obtener la

expresión explícita del polinomio de interpolación, y por eso resulta el más útil cuando luego se pretende derivar, integrar u operar en general con el polinomio.

Page 63: Tema 5 (I)

Diferencias divididas En el método de Diferencias divididas, el polinomio

se obtiene mediante la siguiente expresión:

donde

iki

kiikiikii

ii

iiii

ii

xx

xxfxxfxxf

xx

xfxfxxf

xfxf

],,[],,[],,[

][][],[

)(][

11

1

11

)()](,,,[][)( 1

1

0100 k

n

k

kn xxxxxxxfxfxP

Page 64: Tema 5 (I)

Pirámide de Diferencias divididas Pirámide para calcular Pn(x) para n=3:

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

)(][ ii xfxf

Page 65: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],[ 1 ii xxf

ii

iiii

xx

xfxfxxf

1

11

][][],[

Page 66: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],[ 1 ii xxf01

0110

)()(],[

xx

xfxfxxf

ii

iiii

xx

xfxfxxf

1

11

][][],[

Page 67: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],[ 1 ii xxf01

0110

)()(],[

xx

xfxfxxf

12

1221

)()(],[

xx

xfxfxxf

ii

iiii

xx

xfxfxxf

1

11

][][],[

Page 68: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],[ 1 ii xxf01

0110

)()(],[

xx

xfxfxxf

12

1221

)()(],[

xx

xfxfxxf

23

2332

)()(],[

xx

xfxfxxf

ii

iiii

xx

xfxfxxf

1

11

][][],[

Page 69: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],[ 1 ii xxf ],,[... 3 ii xxf ],,[ 12 iii xxxf

iki

kiikiikii

xx

xxfxxfxxf

],,[],,[],,[ 11

Page 70: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],,[

],,[

321

210

xxxf

xxxf

],[ 1 ii xxf ii xxf ,,[... 3 ],,[ 12 iii xxxf

02

1021210

],[],[],,[

xx

xxfxxfxxxf

iki

kiikiikii

xx

xxfxxfxxf

],,[],,[],,[ 11

Page 71: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],,[

],,[

321

210

xxxf

xxxf

],[ 1 ii xxf ii xxf ,,[... 3 ],,[ 12 iii xxxf

13

2132321

],[],[],,[

xx

xxfxxfxxxf

02

1021210

],[],[],,[

xx

xxfxxfxxxf

iki

kiikiikii

xx

xxfxxfxxf

],,[],,[],,[ 11

Page 72: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],,[

],,[

321

210

xxxf

xxxf],,,[ 3210 xxxxf

],[ 1 ii xxf ii xxf ,,[... 3 ],,[ 12 iii xxxf

13

2132321

],[],[],,[

xx

xxfxxfxxxf

02

1021210

],[],[],,[

xx

xxfxxfxxxf

iki

kiikiikii

xx

xxfxxfxxf

],,[],,[],,[ 11

03

2103213210

],,[],,[],,,[

xx

xxxfxxxfxxxxf

Page 73: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3: Los valores para calcular Pn(x)

son los de la diagonal superior:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],,[

],,[

321

210

xxxf

xxxf],,,[ 3210 xxxxf

],[ 1 ii xxf ii xxf ,,[... 3 ],,[ 12 iii xxxf

)()](,,,[][)( 1

1

0100 k

n

k

kn xxxxxxxfxfxP

Page 74: Tema 5 (I)

Pirámide para calcular Pn(x) para n=3: Los valores para calcular Pn(x)

son los de la diagonal superior:

Pirámide de Diferencias divididas

)(

)(

)(

)(

][

33

22

11

00

xfx

xfx

xfx

xfx

xfx ii

],[

],[

],[

32

21

10

xxf

xxf

xxf

],,[

],,[

321

210

xxxf

xxxf],,,[ 3210 xxxxf

],[ 1 ii xxf ii xxf ,,[... 3 ],,[ 12 iii xxxf

)()](,,,[][)( 1

1

0100 k

n

k

kn xxxxxxxfxfxP

))(](,,[)](,[][)( 1021001003 xxxxxxxfxxxxfxfxP

))()(](,,,[ 2103210 xxxxxxxxxxf

Page 75: Tema 5 (I)

Ejemplo 1 de Diferencias divididas Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2, x2=3 y x3=4

4

3

2

1

][

3

2

1

0

x

x

x

x

xfx ii

iki

kiikiikii

xx

xxfxxfxxf

],,[],,[],,[ 11

Page 76: Tema 5 (I)

Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2, x2=3 y x3=4

44

2

33

12

21

][

3

2

1

0

x

x

x

x

xfx ii

2

5

34

2/34

2

1

23

12/3

112

21

iki

kiikiikii

xx

xxfxxfxxf

],,[],,[],,[ 11

Ejemplo 1 de Diferencias divididas

Page 77: Tema 5 (I)

Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2, x2=3 y x3=4

44

2

33

12

21

][

3

2

1

0

x

x

x

x

xfx ii

2

5

34

2/34

2

1

23

12/3

112

21

124

2/12/5

4

3

13

12/1

iki

kiikiikii

xx

xxfxxfxxf

],,[],,[],,[ 11

Ejemplo 1 de Diferencias divididas

Page 78: Tema 5 (I)

Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2, x2=3 y x3=4

44

2

33

12

21

][

3

2

1

0

x

x

x

x

xfx ii

2

5

34

2/34

2

1

23

12/3

112

21

124

2/12/5

4

3

13

12/1

12

1

14

4/31

iki

kiikiikii

xx

xxfxxfxxf

],,[],,[],,[ 11

Ejemplo 1 de Diferencias divididas

Page 79: Tema 5 (I)

Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2, x2=3 y x3=4

44

2/33

12

21

][

3

2

1

0

x

x

x

x

xfx ii

2/5

2/1

1

],[ 1 ii xxf

1

4/3

],,[ 12 iii xxxf

12/1

],,[ 3 ii xxf

)()](,,,[][)( 1

1

0100 k

n

k

kn xxxxxxxfxfxP

)1(12)(1 xxP

2/1)12/5(2)2/5(1P

Ejemplo 1 de Diferencias divididas

Page 80: Tema 5 (I)

Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2, x2=3 y x3=4

44

2/33

12

21

][

3

2

1

0

x

x

x

x

xfx ii

2/5

2/1

1

],[ 1 ii xxf

1

4/3

],,[ 12 iii xxxf

12/1

],,[ 3 ii xxf

)()](,,,[][)( 1

1

0100 k

n

k

kn xxxxxxxfxfxP

)2)(1)(4/3()1(12)(2 xxxxP

16/1716/916/8)2/1)(2/3)(4/3(2/1)2/5(2P

)2)(1)(4/3()()( 12 xxxPxP

Ejemplo 1 de Diferencias divididas

Page 81: Tema 5 (I)

Para f(x)=(x/2)(x-2), x=5/2, x0=1, x1=2, x2=3 y x3=4

44

2/33

12

21

][

3

2

1

0

x

x

x

x

xfx ii

2/5

2/1

1

],[ 1 ii xxf

1

4/3

],,[ 12 iii xxxf

12/1

],,[ 3 ii xxf

)()](,,,[][)( 1

1

0100 k

n

k

kn xxxxxxxfxfxP

)3)(2)(1)(12/1()2)(1)(4/3()1(12)(3 xxxxxxxP

32/3332/116/17)2/1)(2/1)(2/3)(12/1(16/17)2/5(3P

)3)(2)(1)(12/1()()( 23 xxxxPxP

Ejemplo 1 de Diferencias divididas

Page 82: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Obtén el polinomio de interpolación de una función

de la que se sabe la siguiente tabla de valores:

13

80

151

)(xfx

Page 83: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Obtén el polinomio de interpolación de una función

de la que se sabe la siguiente tabla de valores:

13

80

151

][ ii xfx

3

7

],[ 1 ii xxf

10

158],[ 10 xxf

03

81],[ 21 xxf

Page 84: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Obtén el polinomio de interpolación de una función

de la que se sabe la siguiente tabla de valores:

13

80

151

][ ii xfx

3

7

],[ 1 ii xxf

1

],,[ 12 iii xxxf

10

158],[ 10 xxf

31

73],,[ 210 xxxf

03

81],[ 21 xxf

Page 85: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Obtén el polinomio de interpolación de una función

de la que se sabe la siguiente tabla de valores:

13

80

151

][ ii xfx

3

7

],[ 1 ii xxf

1

],,[ 12 iii xxxf

10

158],[ 10 xxf

13

73],,[ 210 xxxf

03

81],[ 21 xxf

))(](,,[)](,[][)( 1021001002 xxxxxxxfxxxxfxfxP

86)0)(1(1)1(715)( 2

2 xxxxxxP

Page 86: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Amplía el polinomio de interpolación un grado con

un nuevo valor para x3 y f(x3):

55

13

80

151

][ ii xfx

3

7

],[ 1 ii xxf

1

],,[ 12 iii xxxf

86)( 2

2 xxxP

],,,[ 123 iiii xxxxf

Page 87: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Amplía el polinomio de interpolación un grado con

un nuevo valor para x3 y f(x3):

55

13

80

151

][ ii xfx

2

3

7

],[ 1 ii xxf

1

],,[ 12 iii xxxf

86)( 2

2 xxxP

],,,[ 123 iiii xxxxf

35

15],[ 32 xxf

Page 88: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Amplía el polinomio de interpolación un grado con

un nuevo valor para x3 y f(x3):

55

13

80

151

][ ii xfx

2

3

7

],[ 1 ii xxf

5/1

1

],,[ 12 iii xxxf

86)( 2

2 xxxP

],,,[ 123 iiii xxxxf

05

32],,[ 210 xxxf

Page 89: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Amplía el polinomio de interpolación un grado con

un nuevo valor para x3 y f(x3):

55

13

80

151

][ ii xfx

2

3

7

],[ 1 ii xxf

5/1

1

],,[ 12 iii xxxf

86)( 2

2 xxxP

15/2

],,,[ 123 iiii xxxxf

15

15/1],,,[ 3210 xxxxf

Page 90: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Amplía el polinomio de interpolación un grado con

un nuevo valor para x3 y f(x3):

55

13

80

151

][ ii xfx

2

3

7

],[ 1 ii xxf

5/1

1

],,[ 12 iii xxxf

86)( 2

2 xxxP

15/2

],,,[ 123 iiii xxxxf

))()(](,,,[)()( 210321023 xxxxxxxxxxfxPxP

)3()1(15/286)( 2

3 xxxxxxP

)32(15/286 232 xxxxx

Page 91: Tema 5 (I)

Ejemplo 2 de Diferencias divididas Amplía el polinomio de interpolación un grado con

un nuevo valor para x3 y f(x3):

55

13

80

151

][ ii xfx

2

3

7

],[ 1 ii xxf

5/1

1

],,[ 12 iii xxxf

86)( 2

2 xxxP

15/2

],,,[ 123 iiii xxxxf

))()(](,,,[)()( 210321023 xxxxxxxxxxfxPxP

85

28

5

3

15

2)(

23

3

xxxxP