Está en la página 1de 32

LISTA 1 DE EJERCICIOS CON EL MTODO DE NEWTON RAPHSON

EJERCICIO 1

a) Ubique los ceros de la funcin:

clc
clear
x=[-2:0.01:3];
y1=x.^2;
y2=x+2;
plot(x,y1,'r','linewidth',2)
hold on
plot(x,y2,'k','linewidth',2)
grid on
hold off

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3

function y=fnew1(x)
y=x^2-x-2;
end
function y=dfnew1(x)
y=2*x-1;
end

b) Aplique el mtodo de Newton Raphson usando el


programa de MATLAB, analizando la convergencia:

I)

>> p0=-1.5, toler=10^(-6), N=50

p0 =

-1.500000000000000

toler =

1.000000000000000e-006

N =

50

>> [p1]= newton('fnew1','dfnew1',p0,toler,N)

1 -1.062500000000

2 -1.001250000000

3 -1.000000520400

4 -1.000000000000

p1 =

-1.000000000000090

II)

>> p0=0, toler=10^(-6), N=50

p0 =

toler =
1.000000000000000e-006

N =

50

>> [p1]= newton('fnew1','dfnew1',p0,toler,N)

1 -2.000000000000

2 -1.200000000000

3 -1.011764705882

4 -1.000045777066

5 -1.000000000698

6 -1.000000000000

p1 =

-1

III)

>> p0=10, toler=10^(-6), N=50

p0 =

10

toler =

1.000000000000000e-006

N =

50

>> [p1]= newton('fnew1','dfnew1',p0,toler,N)

1 5.368421052632

2 3.165291607397

3 2.254738454603

4 2.018490413795
5 2.000112577399

6 2.000000004224

7 2.000000000000

p1 =

IV)

>> p0=-30, toler=10^(-6), N=50

p0 =

-30

toler =

1.000000000000000e-006

N =

50

>> [p1]= newton('fnew1','dfnew1',p0,toler,N)

1 -14.786885245902

2 -7.217035116248

3 -3.504298934398

4 -1.783097522884

5 -1.134300380120

6 -1.005518138624

7 -1.000010112749

8 -1.000000000034

9 -1.000000000000

p1 =

-1
V)

>> p0=-100, toler=10^(-6), N=50

p0 =

-100

toler =

1.000000000000000e-006

N =

50

>> [p1]= newton('fnew1','dfnew1',p0,toler,N)

1 -49.761194029851

2 -24.652980088422

3 -12.121216354813

4 -5.899743801769

5 -2.875660187861

6 -1.521098236276

7 -1.067177182924

8 -1.001439777823

9 -1.000000690324

10 -1.000000000000

p1 =

-1.000000000000159
EJERCICIO 2

a) Ubique los ceros de la funcin:

clc
clear
x=[-3:0.01:3];
y1=x;
y2=2.^(-x);
plot(x,y1,'r',x,y2,'k','linewidth',2)
grid on

-2

-4
-3 -2 -1 0 1 2 3

function y=fnew2(x)
y=x-2.^(-x);
end

function y=dfnew2(x)
y=1+(2.^(-x))*log(2);
end
b) Aplique el mtodo de Newton Raphson usando el
programa de MATLAB, analizando la convergencia:

I)

>> p0=1, toler=10^(-8), N=40

p0 =

toler =

1.000000000000000e-008

N =

40

>> [p1]= newton('fnew2','dfnew2',p0,toler,N)

1 0.628687207584

2 0.641169034643

3 0.641185744475

4 0.641185744505

p1 =

0.641185744504986

II)

>> p0=0, toler=10^(-8), N=40

p0 =

toler =

1.000000000000000e-008

N =

40
>> [p1]= newton('fnew2','dfnew2',p0,toler,N)

1 0.590616109150

2 0.640909617724

3 0.641185736374

4 0.641185744505

p1 =

0.641185744504986

III)

>> p0=10, toler=10^(-6), N=50

p0 =

10

toler =

1.000000000000000e-006

N =

50

>> [p1]= newton('fnew2','dfnew2',p0,toler,N)

1 0.007740338488

2 0.591904230224

3 0.640923588441

4 0.641185737176

5 0.641185744505

p1 =

0.641185744504986

IV)

>> p0=100, toler=10^(-6), N=100


p0 =

100

toler =

1.000000000000000e-006

N =

100

>> [p1]= newton('fnew2','dfnew2',p0,toler,N)

1 0.000000000000

2 0.590616109150

3 0.640909617724

4 0.641185736374

5 0.641185744505

p1 =

0.641185744504986

V)

>> p0=-100, toler=10^(-6), N=100

p0 =

-100

toler =

1.000000000000000e-006

N =

100

>> [p1]= newton('fnew2','dfnew2',p0,toler,N)

1 -98.557304959111

2 -97.114609918222
3 -95.671914877333

4 -94.229219836444

5 -92.786524795555

6 -91.343829754666

7 -89.901134713777

8 -88.458439672888

9 -87.015744631999

10 -85.573049591110

11 -84.130354550221

12 -82.687659509332

13 -81.244964468443

14 -79.802269427555

15 -78.359574386666

16 -76.916879345777

17 -75.474184304888

18 -74.031489263999

19 -72.588794223110

20 -71.146099182221

21 -69.703404141332

22 -68.260709100443

23 -66.818014059554

24 -65.375319018665

25 -63.932623977776

26 -62.489928936887

27 -61.047233895998
28 -59.604538855109

29 -58.161843814220

30 -56.719148773331

31 -55.276453732442

32 -53.833758691553

33 -52.391063650664

34 -50.948368609775

35 -49.505673568886

36 -48.062978527997

37 -46.620283487108

38 -45.177588446218

39 -43.734893405328

40 -42.292198364435

41 -40.849503323535

42 -39.406808282617

43 -37.964113241653

44 -36.521418200568

45 -35.078723159166

46 -33.636028116939

47 -32.193333072571

48 -30.750638022648

49 -29.307942958355

50 -27.865247856978

51 -26.422552660179

52 -24.979857218623
53 -23.537161151510

54 -22.094463492037

55 -20.651761797875

56 -19.209049934868

57 -17.766312600675

58 -16.323511927875

59 -14.880555112723

60 -13.437217398261

61 -11.992962461826

62 -10.546534550806

63 -9.095066327502

64 -7.632236890731

65 -6.144857635497

66 -4.608207550077

67 -2.988724915620

68 -1.308252622248

69 0.084951730837

70 0.603765762454

71 0.641035037232

72 0.641185742083

73 0.641185744505

p1 =

0.641185744504986
EJERCICIO 3

a) Ubique los ceros de la funcin:

clc
clear
x=[-2:0.01:3];
y1=x.^3;
y2=x+4;
plot(x,y1,'r',x,y2,'k','linewidth',2)
grid on

30

25

20

15

10

-5

-10
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3

function y=fnew3(x)
y=(x.^3)-x-4;
end

function y=dfnew3(x)
y=(3*x.^2)-1;
end
b) Aplique el mtodo de Newton Raphson usando el
programa de MATLAB, analizando la convergencia:
I)

>> p0=1, toler=10^(-8), N=50

p0 =

toler =

1.000000000000000e-008

N =

50

>> [p1]= newton('fnew3','dfnew3',p0,toler,N)

1 3.000000000000

2 2.230769230769

3 1.881118881119

4 1.800478486494

5 1.796332590707

6 1.796321903330

7 1.796321903259

p1 =

1.796321903259442

II)

>> p0=2, toler=10^(-8), N=50

p0 =

toler =

1.000000000000000e-008
N =

50

>> [p1]= newton('fnew3','dfnew3',p0,toler,N)

1 1.818181818182

2 1.796613025529

3 1.796321955862

4 1.796321903259

5 1.796321903259

p1 =

1.796321903259442

III)

>> p0=0.5, toler=10^(-8), N=50

p0 =

0.500000000000000

toler =

1.000000000000000e-008

N =

50

>> [p1]= newton('fnew3','dfnew3',p0,toler,N)

1 -17.000000000000

2 -11.341801385681

3 -7.570452974129

4 -5.053093591455

5 -3.360379055941

6 -2.186726617245
7 -1.267325326886

8 -0.018577859559

9 -4.004133098035

10 -2.641171550562

11 -1.648411969258

12 -0.693300167767

13 7.541955916146

14 5.081187983710

15 3.484083057814

16 2.501246773562

17 1.986457359315

18 1.815565838327

19 1.796548023217

20 1.796321934996

21 1.796321903259

22 1.796321903259

p1 =

1.796321903259442

IV)

>> p0=0.1, toler=10^(-8), N=100

p0 =

0.100000000000000

toler =

1.000000000000000e-008

N =
100

>> [p1]= newton('fnew3','dfnew3',p0,toler,N)

1 -4.125773195876

2 -2.725558722778

3 -1.714485370549

4 -0.777568042065

5 3.759658323459

6 2.663579913710

7 2.060462960752

8 1.831498363504

9 1.797067258182

10 1.796322247938

11 1.796321903260

12 1.796321903259

p1 =

1.796321903259442
EJERCICIO 4

clc
clear
x=[-2*pi:0.01:2*pi];
y=cos(x);
plot(x,y,'r','linewidth',2)
grid on
axis([-2*pi 2*pi -1.2 1.2])

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1

-6 -4 -2 0 2 4 6

function y=fnew4(x)
y=cos(x);
end

function y=dfnew4(x)
y=-sin(x);
end
a)

>> p0=3, toler=10^(-6), N=50

p0 =

toler =

1.000000000000000e-006

N =

50

>> [p1]= newton('fnew4','dfnew4',p0,toler,N)

1 -4.015252551435

2 -4.852657566279

3 -4.711461741169

4 -4.712388980650

5 -4.712388980385

p1 =

-4.712388980384690

La sucesin obtenida converge a alfa? Justifique su


respuesta.

La sucesin no converge hacia el alfa establecido que es


(3*pi)/2, ya que el valor obtenido en estas iteraciones es
distinto al dado.

b)

>> p0=5, toler=10^(-6), N=50

p0 =

5
toler =

1.000000000000000e-006

N =

50

>> [p1]= newton('fnew4','dfnew4',p0,toler,N)

1 4.704187084467

2 4.712389164306

3 4.712388980385

p1 =

4.712388980384690

La sucesin obtenida converge a alfa? Justifique su


respuesta.

La sucesin si converge hacia el alfa indicado, ya que al


aplicar el mtodo de newton y al obtener las iteraciones
correspondientes, hemos llegado a la respuesta que es igual o
cercana al alfa establecido por el ejercicio.

c)

Cul de los dos puntos p0 anteriormente dados escogera


usted como punto inicial para aplicar el mtodo de Newton con
el fin de hallar la raz alfa=(3*pi)/2? Por qu?

Tomamos el p0=5 para que la raz dada se pueda obtener, es


decir (3*pi)/2, y porque vemos que las iteraciones se
aproximaran a este valor, y se da la convergencia.
EJERCICIO 5

a) Ubique los ceros de la funcin:

clc
clear
x=[-5:0.01:5];
y=x.*exp(-x);
plot(x,y,'k','linewidth',2)
grid on

function y=fnew5(x)
y=x.*exp(-x);
end

function y=dfnew5(x)
y=exp(-x)-x.*exp(-x);
end
b) Aplique el mtodo de Newton Raphson usando el
programa de MATLAB, analizando la convergencia:
I)

>> p0=0.2, toler=10^(-5), N=100

p0 =

0.200000000000000

toler =

9.999999999999999e-06

N =

100

>> [p1]= newton('fnew5','dfnew5',p0,toler,N)

1 -0.050000000000

2 -0.002380952381

3 -0.000005655469

4 -0.000000000032

p1 =

-3.198414689582009e-11

II)

>> p0=2, toler=10^(-5), N=100

p0 =

toler =

9.999999999999999e-06
N =

100

>> [p1]= newton('fnew5','dfnew5',p0,toler,N)

1 4.000000000000

2 5.333333333333

3 6.564102564103

4 7.743826066407

5 8.892109843324

6 10.018818672756

7 11.129697939353

8 12.228417566136

9 13.317477310673

10 14.398662765680

11 15.473297079379

12 16.542389836511

13 17.606730006235

14 18.666946556972

15 19.723549433806

16 20.776958110592

17 21.827522003907

18 22.875535396946

19 23.921248563818

20 24.964876204660

21 26.006603939511

22 27.046593375998
23 28.084986112644

24 29.121906936448

25 30.157466402677

26 31.191762935379

27 32.224884552097

28 33.256910291002

29 34.287911400252

30 35.317952335773

31 36.347091603472

32 37.375382474224

33 38.402873594096

34 39.429609507782

35 40.455631109687

36 41.480976034401

37 42.505678996087

38 43.529772084652

39 44.553285025140

40 45.576245405727

41 46.598678878778

42 47.620609338708

43 48.642059079803

44 49.663048936650

45 50.683598409440

46 51.703725776056

47 52.723448192598
48 53.742781783744

49 54.761741724160

50 55.780342312012

51 56.798597035473

52 57.816518633024

53 58.834119148227

54 59.851409979569

55 60.868401925902

56 61.885105227942

57 62.901529606224

58 63.917684295880

59 64.933578078545

60 65.949219311682

61 66.964615955561

62 67.979775598129

63 68.994705477948

64 70.009412505400

65 71.023903282291

66 72.038184120021

67 73.052261056423

68 74.066139871402

69 75.079826101463

70 76.093325053238

71 77.106641816070

72 78.119781273759
73 79.132748115515

74 80.145546846189

75 81.158181795846

76 82.170657128714

77 83.182976851572

78 84.195144821611

79 85.207164753809

80 86.219040227861

81 87.230774694681

82 88.242371482528

83 89.253833802763

84 90.265164755277

85 91.276367333603

86 92.287444429742

87 93.298398838711

88 94.309233262846

89 95.319950315864

90 96.330552526708

91 97.341042343178

92 98.351422135380

93 99.361694198982

94 100.371860758314

95 101.381923969291

96 102.391885922205

97 103.401748644363
98 104.411514102603

99 105.421184205673

100 106.430760806509

p1 =

1.064307608065090e+02

Cunto vale el lmite cuando n tiende al infinito de x sub


n?

El lmite vale infinito, al obtener esta respuesta nos damos


cuenta que no hay convergencia en la sucesin es decir
divergente, adems tambin notamos que los nmeros aumentan
en cada iteracin.

III)

>> p0=20, toler=10^(-5), N=100

p0 =

20

toler =

9.999999999999999e-06

N =

100

>> [p1]= newton('fnew5','dfnew5',p0,toler,N)

1 21.052631578947

2 22.102500345352

3 23.149888094843

4 24.195035049794
5 25.238147724462

6 26.279405002508

7 27.318962895580

8 28.356958313711

9 29.393512085096

10 30.428731398473

11 31.462711796285

12 32.495538814663

13 33.527289343076

14 34.558032759456

15 35.587831884070

16 36.616743785902

17 37.644820468206

18 38.672109454405

19 39.698654291274

20 40.724494983110

21 41.749668367955

22 42.774208444968

23 43.798146660370

24 44.821512158132

25 45.844332000505

26 46.866631362663

27 47.888433705026

28 48.909760926282

29 49.930633499651
30 50.951070594544

31 51.971090185477

32 52.990709149803

33 54.009943355613

34 55.028807740985

35 56.047316385573

36 57.065482575420

37 58.083318861742

38 59.100837114358

39 60.118048570331

40 61.134963878332

41 62.151593139174

42 63.167945942897

43 64.184031402773

44 65.199858186499

45 66.215434544894

46 67.230768338297

47 68.245867060916

48 69.260737863297

49 70.275387573091

50 71.289822714272

51 72.304049524945

52 73.318073973860

53 74.331901775751

54 75.345538405591
55 76.358989111867

56 77.372258928935

57 78.385352688555

58 79.398275030642

59 80.411030413329

60 81.423623122362

61 82.436057279904

62 83.448336852779

63 84.460465660201

64 85.472447381033

65 86.484285560593

66 87.495983617066

67 88.507544847520

68 89.518972433584

69 90.530269446784

70 91.541438853580

71 92.552483520118

72 93.563406216713

73 94.574209622085

74 95.584896327364

75 96.595468839878

76 97.605929586733

77 98.616280918212

78 99.626525110990

79 100.636664371183
80 101.646700837240

81 102.656636582691

82 103.666473618753

83 104.676213896808

84 105.685859310760

85 106.695411699273

86 107.704872847907

87 108.714244491144

88 109.723528314326

89 110.732725955494

90 111.741839007150

91 112.750869017930

92 113.759817494204

93 114.768685901605

94 115.777475666487

95 116.786188177319

96 117.794824786017

97 118.803386809222

98 119.811875529513

99 120.820292196581

100 121.828638028340

p1 =

1.218286380283401e+02
Cunto vale el lmite cuando n tiende al infinito de x sub
n?

El lmite vale infinito, entonces no esta sucesin es


divergente, y una muestra de ello es que las iteraciones
aumentan cada vez ms.

También podría gustarte