Está en la página 1de 6

MÉTODO DE NEWTÓN-RAPHSON

x
1 ¿ Conel método de newtón−raphson calcule la raíz de f ( x )=e −2 .
Conun valor incial de x 0=0.
x ' x
f ( x )=e −2f ( x )=e

Primera iteración:

x 0=0 f ( 0 )=e 0−2=1−2=−1f ' ( 0 )=e 0=1

f ( x0 ) −1
x 1=x 0− '
=0− =1
f ( x0) 1

Error=
| | x 1−x 0
x1
· 100 %=
1−0
1 | |
=100 %

Segunda iteración:

x 1=1 f ( 1 ) =e 1−2=e−2f ' ( 1 )=e1=e

f ( x1 ) e−2
x 2=x 1− '
=1− =0.735759
f ( x1 ) e

Error=
| | x 2−x 1
x2
·100 %= |
0.735759−1
0.735759 |
=35.914091 %

Tercera iteración:

x 2=0.735759 f ( 0.735759 )=e 0.735759−2=0.087066f ' ( 0.735759 ) =e 0.735759=2.087066

f ( x2 ) 0.087066
x 3=x 2− '
=0.735759− =0.694042
f ( x 2) 2.087066

Error=
| | x 3−x 2
x3
· 100 %= |
0.694042−0.735759
0.694042 |
=6.010669 %

Cuarta iteración:

x 3=0.694042 f ( 0.694042 )=e 0.694042−2=0.001790f ' ( 0.694042 ) =e 0.694042=2.001790

f ( x3) 0.001790
x 4 =x3 − '
=0.694042− =0.693148
f ( x3) 2.001790

Error=
| | x 4−x 3
x4
·100 %= |
0.693148−0.694042
0.693148 |
=0.129081 %

Quinta iteración:
x 4 =0.693148 f ( 0.694042 )=e 0.693148−2=0.000002f ' ( 0.694042 ) =e 0.693148=2.000002

f ( x4) 0.000002
x 5=x 4 − '
=0.693148− =0.693147
f ( x4 ) 2.000002

Error=
| | x 5−x 4
x5
·100 %= |
0.693147−0.693148
0.693147 |
=0.000058 %

Sexta iteración:

x 5=0.693147 f ( 0.694042 )=e 0.693147−2=0f ' ( 0.694042 ) =e 0.693147=2

f ( x5 ) 0
x 6=x 5− '
=0.693147− =0.693147
f ( x5) 2

Error=
| | x 6−x 5
x6
· 100 %= |
0.693147−0.693147
0.693147
=0 % |
CONCLUSIÓN : La raíz aproximadamente sera x=0.693147 con error 0 %
EJECUANDO EL MÉTODO DE NEWTON-RAPHSON EN MATLAB
Algoritmo generado:

%MÉTODO DE NEWTON-RAPHSON
clc
clear all
%Ingreso de datos necesarios para calcular la raiz de la función
syms x
f=input('Ingrese la función:\n');
x1=input('Ingrese el punto inicial:\n');
emax=input('Ingrese el error máximo en porcentaje:\n');
df=diff(f);
f=inline(f);
df=inline(df);
e=100;
n=0;
%Presentación en formato de tabla con el error absoluto
fprintf('n Xi+1 Xi
Error Porcentual:\n')
while(e>emax)
n=n+1;
fp=feval(f,x1);
dfp=feval(df,x1);
x2=x1-((fp)/(dfp));
e=abs((x2-x1)/(x2))*100;
fprintf('%f %f %f %f\n',n,x2,x1,e);
x1=x2;
end
EN MODO ESCRIPT:

INGRESANDO DATOS: Corriendo el algoritmo e ingresando datos


RESULTADOS:

Se da por satisfacida la resolución del método .

3
2 ¿ Conel método de newtón−raphson calcule la raíz de f ( x )=x + 2 x +1 .
Conun valor incial de x 0=0.5
3 ' 2
f ( x )=x +2 x+ 1 f ( x )=3 x + 2

Primera iteración:

x 0=−0.5 f (−0.5 )=(−0.5 )3+ 2 (−0.5 ) +1=−0.125 f ' (−0.5 )=3 (−0.5 )2 +2=2.75

f ( x0 ) −0.125
x 1=x 0− '
=−0.5− =−0.454545
f ( x0 ) 2.75

Error=
| |x 1−x 0
x1
· 100 %= |
−0.454545−(−0.5 )
−0.454545 |
=10.000000 %

Segunda iteración:

x 1=−0.454545 f (−0.454545 )=(−0.454545 )3+ 2 (−0.454545 )+ 1=−0.003004


' 2
f (−0.454545 )=3 (−0.454545 ) +2=2.619833
f ( x1 ) −0.003004
x 2=x 1− '
=−0.454545− =−0.453398
f ( x1 ) 2.619833

Error=
| |x 2−x 1
x2
·100 %= |
−0.453398−(−0.454545 )
−0.453398 |
=0.253004 %
Tercera iteración:

x 2=−0.453398 f (−0.453398 )=(−0.453398 )3+ 2 (−0.453398 )+ 1=−0.000001


' 2
f (−0.453398 )=3 (−0.453398 ) +2=2.616709
f ( x2 ) −0.000001
x 3=x 2− '
=−0.453398− =−0.453398
f ( x 2) 2.616709

Error=
| | x 3−x 2
x3
· 100 %= |
−0.453398−(−0.453398 )
−0.453398
=0 % |
CONCLUSIÓN : La raíz aproximadamente sera x=−0.453398 con error 0 %

COMPROBACIÓN CON MATLAB EL MÉTODO:

INGRESANDO DATOS: Corriendo el algoritmo e ingresando datos

RESULTADOS:
Se da por satisfacida la resolución del método .

También podría gustarte