Sie sind auf Seite 1von 23

UNIVERSIDAD PERUANA UNION

FACULTAD DE INGENERIA Y ARQUITECTURA


E.A.P. INGENERIA CIVIL

QUINTO CICLO-SEMESTRE -2015-1


CURSO:
MEODOS NUMERICOS
INFORME:
TRABAJOS - INTEGRALES
PRESENTADO POR:
Rene Paricahua Snchez
DOCENTES:
TEORIA: Lic. Braulio Guitierrez Pari
PRACTICAS: Lic. Braulio Guitierrez Pari

Juliaca de julio de 2015

EPERMENTE LAS SIGUIENTES INTEGRALES


1. Calcular
5

4x

1 x dx
1

function S=simpson(a,b,n)
S1=0;
S2=0;
h=(b-a)/n;
for k=1:2:n-1
S1=S1+f(a+k*h);
End
for k=2:2:n-2
S2=S2+f(a+k*h);
End
S=(h/3)*((f(a)+f(b))+4*S1+2*S2);
function y=f(x)
y=4*x/(1+x);

2. Completar la siguiente tabla para n=10 (use format short)


f(x)

Valor exacto
Trapecio
Simpson

2 x

(1 e )dx

3.5001677
3.4738
3.4991

ln xdx

0.38629
0.3859
0.3863

0.66666667
0.6605
0.6641

La regla de simpson se acerca mas al valor real por ende seria la mejor regla.
Primer valor en la tabla

x dx

Segundo valor en la tabla

Tercer valor en la tabla

3. Calcule numricamente la integral de la figura adjunta empleando la regla del trapecio y


la regla de Simpson.
(1,0.5) (2,1.5) (3,1)

Con ambas reglas salen igual

4. En el recinto de la figura adjunta esta limitada por una recta y una curva de la que se
conoce que se trata de una poligonal de cuarto grado.
>> x=[-2 -1 0 1 2];
>> y=[0 2 3 2 0];
>> [yi,pol]=lagrange(x,y,2)
yi =
0
pol =
0+0*(x--1)/(-2--1)*(x-0)/(-2-0)*(x-1)/(-2-1)*(x-2)/(-2-2)+2*(x--2)/(-1-2)*(x-0)/(-1-0)*(x-1)/(-1-1)*(x-2)/(-1-2)+3*(x--2)/(0--2)*(x--1)/(0-1)*(x-1)/(0-1)*(x-2)/(0-2)+2*(x--2)/(1--2)*(x--1)/(1--1)*(x-0)/(1-0)*(x2)/(1-2)+0*(x--2)/(2--2)*(x--1)/(2--1)*(x-0)/(2-0)*(x-1)/(2-1)

PARTE DOS DEL TRABAJO


1. Vamos a resolver numricamente el problema

function [t,y]=EULER(t0,y0,T,p)
h=T/p;
t=zeros(p+1,1);
y=zeros(p+1,1);
t(1)=t0;
y(1)=y0;
for k=2:1:p+1
t(k)=t(k-1)+h;
y(k)=y(k-1)+h*f(t(k-1),y(k-1));
end
t0 = 2, y0 = 1, T = 1 y p = 10 (lo ltimo indica que el intervalo [2, 3] ser
dividido en 10 subintervalos). As, el tamao de paso ser h = T/p =
1/10 = 0,1. El cdigo asociado a la funcin f.m est dado por:
function z=f(t,y)
z=((-t*y^2-t^3+10)/(t^2+1));

2. Resolver numricamente usando el mtodo de Heun, el siguiente problema PVI dado


por:
function [t,y]=HEUN(t0,y0,T,p)
h=T/p;

t=zeros(p+1,1);
y=zeros(p+1,1);
t(1)=t0;
y(1)=y0;
for k=2:1:p+1
t(k)=t(k-1)+h;
y(k)=y(k-1)+(h/2)*(f(t(k-1),y(k-1))+f(t(k-1)+h,y(k-1)+h*f(t(k-1),y(k-1))));
end
t0 = 1, y0 = 1, T = 3 y p = 10 (lo ltimo indica que el intervalo [1, 4] ser
dividido en 10 subintervalos). El tamao de paso ser h = T/p = 3/10 = 0,3. El
cdigo asociado a la funcin f.m est dado por:
function z=f(t,y)
z=t*cos(t)+y/t+t;

3. Considere el siguiente sistema

function [t,y]=EULERS(t0,y0,T,p)
h=T/p;
t=zeros(p+1,1);
y=zeros(p+1,2);
t(1)=t0;
y(1,:)=y0;
for k=2:1:p+1
t(k)=t(k-1)+h;
y(k,:)=y(k-1,:)+h*f(t(k-1),y(k-1,:));
end
function z=f(t,y)
z=[t*y(1)+y(2)^2 , t-y(1)*y(2)];

UNIVERSIDAD PERUANA UNION

FACULTAD DE INGENERIA Y ARQUITECTURA


E.A.P. INGENERIA CIVIL

QUINTO CICLO-SEMESTRE -2015-1


CURSO:
MEODOS NUMERICOS
INFORME:
METODOS DEL TRAPECIO
PRESENTADO POR:
Rene Paricahua Snchez
DOCENTES:
TEORIA: Lic. Braulio Guitierrez Pari
PRACTICAS: Lic. Braulio Guitierrez Pari

Juliaca de julio de 2015

Ejercicio N1

function r=Rieman(a,b,n)
h=(b-a)/n;
r=0;
for k=1:n
r=r+f(a+k*h);
end
r=h*r;
function y=f(x)
y=x^2;
>> r=Rieman(-1,2,10000)
r = 3.0005

function y=f(x)
y=exp(-x^2);
>> r=Rieman(0,2,10000)

r = 0.8820

Ejemplo 0.2
function S=simpson(a,b,n)
S1=0;
S2=0;
h=(b-a)/n;
for k=1:2:n-1
S1=S1+f(a+k*h);
end
for k=2:2:n-2
S2=S2+f(a+k*h);
end
S=(h/3)*((f(a)+f(b))+4*S1+2*S2);
function y=f(x)
y = exp(-x^2);
end
>> S=simpsion(0,2,100)
S = 0.882
Ejercicio 0.1 (TRAPECIO)

n=10000
1)
function y=f(x)
y=x^4;
end
r=Rieman(0.5,1,10000)
r = 0.1938
2)
function y=f(x)
y=2/(x-4);
end
>> r=Rieman(0,0.5,10000)
r = -0.2671
3)
function y=f(x)
y=(x^2)*log(x);
end
>> r=Rieman(1,1.5,10000)
r = 0.1923
4)
function y=f(x)
y=(x^2)*exp(-x);
end
>> r=Rieman(0,1,10000)
r = 0.1606
5)
function y=f(x)
y=(2*x)/(x^2-4);
end
>> r=Rieman(1,1.6,10000)
r = -0.7340

6)

function y=f(x)
y=2/(x^2-4);
end
>> r=Rieman(1,1.6,10000)
r = -0.5493
7)
function y=f(x)
y=x*sin(x);
end
>> r=Rieman(0,pi/4,10000)
r = 0.1518
8)
function y=f(x)
y=(exp(3*x))*sin(2*x);
end
>> r=Rieman(0,pi/4,10000)
r = 2.5890

Ejercicio 0.2 (SIMPSON)


n=100
1)
function y=fRPS(x)
y=x^4;
end
>>S=simpson(1/2,1,100)
S = 0.1938

2)

function y=fRPS(x)
y=2/(x-4);
end
>> S=simpson(0,1/2,100)
S = -0.2671
3)
function y=fRPS(x)
y=(x^2)*log(x);
end
>>S=simpson(1,3/2,100)
S = 0.1923
4)
function y=fRPS(x)
y=(x^2)*exp(-x);
end
>>S=simpson(0,1,100)
S = 0.1606
5)
function y=f(x)
y=(2*x)/(x^2-4);
end
>> S=simpson(1,1.6,100)
S = -0.7340
6)
function y=f(x)
y=2/(x^2-4);
end
S=simpson(1,1.6,100)
S = -0.5493

7)
function y=f(x)
y=x*sin(x);
end
>> S=simpson(0,pi/4,100)
S = 0.1517
8)
function y=f(x)
y=(exp(3*x))*sin(2*x);
end
>> S=simpson(0,pi/4,100)
S = 2.5886
2.
function r=Rieman(a,b,n)
h=(b-a)/n;
r=0;
for k=1:n
r=r+f(a+k*h);
end
r=h*r;

>> r=Rieman(0,0.8,10000)
r = 1.6405

UNIVERSIDAD PERUANA UNION


FACULTAD DE INGENERIA Y ARQUITECTURA
E.A.P. INGENERIA CIVIL

QUINTO CICLO-SEMESTRE -2015-1


CURSO:
MEODOS NUMERICOS
INFORME:
ECUACIONES NO LINEALES
PRESENTADO POR:
Rene Paricahua Snchez
DOCENTES:
TEORIA: Lic. Braulio Guitierrez Pari
PRACTICAS: Lic. Braulio Guitierrez Pari

Juliaca de julio de 2015

TRABAJO ENCARGADO DE SISTEMAS DE ECUACIONES NO LINIALES

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

x +2 y4=0

(x6)2 y +2=0
1
Al ejecutar newton, verifique con los siguientes puntos iniciales 2 ]

SOLUCION:
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];
EXPERIMENACION
>> [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

(x3)2 y + 4=0

9
3 ]
y

x+ 2 y +16=0

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

6
10 ]
y

SOLUCION:
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];
CORRIENDO
>> [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.3 Consideremos el siguiente sistema de ecuaciones no lineales de 3 incgnitas y 3
ecuaciones:

7 x1 x 2+5 x 2x 23 sen x 112=0


x 41 + cos2 x2 +2 x 338=0
6 x 1 +2 x2x 3 +34=0

SOLUCION:
function 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];
CORRIENDO
>> [x, iter] = NEWTON_NL([10 20 -50]', 0.0001)
x=
-4.2313
-1.5675
5.4768
iter =
13
Ejercicio 0.4 Se quiere resolver el sistema de ecuaciones no lineales

x 3+ y3 2 xy =0
2

x + y 1=0
1
Al ejecutar newton, verifique con los siguientes puntos iniciales 2 ] .

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)];
CORRIENDO
>> [x, iter] = NEWTON_NL([1 1]', 0.0001)
x=
0.9569
0.2903
iter =
4
EJERCICIO 0.5 Se requiere resolver un sistema de ecuaciones no lineales

5 x12 6 x1 x2 5 x22 4 x1 4 x2 4 0
x12 x22 1 0

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');
end
end
FN
function 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];

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

SOLUCION
>>[x,iter]=NEWTON_NL([1 1],0.0000001)
x=
0.9569
0.2903
Iter=
5
EJERCCION 0.6 Se require resolver el siguiente Sistema de ecuaciones no lineales

x 3 y 3 2 xy 0
x2 y 2 1 0

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');
end
end

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

JN
function 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.4498
0.8931
Iter=
6
EJERCICIO 6 Se requiere resolver un Sistema de ecuaciones no lineales

2x4 2x2 y y 2 2 y3 y 4 0
3x 2 2 xy 6 y 2 3 0

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');
end
end

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

JN
function 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

Das könnte Ihnen auch gefallen