Professional Documents
Culture Documents
, Verano 2011
MTODOS NUMRICOS
Dr. Alejandro Pizano Martnez
Contenido
INTERPOLACIN:
Interpolacin de polinomios de Newton
Interpolacin de polinomios de Lagrange
Tarea 1
AJUSTE DE CURVAS:
Mnimos Cuadrados
Regresin Lineal Simple
Regresin Lineal Mltiple
Regresin No Lineal Simple (Polinomial)
Tarea 2
INTERPOLACIN
el
1.3862944
1.7917595
1.6094379
F [ x2 , x1 , x0 ]( x x0 )( x x1 )
F [ x3 , x2 , x1 , x0 ]( x x0 )( x x1 )( x x2 )
f(x)
F [ x1 , x0 ]
F [ x2 , x1 , x0 ]
F [ x3 , x2 , x1 , x0 ]
0.4621
-0.0519
0.0079
1.3862944
0.2027
-0.0204
1.7917595
0.1823
1.6094379
2
1.5
1
Real
Aprox.
0.5
0
f(x)
f ( x ) 0
0.462 1( x1)
-0. 0519( x1)( x4)
0.0079( x1)( x4)( x 6)
-0.5
-1
-1.5
-2
Er F [ x3 , x2 , x1 , x0 ]( x x0 )( x x1 )( x x2 )
0.0079(21)(24)( x 6) 0.0629232
-2.5
4
x
Error relativo
0.5
0.45
0.4
0.35
Error relativo
f (2) 0
0.4621(21)
-0.0519(21)(24)
0.0079(21)(24)(26)
0.6287674
0.3
0.25
0.2
0.15
0.1
0.05
0.2
0.4
0.6
0.8
1
1.2
1.4
Orden de la aproximaxin
1.6
1.8
donde
Li ( x)
j0
ji
( x x j )
( xi x j )
n=1, tenemos,
1
(
)
x x j
( x x0 )
( x x1 )
f ( x)
f ( xi )
f ( x0 )
f ( x1 )
( x0 x1 )
( x1 x0 )
i0 j0 ( xi x j )
ji
i0
( x x j )
( x x1 ) ( x x2 )
f
(
x
)
f ( x0 )
( x0 x1 ) ( x0 x2 )
j0 ( xi x j )
ji
( x x0 ) ( x x2 )
f ( x1 )
( x1 x0 ) ( x1 x2 )
f ( x)
( x x0 ) ( x x1 )
f ( x2 )
( x2 x0 ) ( x2 x1 )
Note que a diferencia del polinomio de Newton el
polinomio de Lagrange est compuesto por la suma
de trminos de orden n.
1.3862944
1.7917595
1.6094379
Segundo orden
(24) (26)
f ( x)
(0.00000)
(14) (16)
(21) (26)
1.3862944
(41) (46)
(21) (24)
1.7917595
(61) (64)
0.5658444
Tarea 1
1. Implementar
el
algoritmo
computacional
interpolacin de polinomios de Newton.
de
2.5
f(x)
Tarea 1
d)
2.5
f(x)
Repetir
el
ejercicio
2,
con
excepcin
de
AJUSTE DE CURVAS
Mnimos Cuadrados
En general, si se tienen n datos sujetos a ruido,
se puede aproximar una curva que ajuste de la
mejor manera la tendencia de los datos. Esto se
hace en base a la ecuacin de mnimos cuadrados,
n
Min Sr ( yi m yi a )2
i1
yia =f(xi,a)
Entonces, los coeficientes o parmetros a de este
f(x)
x1
y1
x2
y2
.
.
.
.
.
.
xn
yn
f(x Lnea
)
ajustada
Datos de
mediciones.
Min Sr ( yi m a0 a1 xi )2
i1
Sr 2 yim a0 a1 xi 0
a0
i1
i1
i1
Sr 2
a1
2
y
x
a
x
a
x
im i 0 i 1 i 0
i1
i1
i1
Sr
ser
Sr 2
a0
Sr 2
a1
a0
yim na1 xi 0
i1
i1
y
i1
x a0 xi a x 0
i1
i1
im i
2
1 i
y x a
im
i1
i 1
i1
n
n
n yim xi xi yim
i1 i1
a1 i1
2
n
n
2
n
x
i xi
i1 i1
n x i
i1
n
n
2
x
x
i i
i1
i1
a 0
a
1
yim
yim x i
i1
i1
n
3.5
6.0
5.5
x 28
i1
x
i1
2
i
6
5
4
y
i1
n
140
im
3
2
y
i1
24
Aprox
Med.
f(x)
x 119.5
im i
1
0
0
4
X
caso
anterior,
n
x
x
y
1i
2i
im
.
.
.
i1
i1
a 0 i1
n
n
.
.
.
n
n
2
x
x
x
x
a
y
x
.
.
.
1i
1i
1i 2 i
1 i1 im 1 i
i1
i1
i1
n
a 2 n
X1n X2n
yn
n
n
x
2
yim x2 i
2 i x1i x2 i x2 i
i1
i1
i1
n
i1
x
x
x
x
x x
x
x x
x
i1
i2
im
i1
2
i1
i 2 i1
im 1i
i2
i1 i 2
2
i2
im i 2
K
K
M
x
x x
x x
a0
a
i1 im
1
i 2 im a2
M M
xim2 am
im
y
yx
y x
i
i i1
i i2
M
yi xin
x1
X2
f(x)
10
2.5
27
6 16.5 14 a 0
54
16.5 76.25 48 a 1 243.5
100
14 48 54 a 2
a0 5, a1 4, a2 3
yia 5 4 xi 3 xi
y1
x2
y2
.
.
.
.
.
.
xn
yn
Aplicando
la
teora
mnimos a Sr
y procediendo
comon en
n
n
n
casos
anteriores,
1
x
x
y
1i 1 i
im
i1 i1 i1 a 0 i1
n
n
n
n
2
3
x
x
x
a
y
x
1i 1i 1 i 1 im 1 i
in1 in1 in1 a 2 in1
x 2 x 3 x 4
yim x12i
1i 1i 1i
i1 i1 i1
i1
de
los
Ajuste
No
Lineal
(Polinomial):Ejemplo
f(x)
0
1
2
3
4
5
2.1
7.7
13.6
27.2
40.9
61.1
90
Med.
Aprox
80
70
60
f(x)
x1
Simple
50
40
6 15 55 a 0
152.6
15 55 225 a 585.6
2488.8
55 225 979 a 2
30
20
10
0
-1
Tarea 2
1. Implementar
el
algoritmo
computacional
de
regresin lineal mltiple (x,y)R3
2. Implementar
el
algoritmo
computacional
de
regresin no lineal simple (x,y)R2
3. Manualmente
ajuste
un
polinomio
lineal
(regresin lineal simple) utilizando los datos
de la columna x1 y la columna Y medida de la
siguientes Tabla.
Reporte el procedimiento e
No.
Y
X
X
indique
claramente
los Datocoeficientes
del
s
polinomio ajustado y el polinomio.
Grafique
1
0
0
15.0000 los
2
1.0000
1.0000
18.0000
datos y el polinomio ajustado
una 12.8000
misma
3
1.0000en 1.2100
4
1.2500
1.5600
25.7000
figura.
5
1.5000
2.2500
20.6000
1
6
7
8
9
10
11
12
13
14
1.7500
2.0000
2.1000
2.2000
2.2500
2.5000
2.7500
3.0000
3.1000
3.0600
4.0000
4.4100
4.8400
5.0600
6.2500
7.5600
9.0000
9.6100
medida
35.0000
29.8000
45.5000
40.3000
32.0000
50.2000
47.5000
73.3000
55.5000
Tarea 2
4.
Entrega de resultados
Los reportes de resultados, que contengas los
elementos que hemos acordado, sern entregados
para su revisin el primer martes regresando de
vacaciones (26 de Julio de 2011).