Curso de Métodos Numéricos. Raíces de ecuaciones...

Post on 21-Sep-2018

226 views 0 download

Transcript of Curso de Métodos Numéricos. Raíces de ecuaciones...

Curso de M etodos Num ericos.Raıces de ecuaciones no lineales

Curso : Metodos Numericos en Ingenierıa

Profesor : Dr. Jose A. Otero Hernandez

Universidad : ITESM CEM

Fecha : Jueves, 18 de septiembre de 2014

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

TOPICOS

1 INTRODUCCIONMetodos abiertos

2 METODOS DE ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB

3 METODO DE NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB

4 METODO DE LA SECANTEPresentacion del metodoPrograma MATLAB

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Topicos

1 INTRODUCCIONMetodos abiertos

2 METODOS DE ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB

3 METODO DE NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB

4 METODO DE LA SECANTEPresentacion del metodoPrograma MATLAB

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que son los m etodos 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.

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que son los m etodos 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.

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que son los m etodos 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.

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que son los m etodos 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.

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que son los m etodos 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.

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que metodos abiertos estudiaremos?

Metodos de iteracion simple de punto fijo,

Metodo de Newton-Raphson,

Metodo de la secante,

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que metodos abiertos estudiaremos?

Metodos de iteracion simple de punto fijo,

Metodo de Newton-Raphson,

Metodo de la secante,

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que metodos abiertos estudiaremos?

Metodos de iteracion simple de punto fijo,

Metodo de Newton-Raphson,

Metodo de la secante,

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Metodos abiertos

¿Que metodos abiertos estudiaremos?

Metodos de iteracion simple de punto fijo,

Metodo de Newton-Raphson,

Metodo de la secante,

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Topicos

1 INTRODUCCIONMetodos abiertos

2 METODOS DE ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB

3 METODO DE NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB

4 METODO DE LA SECANTEPresentacion del metodoPrograma MATLAB

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Metodos de iteraci on simple de punto fijo

Toda 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 − xi

xi+1

∣∣∣∣ 100%

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Metodos de iteraci on simple de punto fijo

Toda 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 − xi

xi+1

∣∣∣∣ 100%

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Metodos de iteraci on simple de punto fijo

Toda 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 − xi

xi+1

∣∣∣∣ 100%

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Metodos de iteraci on simple de punto fijo

Toda 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 − xi

xi+1

∣∣∣∣ 100%

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Metodos de iteraci on simple de punto fijo

Toda 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 − xi

xi+1

∣∣∣∣ 100%

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Metodos de iteraci on simple de punto fijo

Toda 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 − xi

xi+1

∣∣∣∣ 100%

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Convergencia y divergencia

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Convergencia y divergencia

El 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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Convergencia y divergencia

Finalmente: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.

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

funct ion p u n t o f i j o v 1 ( funG , x0 ,EE)% pun to f i j oV1 : Nombre de l a func ion% Valores de entrada% funG : func ion g 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 Maximag= i n l i n e ( funG ) ;IM=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 )

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

>> p u n t o f i j o v 1 ( ’ exp(−x ) ’ , 0 , 0 . 0 1 )

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

>> p u n t o f i j o v 1 ( ’ exp(−x ) ’ , 0 , 0 . 0 0 1 )

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Determinaci on del coeficiente de arrastre (c)

Calcular los ceros de la funcion:

f (c) =gm

c

(1− e−

cm

t)− 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.3840

(1− e−0.146843 c

)= c

g (c) =667.38

40(1− e−0.146843 c

)

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

>> p u n t o f i j o v 1 ( ’ 667.38/40∗(1 − exp(−0.146843∗x ) ) ’ , 1 4 , 0 . 0 0 1 )

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

>> p u n t o f i j o v 1 ( ’ 667.38/ x∗(1 − exp(−0.146843∗x ) )−40+x ’ , 1 4 , 0 . 0 0 1 )

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Topicos

1 INTRODUCCIONMetodos abiertos

2 METODOS DE ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB

3 METODO DE NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB

4 METODO DE LA SECANTEPresentacion del metodoPrograma MATLAB

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

FormulaDe la figura se puede apreciar que:

f′(xi) =

f(xi)− 0xi − xi+1

Despejando xi+1 se llega a:

xi+1 = xi −f(xi)f ′(xi)

→Formula de Newton-Raphson

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

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), entonces de laexpresion 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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

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!

E2v,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.

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

Desventajas

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

funct ion newtonraphsonv1 ( fun , x0 ,EE)% newtonraphsonv1 : Nombre de l a func ion% Valores de entrada% fun : func ion 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 Maximaf = i n l i n e ( fun ) ;syms x ; Derivada= d i f f ( fun , x ) ;Df= i n l i n e ( Derivada ) ;IM=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 )

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

>> newtonraphsonv1 ( ’ 667.38/ x∗(1 − exp(−0.146843∗x ) )−40 ’ , 1 4 , 0 . 0 0 1 )

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

>> newtonraphsonv1 ( ’ xˆ10−1 ’ , 0 . 5 , 0 . 0 0 1 )

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

funct ion newtonraphsonv2 ( fun , dfun , x0 ,EE)% newtonraphsonv1 : Nombre de l a func ion% Valores de entrada% fun : func ion de entrada ( f ( x ) )% dfun : der ivada de l a 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 Maximaf = i n l i n e ( fun ) ;Df= i n l i n e ( dfun ) ;IM=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 )

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Topicos

1 INTRODUCCIONMetodos abiertos

2 METODOS DE ITERACION SIMPLE DE PUNTO FIJOPresentacion del metodoPrograma MATLAB

3 METODO DE NEWTON-RAPHSONPresentacion del metodoPrograma MATLAB

4 METODO DE LA SECANTEPresentacion del metodoPrograma MATLAB

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Presentaci on del m etodo

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

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

funct ion secantev1 ( fun , x0 , x1 ,EE)% secantev1 : Nombre de l a func ion% Valores de entrada% fun : func ion 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 Maximaf = i n l i n e ( fun ) ;IM=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 )

INTRODUCCION METODOS DE ITERACION SIMPLE DE PUNTO FIJO METODO DE NEWTON-RAPHSON METODO DE LA SECANTE

Programa MATLAB

Programa MATLAB

>> secantev1 ( ’ 667.38/ x∗(1 − exp(−0.146843∗x ) )−40 ’ , 1 5 , 1 6 , 0 . 0 0 1 )

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