9
INGENIERÍA CIVIL METODOS NUMERICOS ________________________________________________________________ _____________ UNIVERSIDAD PERUANA UNION FACULTAD DE INGENIERIA Y ARQUITECTURA CARRERA PROFESIONAL DE INGENIERIA CIVIL CURSO: METODOS NUMERICOS DOCENTE: BRAULIO GUTIERREZ PARI ALUMNO: NILS REYNER ROCCA ARCOS CICLO: V –B Ejercicio 0.1 En algún lenguaje de su preferencia, implemente el método de Newton para sistema de ecuaciones no lineales Una Implementación Básica: 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'); end end Ejercicio 0.2 Se quiere resolver el sistema de ecuaciones no lineales 8

TAREA 6

Embed Size (px)

Citation preview

Page 1: TAREA 6

INGENIERÍA CIVILMETODOS NUMERICOS_____________________________________________________________________________UNIVERSIDAD PERUANA UNIONFACULTAD DE INGENIERIA Y ARQUITECTURACARRERA PROFESIONAL DE INGENIERIA CIVILCURSO: METODOS NUMERICOSDOCENTE: BRAULIO GUTIERREZ PARIALUMNO: NILS REYNER ROCCA ARCOSCICLO: V –B

Ejercicio 0.1

En algún lenguaje de su preferencia, implemente el método de Newton para sistema de ecuaciones no lineales

Una Implementación Básica:

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

Ejercicio 0.2

Se quiere resolver el sistema de ecuaciones no lineales

1. Hallar el sistema de ecuaciones y el Jacobiano

8

Page 2: TAREA 6

INGENIERÍA CIVILMETODOS NUMERICOS_____________________________________________________________________________Solución

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];

>> [x, iter] = newton_nl ([1 2]',0.000001)

x =

4.5000

4.2500

iter =

5

2. Ahora ejecutando NEWTON_NL, con otro punto inicial [9 3] tenemos:

>> [x, iter] = newton_nl([9 3]',0.000001)

x =

8.0000 6.0000

iter =

4

Page 3: TAREA 6

INGENIERÍA CIVILMETODOS NUMERICOS_____________________________________________________________________________Ejercicio 0.3

Haga sus respectivas gráficas del ejercicio anterior y comente, porqué el mismosistema de ecuaciones no lineales, para puntos distintos converge a dos raices distintas

Ejercicio 0.4

Page 4: TAREA 6

INGENIERÍA CIVILMETODOS NUMERICOS_____________________________________________________________________________Se quiere resolver el sistema de ecuaciones no lineales

Solución

function 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];

>> [x, iter] = newton_nl([1 2]',0.000001)

x =

-5.6085

10.8042

iter =

52

>> [x, iter] = newton_nl([6 10]',0.000001)

x =

-5.6085

10.8042

iter =

47

Ejercicio 0.5

Page 5: TAREA 6

INGENIERÍA CIVILMETODOS NUMERICOS_____________________________________________________________________________ Consideremos el siguiente sistema de ecuaciones no li-neales de 3 incógnitas y 3 ecuaciones:

Observe que

function z=fn(x)z=[7*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];

>> [x, iter] = newton_nl([10 20 -50]',0.000001)

x =

-10.3885 23.1629 17.9951

iter =

78

Ejercicio 0.5

Se quiere resolver el sistema de ecuaciones no lineales

Page 6: TAREA 6

INGENIERÍA CIVILMETODOS NUMERICOS_____________________________________________________________________________

Al ejecutar NEWTON_NL con punto inicial [1 1] y con una precisión de prec=0.000001

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) +10*x(2) -4 +4 2*x(1) +2*x(2)];

Ejercicio 0.6

Se quiere resolver el sistema de ecuaciones no lineales

Solucion :

function z=fn(x)z=[x(1)^3+x(2)^3-2*x(1)*x(2)

x(1)^2+x(2)^2-1];

function z=jn(x)z=[ 3*x(1) +3*x(2) -2*x(2)2*x(1) +8*x(2)];

Al ejecutar Newton, verifique con los siguientes puntos iniciales [1 2]

Ejercicio 0.7

Se quiere resolver el sistema de ecuaciones no lineales

Page 7: TAREA 6

INGENIERÍA CIVILMETODOS NUMERICOS_____________________________________________________________________________

Use el método de Newton, con el punto inicial [-1 -2 1]y con parámetro de precisión ε = 10−6

Ejercicio 0.8

Resolver el sistema de ecuaciones no lineales

pruebe con un punto inicial [0 0 0] y con parámetro de precisión ε = 10−6.y también anote su Jacobiano.