Metodos Tareal Final de Mtodos Lab 05 y 06 Imprimir

16
Curso: métodos numéricos Ciclo: V Docente: Braulio Gutiérrez Pari

description

programacion

Transcript of Metodos Tareal Final de Mtodos Lab 05 y 06 Imprimir

Curso:

mtodos numricos

Ciclo: V

Docente:

Braulio Gutirrez Pari

Juliaca, junio 2014

Ejercicio N.1 Q=[-0.866 0 0.5 0 0 0;-0.5 0 -0.866 0 0 0; 8.66 1 0 1 0 0; 5 0 0 0 1 0;0 -1 -0.5 0 0 0;0 0 0.866 0 0 1]Q = -0.86600000000000 0 0.50000000000000 0 0 0 -0.50000000000000 0 -0.86600000000000 0 0 0 8.66000000000000 1.00000000000000 0 1.00000000 0 0 5.00000000000000 0 0 0 1.00000000000000 00 -1.00000000000000 -0.00 0 0 0 0 0 0.86600000000000 0 0 1.00000000000000>> E=[0;1000;0;0;0;0]E = 0 1000 0 0 0 0>> X=inv(W)*EX = 1.0e+003 * -0.50002200096804 F1 0.43301905283832 F2 -0.86603810567665 F3 3.89717147554492 H2 2.50011000484021 R2 0.74998899951598 R1

Ejercicio N. 2>> A=[55 30 15;25 45 30; 25 20 55]A = 55 30 15 25 45 30 25 20 55>> B=[4800;5800;5700]B = 4800 5800 5700

>> T=inv(A)*BT = 32.70000000000000 68.03333333333332 64.03333333333333ARENA (X)FINO (Y)GRUESA (Z)

553015

254530

252055

4800 m35800 m35700 m3

(55+25+25)X=4800X=45.7143(30+45+20)y=5800Y=61.0561(15+30+55)Z=5700Z=57CANTERA 1 55(45.7143)+30(61.0526)+15(57)=5200.87CANTERA 2 25(45.7143)+45(61.0526)+30(57)=5600.23CANTERA 3 25(45.7143)+20(61.0526)+55(57)=5498.91Ejercicio N.3>> E=[3 1 5;2 3 4; 4 5 2]E = 3 1 5 2 3 4 4 5 2>> C=[60;40;100]C = 60 40 100>> H=inv(E)*CH = 25.50000000000000 1.00000000000000 -3.50000000000000Ejercicio N.4>> A=[-0.866 -0.707 -0.707 0 0 0 0 0 ; -0.5 -0.707 -0.707 0 0 0 0 0 ; 0.5 0 0 0 0 0 1 0; 0.866 0 0 1 0 1 0 0;0 0.707 0 -1 1 0 0 0;0 0.707 0 0 0 0 0 0;0 0 0.707 0 -1 0 0 0;0 0 0.707 0 0 0 0 1]A = -0.8660 -0.7070 -0.7070 0 0 0 0 0 -0.5000 -0.7070 -0.7070 0 0 0 0 0 0.5000 0 0 0 0 0 1.0000 0 0.8660 0 0 1.0000 0 1.0000 0 0 0 0.7070 0 -1.0000 1.0000 0 0 0 0 0.7070 0 0 0 0 0 0 0 0 0.7070 0 -1.0000 0 0 0 0 0 0.7070 0 0 0 0 1.0000>> B=[1200;600;0;0;0;0;0;0]B = 1200 600 0 0 0 0 0>> x=inv(A)*Bx = 1.0e+003 * -1.6393 F1 0 F2 0.3107 F3 0.2197 F4 0.2197 F5 1.2000 H1 0.8197 V2 -0.2197 VEjercicio N.5>> M=[0.707 1 0 0 0 0 0 1 0 0;0.707 0 0 0 0 0 0 0 1 0;-0.707 0 0.707 1 0 0 0 0 0 0 ;0.707 0 0.707 0 0 0 0 0 0 0 ;0 -1 -0.707 0 0.5 1 0 0 0 0 ;0 0 0.707 0 0.866 0 0 0 0 0;0 0 0 -1 -0.5 0 0.866 0 0 0;0 0 0 0 -0.866 0 -0.5 0 0 0;0 0 0 0 0 -1 -0.866 0 0 0;0 0 0 0 0 0 0.5 0 0 1] M = 0.7070 1.0000 0 0 0 0 0 1.0000 0 0 0.7070 0 0 0 0 0 0 0 1.0000 0 -0.7070 0 0.7070 1.0000 0 0 0 0 0 0 0.7070 0 0.7070 0 0 0 0 0 0 0 0 -1.0000 -0.7070 0 0.5000 1.0000 0 0 0 0 0 0 0.7070 0 0.8660 0 0 0 0 0 0 0 0 -1.0000 -0.5000 0 0.8660 0 0 0 0 0 0 0 -0.8660 0 -0.5000 0 0 0 0 0 0 0 0 -1.0000 -0.8660 0 0 0 0 0 0 0 0 0 0.5000 0 0 1.0000>> E=[0; 0 ;0; 500; 0; 0; 0; 1000 ;0; 0]E = 0 0 0 500 0 0 0 1000 0 0>> X=inv(M)*EX = -25.3769 F1 17.9415 F2 732.5905 F3 -535.8829 F4 -598.0848 F5 834.9254 F6 -964.1171 F7 -0.0000 H1 17.9415 V2 482.0585 V5

Ejercicio N.6R=[0.5 0 0 0 0 0 0 1 0 0;0.866 0 0 0 0 0 1 0 0 0;-0.5 0.5 0 0 0 -0.866 0 0 0 0;-0.866 0.707 0 1 0 0.5 0 0 0 0;0 0.707 0 0 0 0 0 0 0 0;0 -0.707 0 0 0 0 0 0 0 0;0 0 1 0 -1 0 0 0 0 0;0 0 0 -1 0 0 0 0 0 0;0 0 0 0 1 0.866 0 0 1 0;0 0 0 0 0 0.5 0 0 0 1]R = 0.50000000000000 0 0 0 0 0 0 1.00000000000000 0 0 0.86600000000000 0 0 0 0 0 1.00000000000000 0 0 0 -0.50000000000000 0.50000000000000 0 0 0 -0.86600000000000 0 0 0 0 -0.86600000000000 0.70700000000000 0 1.00000000000000 0 0.50000000000000 0 0 0 0 0 0.70700000000000 0 0 0 0 0 0 0 0 0 -0.70700000000000 0 0 0 0 0 0 0 0 0 0 1.00000000000000 0 -1.00000000000000 0 0 0 0 0 0 0 0 -1.00000000000000 0 0 0 0 0 0 0 0 0 0 1.00000000000000 0.86600000000000 0 0 1.00000000000000 0 0 0 0 0 0 0.50000000000000 0 0 0 1.00000000000000>> C=[0;0;0;0;0;500;0;250;0;0]C = 0 0 0 0 0 500 0 250 0 0

Laboratorio N.6PROBLEMA 1. Se quiere resolver el sistema de ecuaciones no lineales

Al ejecutar newton, verifique con los siguientes puntos iniciales ] ]

SOLUCION:function [x,iter]=NEWTON_NL(x,prec)iter=0;while norm(Fn(x))>prec iter=iter+1; x=x-inv(Jn(x))*Fn(x); if iter>1000 error('parece que newton no converge'); endend

function z=Fn(x)z=[-x(1)+2*x(2)-4 (x(1)-6)^2-x(2)+2];

function z=Jn(x)z=[-1 2 2*(x(1)-6) -1];

RESPUESTA

>> [x, iter] = NEWTON_NL([1 2]', 0.0001)

x = 4.5000 4.2500

iter = 5

>> [x, iter] = NEWTON_NL([9 3]', 0.0001)

x = 8.0000 6.0000

iter = 3

PROBLEMA 2. Se quiere resolver el sistema de ecuaciones no lineales

Al ejecutar newton, verifique con los siguientes puntos iniciales ] ]

SOLUCION:

function [x,iter]=NEWTON_NL(x,prec)iter=0;while norm(Fn(x))>prec iter=iter+1; x=x-inv(Jn(x))*Fn(x); if iter>1000 error('parece que newton no converge'); endendfunction z=Fn(x)z=[(x(1)-3)^2-x(2)+4 x(1)+2*x(2)-16];

function z=Jn(x)z=[2*(x(1)-3) -1 1 2];RESPUESTA

>> [x, iter] = NEWTON_NL([1 2]', 0.0001)

x =1.1492 7.4254

iter = 2

>> [x, iter] = NEWTON_NL([6 10]', 0.0001)

x = 4.3508 5.8246

iter = 4

Ejercicio 0.5 Consideremos el siguiente sistema de ecuaciones no lineales de 3 incgnitas y 3 ecuaciones:

SOLUCION:

function [x,iter]=NEWTON_NL(x,prec)iter=0;while norm(Fn(x))>prec iter=iter+1; x=x-inv(Jn(x))*Fn(x); if iter>1000 error('parece que newton no converge'); endendfunction z=Fn(x)

z=[7*x(1)*x(2)+5*x(2)-x(3)^2*sin(x(1))-12 -x(1)^4+cos(x(2))^2+2*(x(3))^3-8 6*x(1)+2*x(2)-x(3)+34];

function z=Jn(x)

z=[7*x(2)-x(3)^2*cos(x(1)) 7*x(1)+5 -2*x(3)*sin(x(1)) -4*x(1)^3 -2*cos(x(2))*sin(x(2)) 6*x(3)^2 6 2 -1];

respuesta

>> [x, iter] = NEWTON_NL([10 20 -50]', 0.0001)

x =-4.2313 -1.5675 5.4768

iter = 13

Ejercicio 0.6 Se quiere resolver el sistema de ecuaciones no lineales

Al ejecutar newton, verifique con los siguientes puntos iniciales ] .

SOLUCION:

function z=Fn(x)z=[5*x(1)^2+6*x(1)*x(2)+5*x(2)^2-4*x(1)+4*x(2)-4 x(1)^2+x(2)^2-1];

function z=Jn(x)z=[10*x(1)+6*x(2)-4 6*x(1)+10*x(2)+4 2*x(1) 2*x(2)];

RESPUESTA

>> [x, iter] = NEWTON_NL([1 1]', 0.0001)

x = 0.9569 0.2903

iter = 4

EJERCICIO 4 Se requiere resolver un sistema de ecuaciones no lineales

Al ejecutar newton con un punto inicial ] y con una precisin de 0.000001 Solucion function [x,iter]=NEWTON_NL(x,prec)iter=0;while norm(Fn(x))>prec iter=iter+1; x=x-inv(Jn(x))*Fn(x); if iter>1000 error('parece que newton no converge'); endend

FNfunction z=Fn(x)z=[5*x(1)^2+6*x(1)*x(2)+5*x(2)^2-4*(1)+4*x(2)-4 x(1)^2+x(2)^2-1];

JNfunction z=Jn(x)z=[10*X(1)+6*X(2)-4 6*x(1)+10*x(2)+4 2*x(1) 2*x(2)];

SOLUCION>>[x,iter]=NEWTON_NL([1 1],0.0000001)x=0.95690.2903Iter=5

EJERCCION 5 Se require resolver el siguiente Sistema de ecuaciones no lineales

Al ejecutar Newton, verifique con los siguientes puntos iniciales]

Solucion function [x,iter]=NEWTON_NL(x,prec)iter=0;while norm(Fn(x))>prec iter=iter+1; x=x-inv(Jn(x))*Fn(x); if iter>1000 error('parece que newton no converge'); endendFNfunction z=Fn(x)z=[x(1)^3+x(2)^3-2*x(1)*x(2) x(1)^2+x(2)^2-1];JNfunction z=Jn(x)z=[3*x(1)^2-2*x(2) 3*x(2)^2-2*x(1) 2*x(1) 2*x(2)];

SOLUCION>>[x,iter]=NEWTON_NL([1 2],0.0000001)x=0.44980.8931Iter=6EJERCICIO 6 Se requiere resolver un Sistema de ecuaciones no lineales

SOLUCION function [x,iter]=NEWTON_NL(x,prec)iter=0;while norm(Fn(x))>prec iter=iter+1; x=x-inv(Jn(x))*Fn(x); if iter>1000 error('parece que newton no converge'); endendFNfunction z=Fn(x)z=[ 2*x(1)^4-2*(x(1)^2)*x(2)+x(2)^2-2*x(2)^3+x(2)^4 3*x(1)^2-2*x(1)*x(2)-6*x(2)^2+3];JNfunction z=Jn(x)z=[8*x(1)^3-4*x(1)*x(2) -2*x(1)^2+2*x(2)-6*x(2)^2+4*x(2)^3 6*x(1)-2*x(1) -2*x(2)-12*x(2)];SOLUCION>>[x,iter]=NEWTON_NL([1 2],0.0000001)x=0.8920 0.8105 Iter=13