beamer-tu-logo
Raıces de ecuaciones no lineales
Curso: Metodos Numericos en IngenierıaProfesor: Dr. Jose A. Otero HernandezCorreo: [email protected]: http://metodosnumericoscem.weebly.comUniversidad: ITESM CEM
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
TOPICOS
1 INTRODUCCIONMetodos abiertos
2 ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB
3 NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB
4 SECANTEPresentacion del metodoPrograma MATLAB
5 Problemas
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Topicos
1 INTRODUCCIONMetodos abiertos
2 ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB
3 NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB
4 SECANTEPresentacion del metodoPrograma MATLAB
5 Problemas
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Metodos abiertos
¿Que son los metodos abiertos?Los metodos abiertos para la determinacion de raızrequieren unicamente de un solo valor de inicio (xi) o quecomiencen con dos valores; pero que no encierren la raız.Los metodos abiertos emplean una formula para calcularla raız.Los metodos abiertos a veces divergen o se alejan de laraız verdadera a medida que avanza el calculo.Cuando los metodos abiertos convergen lo hacen muchomas rapido que los metodos cerrados.
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Metodos abiertos
¿Que metodos abiertos estudiaremos?Metodos de iteracion simple de punto fijo,Metodo de Newton-Raphson,Metodo de la secante,
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Topicos
1 INTRODUCCIONMetodos abiertos
2 ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB
3 NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB
4 SECANTEPresentacion del metodoPrograma MATLAB
5 Problemas
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
Metodos de iteracion simple de punto fijoToda ecuacion f(x) = 0 puede transformarse de tal modo quela variable x este del lado izquierdo de la ecuacion.
f(x) = 0→ x = g(x)
De esta forma, dado un valor inicial para la raız xi, la ecuacionx = g(x) se utiliza para obtener una nueva aproximacion de laraız xi+1, esto es:
xi+1 = g(xi)
Se llega a una formula iterativa para obtener la raız. El erroraproximado se puede obtener:
εa =
∣∣∣∣xi+1 − xixi+1
∣∣∣∣ 100%
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
Ejemplos
x2 − 2x+ 3 = 0→ x = x2+32 , por tanto:
xi+1 =x2i+32
sin(x) = 0→ x = sin(x) + x, por tanto:xi+1 = sin(xi) + xi
e−x − x = 0→ x = e−x, por tanto:xi+1 = e−xi
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
Convergencia y divergencia
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
Convergencia y divergenciaEl metodos de iteracion simple de punto fijo establece que:
xi+1 = g(xi)
Considerando que la solucion verdadera xr
xr = g(xr)
Restandoxr − xi+1 = g(xr)− g(xi)
El teorema del valor medio, aplicado a nuestro problema,establece que si una funcion g(x) y su derivada son continuasen el intervalo xi 6 x 6 xr, existe al menos un valor de x = ξdentro del intervalo para el que: g
′(ξ) = g(xr)−g(xi)
xr−xi
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
Convergencia y divergenciaFinalmente:
xr − xi+1 = g′(ξ)(xr − xi)
Ev,i+1 = g′(ξ)Ev,i
Convergencia y divergencia
Si |g′ | < 1, entonces los errores disminuyen con cadaiteracion.Si |g′ | > 1, entonces los errores aumentan con cadaiteracion.
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
function p u n t o f i j o v 1 ( g , x0 ,EE)% pun to f i j oV1 : Nombre de l a func ion% Valores de entrada% g : func ion matematica de entrada ( x = g ( x ) )% x0 : Valor de i n i c i a l% EE: Er ro r Estimado% Valores de s a l i d a% Raiz% Er ro r Aproximado% IM : I t e r a c i o n MaximaIM=1;x ( IM ) =x0 ;x ( IM+1)=g ( x ( IM ) ) ;EA( IM+1)=abs ( ( x ( IM+1)−x ( IM ) ) / x ( IM+1) ) ∗100;while EA( IM+1)>EE
IM=IM+1;x ( IM+1)=g ( x ( IM ) ) ;EA( IM+1)=abs ( ( x ( IM+1)−x ( IM ) ) / x ( IM+1) ) ∗100;
endSal ida1 =[ ’ I t e r a c i o n Maxima= ’ ,num2str ( IM ) ] ;Sal ida2 =[ x ( 2 : size ( x , 2 ) ) ’ EA( 2 : size ( x , 2 ) ) ’ ] ;disp ( ’ ’ )disp ( Sal ida1 )disp ( ’ ’ )disp ( ’ Raiz Er ro r Apro ’ )disp ( Sal ida2 )
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
>> p u n t o f i j o v 1 (@( x ) exp(−x ) , 0 , 0 .01)
I t e r a c i o n Maxima=19
Raiz Er ro r Apro1.0000 100.00000.3679 171.82820.6922 46.85360.5005 38.30910.6062 17.44680.5454 11.15660.5796 5.90340.5601 3.48090.5711 1.93080.5649 1.10890.5684 0.62440.5664 0.35560.5676 0.20120.5669 0.11430.5673 0.06480.5671 0.03670.5672 0.02080.5671 0.01180.5672 0.0067
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
>> p u n t o f i j o v 1 (@( x ) exp(−x ) , 0 , 0.001)
I t e r a c i o n Maxima=23
Raiz Er ro r Apro1.0000 100.00000.3679 171.82820.6922 46.85360.5005 38.30910.6062 17.44680.5454 11.15660.5796 5.90340.5601 3.48090.5711 1.93080.5649 1.10890.5684 0.62440.5664 0.35560.5676 0.20120.5669 0.11430.5673 0.06480.5671 0.03670.5672 0.02080.5671 0.01180.5672 0.00670.5671 0.00380.5671 0.00220.5671 0.00120.5671 0.0007
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Determinacion del coeficiente de arrastre (c)
Calcular los ceros de la funcion:
f(c) =gm
c
(1− e−
cmt)− v
Considerando m = 68.1 kg, v = 40m/s y t = 10 s.
f (c) =667.38
c
(1− e−0.146843 c
)− 40 = 0
667.38
40
(1− e−0.146843 c
)= c
g (c) =667.38
40
(1− e−0.146843 c
)
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
>> p u n t o f i j o v 1 (@( x ) 667.38/40∗(1 − exp(−0.146843∗x ) ) , 14 , 0.001)
I t e r a c i o n Maxima=8
Raiz Er ro r Apro14.5490 3.773814.7145 1.124114.7617 0.320314.7750 0.090014.7788 0.025214.7798 0.007114.7801 0.002014.7802 0.0006
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
>> p u n t o f i j o v 1 (@( x ) exp(−x ) 667.38/ x∗(1 − exp(−0.146843∗x ) )−40+x , 14 , 0.001)
I t e r a c i o n Maxima=180
Raiz Er ro r Apro15.5687 10.076014.0778 10.590715.4857 9.091914.1474 9.459615.4123 8.2065. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .
14.7801 0.001214.7803 0.001114.7801 0.001114.7803 0.001014.7801 0.0010
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Topicos
1 INTRODUCCIONMetodos abiertos
2 ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB
3 NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB
4 SECANTEPresentacion del metodoPrograma MATLAB
5 Problemas
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
FormulaDe la figura se puede apreciar que:
f′(xi) =
f(xi)− 0
xi − xi+1
Despejando xi+1 se llega a:
xi+1 = xi −f(xi)
f ′(xi)→Formula de Newton-Raphson
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
Analisis de erroresLa expansion de la serie te Taylor se puede escribir como:
f(xi+1) = f(xi) + f′(xi)(xi+1 − xi) +
f′′(ξ)
2!(xi+1 − xi)2 + · · ·
donde ξ se encuentra dentro del intervalo [xi xi+1]. Truncandola serie de Taylor despues del termino primera derivada, seobtiene:
f(xi+1) = f(xi) + f′(xi)(xi+1 − xi)
Como en la interseccion con el eje x, f(xi+1) = 0, entonces dela expresion anterior se llega a la formula de Newton-Raphson.Por otro lado, evaluando la serie de Taylor xi+1 = xr (valorverdadero) y como f(xr) = 0
0 = f(xi) + f′(xi)(xr − xi) +
f′′(ξ)
2!(xr − xi)2
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
Analisis de erroresRestando las expresiones rojas:
0 = f′(xi)(xr − xi+1) +
f′′(ξ)
2!(xr − xi)2
0 = f′(xi)Ev,i+1 +
f′′(ξ)
2!E2
v,i
Finalmente, tanto xi como ξ se deberan aproximar a la raız xr:
Ev,i+1 = −f′′(xr)
2!f ′(xr)E2
v,i
El error es proporcional al cuadrado del error anterior, por locual tenemos una convergencia cuadratica.
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
Desventajas
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
function newtonraphsonv1 ( f , x0 ,EE)% newtonraphsonv1 : Nombre de l a func ion% Valores de entrada% f : func ion matematica de entrada ( f ( x ) )% x0 : Valor de i n i c i a l% EE: Er ro r Estimado% Valores de s a l i d a% Raiz% Er ro r Aproximado% IM : I t e r a c i o n Maximasyms x ;Df=@( xx ) subs ( d i f f ( f , x ) , x , xx ) ; %Derivada de f : Funcion matematicaIM=1;r ( IM ) =x0 ;r ( IM+1)= r ( IM )−f ( r ( IM ) ) / Df ( r ( IM ) ) ;EA( IM+1)=abs ( ( r ( IM+1)−r ( IM ) ) / r ( IM+1) ) ∗100;while EA( IM+1)>EE
IM=IM+1;r ( IM+1)= r ( IM )−f ( r ( IM ) ) / Df ( r ( IM ) ) ;EA( IM+1)=abs ( ( r ( IM+1)−r ( IM ) ) / r ( IM+1) ) ∗100;
endSal ida1 =[ ’ I t e r a c i o n Maxima= ’ ,num2str ( IM ) ] ;Sal ida2 =[ r ( 2 : size ( r , 2 ) ) ’ EA( 2 : size ( r , 2 ) ) ’ ] ;disp ( ’ ’ )disp ( Sal ida1 )disp ( ’ ’ )disp ( ’ Raiz Er ro r Apro ’ )disp ( Sal ida2 )
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
>> newtonraphsonv1 (@( x ) 667.38/ x∗(1 − exp(−0.146843∗x ) )−40, 14 , 0.001)
I t e r a c i o n Maxima=3
Raiz Er ro r Apro14.7566 5.127414.7802 0.159314.7802 0.0001
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
>> newtonraphsonv1 (@( x ) xˆ10−1, 0 .5 , 0.001)
I t e r a c i o n Maxima=43
Raiz Er ro r Apro51.6500 99.031946.4850 11.111141.8365 11.111137.6529 11.111133.8876 11.1111. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .1.0237 5.8305
1.0023 2.12991.0000 0.22921.0000 0.00241.0000 0.0000
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Topicos
1 INTRODUCCIONMetodos abiertos
2 ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB
3 NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB
4 SECANTEPresentacion del metodoPrograma MATLAB
5 Problemas
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Presentacion del metodo
FormulaUn problema potencial en la implementacion del metodo deNewton-Raphson es la evaluacion de la derivada. La derivadase podrıa aproximar a la secante, esto serıa:
f′(xi) ≈
f(xi−1)− f(xi)xi−1 − xi
Esta aproximacion se conoce como diferencia finita haciaatras. Sustituyendo esta expresion en la formula deNewton-Raphson:
xi+1 = xi −(xi−1 − xi)f (xi)f (xi−1)− f (xi)
La expresion anterior es la formula del metodo de la secante.Aquı se necesitan dos valores de inicio: xi y xi−1
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
function secantev1 ( f , x0 , x1 ,EE)% secantev1 : Nombre de l a func ion% Valores de entrada% f : func ion matematica de entrada ( f ( x ) )% x0 : Valor de i n i c i a l ( x i−1)% x1 : Valor de i n i c i a l ( x i )% EE: Er ro r Estimado% Valores de s a l i d a% Raiz% Er ro r Aproximado% IM : I t e r a c i o n MaximaIM=1;x ( IM ) =x0 ;x ( IM+1)=x1 ;x ( IM+2)=x ( IM+1)−f ( x ( IM+1) ) ∗( x ( IM )−x ( IM+1) ) / ( f ( x ( IM ) )−f ( x ( IM+1) ) ) ;EA( IM+2)=abs ( ( x ( IM+2)−x ( IM+1) ) / x ( IM+2) ) ∗100;while EA( IM+2)>EE
IM=IM+1;x ( IM+2)=x ( IM+1)−f ( x ( IM+1) ) ∗( x ( IM )−x ( IM+1) ) / ( f ( x ( IM ) )−f ( x ( IM+1) ) ) ;EA( IM+2)=abs ( ( x ( IM+2)−x ( IM+1) ) / x ( IM+2) ) ∗100;
endSal ida1 =[ ’ I t e r a c i o n Maxima= ’ ,num2str ( IM ) ] ;Sal ida2 =[ x ( 3 : size ( x , 2 ) ) ’ EA( 3 : size ( x , 2 ) ) ’ ] ;disp ( ’ ’ )disp ( Sal ida1 )disp ( ’ ’ )disp ( ’ Raiz Er ro r Apro ’ )disp ( Sal ida2 )
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Programa MATLAB
Programa MATLAB
>> secantev1 (@( x ) 667.38/ x∗(1 − exp(−0.146843∗x ) )−40, 15 , 16 , 0.001)
I t e r a c i o n Maxima=4
Raiz Er ro r Apro14.7696 8.330614.7807 0.075214.7802 0.003514.7802 0.0000
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Topicos
1 INTRODUCCIONMetodos abiertos
2 ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB
3 NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB
4 SECANTEPresentacion del metodoPrograma MATLAB
5 Problemas
beamer-tu-logo
INTRODUCCION ITERACION SIMPLE DE PUNTO FIJO NEWTON-RAPHSON SECANTE Problemas
Problema 1Determine la raız real mas grandef(x) = 0.95x3 − 5.9x2 + 10.9x− 6:
a-) En forma grafica.b-) Con el uso del metodo de Newton-Raphson (tres
iteraciones, xi = 3.5).c-) Con el uso de la secante (tres iteraciones,
xi−1 = 2.5 y xi = 3.5).