Metodo Punto Fijo Emperatriz

Post on 04-Dec-2015

216 views 2 download

description

Método del punto fijo en Métodos numéricos

Transcript of Metodo Punto Fijo Emperatriz

%METODO PUNTO FIJO%ALUMNA: EMPERATRIZ PRIMO FABIAN %CURSO: MÉTODOS NUMÉRICOS Y PROGRAMACION%EJERCICIO: N° 01x=-5:0.05:3;f=(cos(2*x)+exp(-x)-4*x.^2-x+9);plot(x,f,'r')grid onxlabel('ABSISAS')ylabel('COORDENADAS')title('GRAFICA DE PUNTO FIJO')legend('f=(cos(2*x)+exp(-x)-4*x.^2-x+9')gtext('f=(cos(2*x)+exp(-x)-4*x.^2-x+9)')gtext('RAIZ1')gtext('RAIZ2')gtext('RAIZ3')

HALLAR LA SOLUCION DE:

f ( x )=cos (2∗x )+e−x−4∗x2−x+9 x∈ [−5 ;3 ]i. GRAFICANDO

ii. Construyendo las funciones g(x)

-5 -4 -3 -2 -1 0 1 2 3-30

-20

-10

0

10

20

30

40

50

60

70

ABSISAS

CO

OR

DE

NA

DA

S

GRAFICA DE PUNTO FIJO

f=(cos(2*x)+exp(-x)-4*x.2-x+9)

RAIZ1 RAIZ2 RAIZ3

f=(cos(2*x)+exp(-x)-4*x.2-x+9

a) f(x)=0

cos (2∗x )+e−x−4∗x2−x+9 =0x=(cos (2∗x )+e− x−4∗x2+9 )x=g( x ); g( x )=(cos (2∗x )+e−x−4∗x2+9 )

b) f(x)=0

cos (2∗x )+e−x−4∗x2−x+9=0e− x=−cos (2∗x )+4∗x2+x−9ln e− x=ln [−cos (2∗x )+4∗x2+x−9 ]x=−ln [−cos (2∗x )+4∗x2+x−9 ]x=g( x ) ; g( x )=−ln [−cos (2∗x )+4∗x2+x−9 ]

c) f(x)=0

cos (2∗x )+e−x−4∗x2−x+9=04∗x2+x=cos (2∗x )+e−x+9x (4∗x+1 )= cos (2∗x )+e−x+9

x=[cos (2∗x )+e− x+9(4∗x+1 ) ]

x=g( x ) ; g( x )=[cos (2∗x )+e−x+9(4∗x+1 ) ]

d) f(x)=0

cos (2∗x )+e−x−4∗x2−x+9=04∗x2= cos (2∗x )+e−x−x+9

x=+√cos (2∗x )+e−x−x+94

x=−√cos (2∗x )+e−x−x+94

x1=g( x );g ( x )=+√cos (2∗x )+e−x−x+94

x1=g( x );g ( x )=−√cos (2∗x )+e−x−x+94

e) f(x)=0

cos (2∗x )+e−x−4∗x2−x+9=0cos (2∗x )=−e− x+4∗x2+x−9

x=arccos(−e−x+4∗x2+x−92 )x=g( x ) ; g( x )=arccos(−e− x+4∗x2+x−92 )

iii. Analizando convergencia de HANS – BANASHCONVERGENCIA DE HANS – BANASH

%CONVERGENCIA DE HANS - BANASHg1=cos(2*x)+epx(-x)-(4*(x.^2))+9;g1=-log((-cos(2*x))+(4*(x.^2))+x-9);g1=((cos(2*x)+exp(-x)+9)./(4*x+1));g1=(-sqrt((cos(2*x)+exp(-x)-x+9)/4));g1=(sqrt((cos(2*x)+exp(-x)-x+9)/4));g1=acos(((-epx(-x))+4*(x.^2)+x-9)/2); %ANALIZANDO g(X)syms xa=1.5;g1=cos(2*x)+exp(-x)-(4*(x.^2))+9;g11=eval(subs(diff(g1,1),a))g11 = -12.5054……..> 1 (no)

g1=-log((-cos(2*x))+(4*(x.^2))+x-9);g12=eval(subs(diff(g1,1),a))g12 = -5.3342……..> 1 (no)

g1=((cos(2*x)+exp(-x)+9)./(4*x+1));g13=eval(subs(diff(g1,1),a))g13 = -0.7443……..< 1 (si)

g1=(-sqrt((cos(2*x)+exp(-x)-x+9)/4));g14=eval(subs(diff(g1,1),a))

g14 = 0.1450……..< 1 (si)

g1=(sqrt((cos(2*x)+exp(-x)-x+9)/4));g15=eval(subs(diff(g1,1),a))g15 = -0.1450……..< 1 (si) g1=acos(((-exp(-x))+4*(x.^2)+x-9)/2);

g16=eval(subs(diff(g1,1),a))g16 = -8.5901……..> 1 (no)

iv) Iteraciones Luego “g”converge en x0=3/2

n=0 iteraciones xn+1=g (xn )

x1=[cos (2∗x0)+e−x 0+9

(4∗x0+1 ) ]x1=[cos (2∗1.5 )+e−1.5+9

(4∗1 .5+1 ) ]x1=1 .1762n=1

x2=[cos (2∗x1)+e−x1+9

(4∗x1+1 ) ]x2=[cos (2∗1.1762 )+e−1.1762+9

(4∗1 .1762+1 ) ]x2=1.5082

n=2

x3=[cos (2∗x2)+e−x 2+9

(4∗x2+1 ) ]x3=[cos (2∗1.5082 )+e−1.5082+9

(4∗1 .5082+1 ) ]x3=1.1701puntofijo Ingrese la función del punto fijo g(x)=((cos(2*x)+exp(-x)+9)./(4*x+1)) ingrese el valor inicial xo= 1.5

it aprox g(x) error1 1.500000 1.176163 0.2753342 1.176163 1.508260 0.2201863 1.508260 1.170064 0.2890414 1.170064 1.516603 0.2284975 1.516603 1.164003 0.3029206 1.164003 1.524986 0.2367127 1.524986 1.158012 0.3169008 1.158012 1.533362 0.2447899 1.533362 1.152123 0.33090210 1.152123 1.541685 0.25268611 1.541685 1.146367 0.34484512 1.146367 1.549906 0.260364

13 1.549906 1.140773 0.35864514 1.140773 1.557976 0.26778515 1.557976 1.135370 0.37221916 1.135370 1.565850 0.27491817 1.565850 1.130181 0.38548618 1.130181 1.573484 0.281733La raíz es :1.573483832

%ANALIZANDO g(X)syms xa=-5/2;g1=cos(2*x)+exp(-x)-(4*(x.^2))+9;g11=eval(subs(diff(g1,1),a))g11 = 5.8997…… > 1 (NO)

g1=-log((-cos(2*x))+(4*(x.^2))+x-9);g12=eval(subs(diff(g1,1),a)) g12 = 1.2925…… > 1 (NO)

g1=((cos(2*x)+exp(-x)+9)./(4*x+1));g13=eval(subs(diff(g1,1),a)) g13 = 0.5066……..< 1 (SI)

g1=(-sqrt((cos(2*x)+exp(-x)-x+9)/4));g14=eval(subs(diff(g1,1),a)) g14 = 0.7711……..< 1 (SI)

g1=(sqrt((cos(2*x)+exp(-x)-x+9)/4));g15=eval(subs(diff(g1,1),a)) g15 = -0.7711……..< 1 (SI)

g1=acos(((-exp(-x))+4*(x.^2)+x-9)/2);g16=eval(subs(diff(g1,1),a))g16 = 4.5308…… > 1 (NO)

iv) Iteraciones Luego “g”converge en x0=-5/2

n=0 iteraciones xn+1=g (xn )

x1=−√cos (2∗x1 )+e− x1−x1+9

4

x1=−√cos (2∗−2 .5 )+e2.5+2 .5+94

x1=−2.4478n=1

x2=−√cos (2∗x1 )+e− x1−x1+9

4

x2=−√cos (2∗−2 .4478 )+e2 .4478+2 .4478+94

x2=2.4079n=2

x3=−√cos (2∗x2)+e− x2−x2+9

4

x3=−√cos (2∗−2.4079 )+e2 .4079+2 .4079+94

x3=−2.3781

puntofijo Ingrese la función del punto fijo g(x)=(-sqrt((cos(2*x)+exp(-x)-x+9)/4)) ingrese el valor inicial xo= -5/2

it aprox g(x) error 1 -2.500000 -2.447762 0.021341 2 -2.447762 -2.407920 0.016546 3 -2.407920 -2.378130 0.012527 4 -2.378130 -2.356200 0.009308 5 -2.356200 -2.340245 0.006817 6 -2.340245 -2.328741 0.004940 7 -2.328741 -2.320499 0.003552 8 -2.320499 -2.314623 0.002539 9 -2.314623 -2.310448 0.001807 10 -2.310448 -2.307489 0.001282 11 -2.307489 -2.305396 0.000908 12 -2.305396 -2.303916 0.000642 13 -2.303916 -2.302871 0.000454 14 -2.302871 -2.302134 0.000320 15 -2.302134 -2.301615 0.000226 16 -2.301615 -2.301248 0.000159 17 -2.301248 -2.300990 0.000112 18 -2.300990 -2.300808 0.000079La raíz es :-2.300807674

%ANALIZANDO g(X)

syms xa=-7/2;g1=cos(2*x)+exp(-x)-(4*(x.^2))+9;g11=eval(subs(diff(g1,1),a))g11 = -3.8015…… > 1 (NO)

g1=-log((-cos(2*x))+(4*(x.^2))+x-9);g12=eval(subs(diff(g1,1),a)) g12 = 0.7921……..< 1 (SI)

g1=((cos(2*x)+exp(-x)+9)./(4*x+1));g13=eval(subs(diff(g1,1),a)) g13 = 1.4316…… > 1 (NO)

g1=(-sqrt((cos(2*x)+exp(-x)-x+9)/4));g14=eval(subs(diff(g1,1),a)) g14 = 1.2043…… > 1 (NO)

g1=(sqrt((cos(2*x)+exp(-x)-x+9)/4));g15=eval(subs(diff(g1,1),a)) g15 = -1.2043…… > 1 (NO)

g1=acos(((-exp(-x))+4*(x.^2)+x-9)/2);g16=eval(subs(diff(g1,1),a))g16 =

0.0 .2398i…… > 1 (NO)

iv) Iteraciones Luego “g”converge en x0=7/2

n=0 iteraciones xn+1=g (xn )x1=−ln [−cos (2∗x0)+4∗x02+ x0−9]x1=−ln [−cos (2∗−3 .5 )+4∗−3 .52−3.5−9 ]x 1=−3 .5764n=1 x 2=−ln [−cos (2∗x1)+4∗x12+x 1−9 ]x 2=−ln [−cos (2∗−3 .5764 )+4∗−3 .57642−3.5764−9 ]x2=−3.6360n=2

x3=−ln [−cos (2∗x2)+4∗x22+x2−9 ]x3=−ln [−cos (2∗−3 .6360 )+4∗−3 .63602−3 .6360−9 ]x3=−3 .6813puntofijo Ingrese la función del punto fijo g(x)=-log((-cos(2*x))+(4*(x.^2))+x-9) ingrese el valor inicial xo= -7/2

it aprox g(x) error 1 -3.500000 -3.576441 0.021374 2 -3.576441 -3.636065 0.016398 3 -3.636065 -3.681307 0.012290 4 -3.681307 -3.714911 0.009046 5 -3.714911 -3.739472 0.006568 6 -3.739472 -3.757212 0.004721 7 -3.757212 -3.769913 0.003369 8 -3.769913 -3.778950 0.002391 9 -3.778950 -3.785351 0.001691 10 -3.785351 -3.789870 0.001193 11 -3.789870 -3.793054 0.000839 12 -3.793054 -3.795294 0.000590 13 -3.795294 -3.796867 0.000414 14 -3.796867 -3.797972 0.000291 15 -3.797972 -3.798747 0.000204 16 -3.798747 -3.799291 0.000143 17 -3.799291 -3.799672 0.000100 18 -3.799672 -3.799939 0.000070La raíz es :-3.799938890

%METODO PUNTO FIJO%ALUMNA: EMPERATRIZ PRIMO FABIAN %CURSO: MÉTODOS NUMÉRICOS Y PROGRAMACION%EJERCICIO: N° 02x=-2:0.05:5;f=((x.^2-3*x+4*sin(x)).*(x+4)-5);plot(x,f,'r')grid onxlabel('ABSISAS')ylabel('COORDENADAS')title('GRAFICA DE PUNTO FIJO')legend('=((x.^2-3*x+4*sin(x)).*(x+4)-5)')gtext('f==((x.^2-3*x+4*sin(x)).*(x+4)-5)')gtext('RAIZ1')gtext('RAIZ2')gtext('RAIZ3')gtext('RAIZ3')

HALLAR LA SOLUCION DE:

f ( x )=(x2−3∗x+4*sin( x ))∗( x+4 )−5 x∈ [−2 ;5 ]i. GRAFICANDO

ii. Construyendo las funciones g(x)a) f(x)=0

(x2−3∗x+4*sin( x ))∗( x+4 )=5

(x2−3∗x+4*sin( x ))=5( x+4 )

x=−13 (5( x+4 ) −x2−4*sin( x ))

b) f(x)=0

(x2−3∗x+4*sin( x ))∗( x+4 )=5

(x2−3∗x+4*sin( x ))=5( x+4 )

sin( x )=14 (5( x+4 )

−x2+3∗x)x=arcsen1

4 (5( x+4 )−x2+3∗x)

-2 -1 0 1 2 3 4 5-10

0

10

20

30

40

50

60

ABSISAS

CO

OR

DE

NA

DA

S

GRAFICA DE PUNTO FIJO

f==((x.2-3*x+4*sin(x)).*(x+4)-5)

RAIZ1 RAIZ2 RAIZ3 RAIZ4

=((x.2-3*x+4*sin(x)).*(x+4)-5)

c) f(x)=0

(x2−3∗x+4*sin( x ))∗( x+4 )=5

x2=5( x+4 )

−4 *sin( x )+3∗x

x=+√5( x+4 )−4*sin( x )+3∗x

x=−√5( x+4 )−4*sin( x )+3∗x

d) f(x)=0

(x2−3∗x+4*sin( x ))∗( x+4 )=5

x=5(x2−3∗x+4*sin( x ))

−4

x=g( x ); g( x )=5(x2−3∗x+4 *sin( x ))

−4

e) f(x)=0

(x2−3∗x+4*sin( x ))∗( x+4 )−5=0

x2−3x=5( x+4 )

−4 senx

x ( x−3 )=5( x+4 )

−4 senx

g( x )=x .

g( x )=(5( x+5 )

−4 senx )∗1( x−3 )

x=-2:0.05:5;f=(x.^2-3*x+4*sin(x)).*(x+4)-5;plot(x,f,'m')grid on

%Analizando Convergenciasyms xg=(((x.^2+4*sin(x))-5/(x+4))./3);subs(diff(g,1),-3/2)g=-0.6390 syms xg=(((x.^2+4*sin(x))-5/(x+4))./3);subs(diff(g,1),1/2)g=1.5857 syms x

g=(((x.^2+4*sin(x))-5/(x+4))./3);subs(diff(g,1),5/2)g=0.6379 syms xg=(((x.^2+4*sin(x))-5/(x+4))./3);subs(diff(g,1),7/2)= 1.1144 %Valor Numerico syms xg=(((x.^2+4*sin(x))-5/(x+4))./3);subs(g,2)= 2.2680 syms xg=(((x.^2+4*sin(x))-5/(x+4))./3);subs(g,3)g=2.9501 %Iteraciones syms x g=(((x.^2+4*sin(x))-5/(x+4))./3) subs(g,5/2) g=2.6249 syms x g=(((x.^2+4*sin(x))-5/(x+4))./3) subs(g,2.6249) g=2.7038 syms x g=(((x.^2+4*sin(x))-5/(x+4))./3) subs(g, 2.7038) g=2.7535

puntofijo Ingrese la función del punto fijo g(x)=(((x.^2+4*sin(x))-5/(x+4))./3) ingrese el valor inicial xo= 5/2 it aprox g(x) error 1 2.500000 2.624886 0.047578 2 2.624886 2.703791 0.029183 3 2.703791 2.753479 0.018045 4 2.753479 2.785020 0.011325 5 2.785020 2.805226 0.007203 6 2.805226 2.818267 0.004627 7 2.818267 2.826730 0.002994 8 2.826730 2.832244 0.001947 9 2.832244 2.835845 0.001270 10 2.835845 2.838201 0.000830 11 2.838201 2.839744 0.000543 12 2.839744 2.840756 0.000356 13 2.840756 2.841420 0.000234 14 2.841420 2.841855 0.000153 15 2.841855 2.842141 0.000101 16 2.842141 2.842328 0.000066 17 2.842328 2.842451 0.000043 18 2.842451 2.842532 0.000028La raíz es :2.842532141