Sie sind auf Seite 1von 17

UNIVERSIDAD DE LAS FUERZAS

ARMADAS - ESPE
Diego Quispe
3 de enero de 2016

Sistema de Ecuaciones lineales y Ajuste de Curvas


Deber 3
Ejercicio 1: Calcular el n
umero de operaciones basicas (sumas, restas,
multiplicaciones y divisiones) en funcion de la dimension de n neseasarias para
resolver un sistema A0 u = B 0 ; donde A0 es una matriz triangular superior.
Soluci
on

2
0

    
1
x
1
. 1 =
3
x2
1
n=2
ops = 3
1
0,333
3
2x1 + x2 = 1

x2 =

2x1 + (0,333) = 1
2x1 = 1,333
x1 = 0,666

2
0
0

1
5
0


x1
3
1
2 . x2 = 2
x3
1
4
n = 3, ops = 5

x3 =

1
0,250
4

5x2 + 2x3 = 2
5x2 + 2(0,250) = 2
5x2 = 1,500
x2 = 0,300

2x1 + x2 + x3 = 3
2x1 = 2,450

x1 = 1,225

ops = 2(n 1) + 1
ops = 2n 1
Ejercicio 2: En el sistema siguiente, pruebe que Ax = B es equivalente al
sistema triangular superior U x = y que se da y hallar su solucion.

4x1 + 8x2 + 4x3 + 0x4 = 8

x1 + 5x2 + 4x3 3x4 = 4


x1 + 4x2 + 7x3 + 2x4 = 10

x1 + 3x2 + 0x3 2x4 = 4


Soluci
on
Pasamos a la forma Ax = B

4 8 4
1 5 4

1 4 7
1 3 0
Seg
un la teria quedara de esta

4 8
1 5

1 4
1 3


x1
0
8
x2 4
3
. =
2 x3 10
2
4
x4
forma
4
4
7
0

0
3
2
2

8
4

10
4

Empezamos las operaciones en filas de la matriz hasta obtener la matriz


triangular superior solicitada.

4 8
4
0
8
1 5
4 3
4

1 4
7
2
10
0 1 7 4
14
f4 f3 = f4

4
1

0
0

8
4
5
4
1
3
1 7

0
3
5
4

f3 f2 = f3

8
4

14
14


4
0

0
0

8
3
1
1

4
3
3
7

8
6

14
14

0
3
5
4

1
f2 f1 = f2
4

4 8
0 3

0 1
0 0

8
6

14
28

4
0
3
3
3
5
10 9
f4 f3 = f4

4
0

0
0

8
3
0
0

8
6

12
28

4
0
3
3
4
4
10 9
1
f3 f2 = f3
3

4
0

0
0

8
3
0
0

4
3
4
0

0
3
4
0,4

8
6

12
0,8

2
f4 + f3 = f4
5

4 8 4
0 3 3

0 0 4
0 0 0

0
3
4
1

8
6

12
2

5
= f4
2
Despues de obtener nuestra matriz triangular superior solicitada y procedemos a resolverla

x1 x2 x3 x4
B
4
8
4
0
8

3
3
3
6

0
0
4
4
12
0
0
0
1
2
f4

x4 = 2

4x3 + 4x4 = 12
4x3 = 12 4(2)
4x3 = 4
x3 = 1

3x2 = 3x : 3 3x4 = 6
3x2 + 3(2) 3(2) = 6
3x2 = 3
x3 = 1

4x1 + 8x2 + 4x3 + 0x4 = 8


4x1 + 8(1) + 4(1) = 8
4x1 = 8 + 8 4
x1 = 3

Ejercicio 3: Resolver con calculadora (a mano) el siguiente sistema de


ecuaciones, aplicando el metodo de eliminacion gaussiana .

x1 + 8x2 5x3 = 3
3x1 2x2 + 3x3 = 1

2x1 + 3x2 x3 = 4
Soluci
on

1
3
2


8 5
x1
3
2 3 . x2 = 1
3 1
x3
4

1 8 5 3
3 2 3 1
2 3 1 4

Empezamos a resolver la matriz, con operaciones entre filas

1
8
5 3
3 2
3
1
0 13 9 2

f 3 2f 1 = f 3

1
0
0

5
18
9

8
26
13

3
8
2

f 2 3f 1 = f 3

1
0
0

8
5
26 18
0
0

3
8
4

f 2 2f 3 = f 3
Como podemos ver la ultima fila se ha llenado con lavores de 0, esto nos
indica que el sistema propuesto no tiene solucion.

Ejercicio 4: Hallar la soulucion del siguiente sistema lineal, con calculadora


y a mano.

=5

x1 +x2

2x1 x2 +53
= 9
3x2 4x3 +2x4 = 19

2x3
+6x4 = 2
Pasamos a la forma Ax = B

1 1
2 1

0 3
0 0

0
5
4
2


x1
0
5

0
. x2 = 9
2 x3 19
6
x4
2

Seg
un la teria quedara de esta forma

1 1
0
2 1 5

0 3 4
0 0
2
Empezamos las operaciones en
triangular superior solicitada.

1 1
0 3

0 3
0 0

0
0
2
6

5
9

19
2

filas de la matriz hasta obtener la matriz


0
5
4
2

0
0
2
6

f 2 2f 1 = f 2
6

5
19

19
2


1
0

0
0

1
3
0
0

0 0
5 0
1 2
2 6

5
19

0
2

f3 + f2 = f3

1
0

0
0

1
3
0
0

0 0
5 0
1 2
0 2

5
19

0
2

f 4 2f 3 = f 4
Despues de obtener nuestra matriz triangular superior solicitada y procedemos a resolverla

x1 x2 x3 x4 1 1
0
0
5

0 3 5
0
19

0
0
1
2
0
0
0
0
2
2
x4 = 1

x3 + 2x4 = 0
x3 = 2(1)
x3 = 2

3x2 + 5x3 = 19
3x2 = 19 5(2)
x2 = 3

x1 + x2 = 5
x1 = 5 x2
x1 = 2

Ejercicio 5: Demuestre que la inversa de una matriz trigangular superior


es una matriz triangular superior.
Para demostrar lo pedido escogemos una mtriz triangular superior cualquiera.

1
0
0

4
3
0

2
4
1

Aplicando la teoria de matrices sabemos que A.A1 = I, donde A1 es la


matriz inversa de A, entonces tenemos que ver si se cumple esta condicion.

Primero procedemos a poner la matriz ampliada, es decir la matriz con la


matriz identidad.

1 4 2 | 1 0 0
0 3 4 | 0 1 0
0 0 1 | 0 0 1
Ahora procedemos a sacar la inversa de la matriz con operaciones entre filas

1
0
0

4
3
0

| 1
| 0
| 0

0
4
1

2
0
1

0
1
0

f 1 2f 3 = f 1

1
0
0

4
3
0

| 1
| 0
| 0

0
0
1

2
4
1

0
1
0

f 2 4f 3 = f 2

0,750
0,000
0,000

0
3
0

0
0
1

| 0,750 1
| 0,000 1
| 0,000 0

2,50
4
1

0,750f 1 f 2 = f 1

1
0
0

0
1
0

0
0
1

| 1
| 0
| 0

1,333 3,333
1,3331 1,333
0
1

donde;
A1

1
= 0
0

1,333
1,3331
0
8

3,333
1,333
1

es la matriz inversa de la matriz A.


Por lo tanto queda demostrado que la inversa de una mtriz triangular superior tambien es una mtriz triangular superior.

Ejercicio 6: Resolver el sistema de ecuaciones Ax = B, Calculando a mano


solo las matrices correspondientes a la factorizacion P A = LU .

2 3
4
0
A=
16 4
0
7

8
1
2
1

1
1
1
10
,b =
1
1
1
5

Soluci
on
Primero triangular la matriz

2
0

0
0

A
3
6
28
7

8
15
66
1

1
12

7
5

f 3 = f 3 8f 1
f 2 = f 2 2f 1

2
0

0
0

3
6
28
0

8
15
66
33/2

1
12

7
19

f 4 = f 4 7/6f 2

2
0

0
0

3
6
0
0

8
1
15
12

4
49
0
1465/8

f 3 = f 3 14/3f 2
f 4 = f 4 33/8f 3
P A = LU
P =I
A = LU


2
0

0
0

3
6
28
7

8
15
66
1


1
1

12
= 2
7 8
0
5


2
0
0
0

1
0
0
. 0
14/3
1
0 0
0
7/6 33/8 1

3
6
0
0

8
1
15
12

4
49
0
1465/8

MX = B
LU X = B
UX = Y
LY = B


1
0
0
0
X1
1
2
X2 1
1
0
0

. =
8 14/3
1
0 X3 1
0 7/6 33/8 1
X4
1
Y1 = 1
2Y1 + Y2 = 1
Y2 = 1 2(1)
Y2 = 1
8Y1 + 14/3Y2 + Y3 = 1
Y3 = 1 8(1) 14/3(1)
Y3 = 7/3
7/6Y2 + 33/8Y3 + Y 4 = 1
Y 4 = 1 7/6(1) 33/8(7/3)
Y4 = 283/24

2
0

0
0

3
6
0
0


X1
1
8
1


15
12
. X2 = 1
4
49 X3 7/3
283/24
0
1465/8
X4

X4 = 0,0643
4X3 + 49X4 = 7/3
X3 = 7/349(0,0643)
4
x3 = 0,2043
6x2 15x3 12x4 = 1
x2 = 1+15(0,2043)+12(0,0643)
6
x2 = 0,215

10

2x1 3x2 + 8x3 + x4 = 1


x1 = 1+3(0,215)8(0,2043)(0,0643)
2
x1 = 0,0374
2

Ejercicio 7: Considere la funcion f (x) = x2 .ex ) Se pide calcular un valor


aproximadopara la integral de f (x) en el intervalo(2, 2) usando el polinomio
de lagrange, calculando a mano, que interpola f (x) en los puntos x0 = 2, x1 =
1, x2 = 0 y x3 = 2.
Soluci
on
x
f (x)

2
0,0732

1
0,3678

0
2
0 0,0732

P (x) = 0,0732L(3, 0) + 0,3678L(3, 1) + 0L(3, 2) + 0,0732L(3, 3)

L(3, 0) =

1
x(x + 1)(x 2)
= (x3 x2 2x)
8
8

L(3, 1) =
L(3, 2) =

x(x + 2)(x 2)
1
= (x3 4x)
3
3

x(x + 1)(x22)
1
= (x3 + 3x2 + 2x)
24
24

P (x) = 0,00915(x3 x2 2x) + 0,1226(x3 4x) + 0,00305(x3 + 3x2 + 2x)


P (x) = 0,1165x3 + 0,0183x2 0,466x
Z

f (x)dx
2

(0,1165x3 + 0,0183x2 0,466x)dx

0,4172 (0,5148) = 0,0976


Ejercicio 8: Con el siguiente conjunto de nodos:
xi
yi

40
0,63

60
1,36

80
2,18

100
3,00

120
3,93

140
6,22

160
8,59

Obtener el valor de la funci


on par x = 90, con un polinomio de 2do grado, utilizando los siguietes metodos:
11

a) Por interpolaci
on polinomial simple.
b) Por interpolaci
on de Lagrange. (Aplicando el Programa).
c) Construya solo la matriz de diferencias divididas para aproximar todos los
puntos de la tabla.
d) Evaluar el polinomio interpolador de Newton.

a)
40 60 :
S1 =

(1,630,63)
(6040)

(x 60) + 1,36
S1 = 0,0365x 0,83

60 80 :
S2 =

(2,181,36)
(8060)

(x 80) + 2,18
S2 = 0,041x 1,1

80 100 :
S3 =

(32,18)
(10080)

(x 100) + 3
S3 = 0,041x 1,1

100 120 :
S4 =

(3,933)
(120100)

(x 120) + 3,93
S4 = 0,0465x 1,65

120 140 :
S5 =

(6,223,93)
(140120)

(x 140) + 6,22
S5 = 0,1145x 9,81

12

140 160 :
S6 =

(8,596,22)
(160140)

(x 160) + 8,59
S6 = 0,1185x 10,37

S(x)=

0,0365x 0,83

0,041x 1,1

0,041x 1,1
0,0465x 1,65

0,1145x 9,81

0,1185x 10,37

40 60
60 80
80 100
100 120
120 140
140 160

S(90)=

2,455

2,59

2,59
2,535

0,495

0,295

40 60
60 80
80 100
100 120
120 140
140 160

b)
Presentacion en Matlab
>> x=[40 60 80 100 120 140 160]
x =
40

60

80

100

120

140

160

>> fx=[0.63 1.36 2.18 3 3.93 6.22 8.59]


fx =
0.6300

1.3600

2.1800

3.0000

>> cont=interpolLagrange(x,fx)
cont =
13

3.9300

6.2200

8.5900

-0.0000

0.0000

-0.0000

0.0015

-0.0911

2.9206

-37.1100

P(x)=0.0015(x-40)(x-60)(x-80)(x-120)(x-140)(x-160)-0.0911(x-40)(x-60)(x-80)(x100)(x-140)(x-160)+2.9206(x-40)(x-60)(x-80)(x-100)(x-120)(x-160)-37.11(x-40)(x60)(x-80)(x-100)(x-120)(x-140)
Codigo Matlab
%INTERPOLACION DE LAGRANGE
function cont=interpolLagrange(x,fx)
s1=length(x);
s2=length(fx);
cont=0;
for k=1:s1
cont=cont+fx(k)*lagrange(x,k);
end
end

-------------------------------------------------------------------------------------------%Calcula el L del polinomio de Lagrange


function LG=lagrange(x,k)
rr=1;
ss=1;
s=length(x);
for j=1:s
if j~=k
rr=conv(rr,poly(x(j)));
ss=ss*(x(k)-x(j));
else
poly(x(j))==1;
end
LG=(1/ss)*rr;
end

c)

14

f(x1)
f(x2)
f(x3)
f(x4)
f(x5)
f(x6)
f(x7)

0.63
1.36
2.18
3
3.93
6.22
8.59

f(x1-x2)=0.0365
f(x2-x3)=0.041
f(x3-x4)=0.041
f(x4-x5)=0.0465
f(x5-x6)=0.1145
f(x6-x4)=0.041

f(x1-x3)=0.0001125
f(x2-x4)=0
f(x3-x5)=0.0001375
f(x4-x6)=0.00017
f(x5-x7)=0.0001

f(x1-x4)=2,083x106
f(x1-x4)=2,292x106
f(x1-x4)=5,42x107
f(x1-x4)=1,1667x106

f(x1-x6)=2,956x105
f(x2-x4)=2,956x105

f(x1-x5)=5,469x108
f(x2-x6)=2,956x103
f(x1-x4)=2,14x108

f(x1-x7)=4,9267x107

d)

P (x) = 0,63+0,0365(x40)+1,125x104 (x40)(x60)2,083x106 (x40)(x60)(x80)


P (1,75) = 362,647
Ejercicio 9: El polinomio P (x) = 2 (x + 1) + x(x + 1) 2x(x + 1)(x 1)
interpola los primeros cuatro nodos de la tabla:
x 1
y 2

0 1 2
1 2 7

3
10

Aada un termino a P de tal forma que el polinomio resultante interpole la tabla


entera.
Soluci
on
P (x) = 2 (x + 1) + x(x + 1) 2x(x + 1)(x 1)
P (x) = 2 (x + 1) + x(x + 1) 2x(x + 1)(x 1) + Cx(x + 1)(x 1)(x 2)
P (3) = 10
10 = 2 (3 + 1) + (3)(3 + 1) 2(3)(3 + 1)(3 1) + C(3)(3 + 1)(3 1)(3 2)
C=2
Por lo tanto:
P (x) = 2 (x + 1) + x(x + 1) 2x(x + 1)(x 1) + 2x(x + 1)(x 1)(x 2)
Ejercicio 10: La ecuacion x 9x = 0 tiene una solucion en el intervalo
[0, 1]. Utilize la teora de interpolacion polinomial en los nodos x0 = 0, x1 =
15

0, 5, x2 = 1, para encontrar una solucion aproximada x


de la ecuacion. (Aplicar
los programas).
a1 + a2 + a3 + ..... + an =

n
X

ai

i=1

f1 (x) + f2 (x) + f3 (x) + ... + fn (x) =

n
X

fi (x)

i=1

En

Pn

i=1

ai : a1 es el primer termino, a2 el segundo ... an es el n-esimo termino.

Presentaci
on en Matlab
>> x=[0 0.5 1]
x =
0

0.5000

1.0000

>> fx=[-1 0.1667 0.889]


fx =
-1.0000

0.1667

0.8890

>> cont=interpolLagrange(x,fx)
cont =
-0.8888

2.7778

-1.0000

por lo tanto el polinomio es: f (x) = 0,8888x2 +2,778x1 0,8888x2 +2,778x1 =


0
Presentacion en Matlab, raices de la ecuacion:
la raiz de la ecuacion es:
0.3260
la raiz de la ecuacion es:
-3.4515
C
odigo del Programa
%INTERPOLACION DE LAGRANGE
%Calcula la funcion interpolacion por el metodo de Lagrange
16

function cont=interpolLagrange(x,fx)
s1=length(x);
s2=length(fx);
cont=0;
for k=1:s1
cont=cont+fx(k)*lagrange(x,k);
end
end
%INTERPOLACION DE LAGRANGE
%Calcula el L del polinomio de Lagrange
function LG=lagrange(x,k)
rr=1;
ss=1;
s=length(x);
for j=1:s
if j~=k
rr=conv(rr,poly(x(j)));
ss=ss*(x(k)-x(j));
else
poly(x(j))==1;
end
LG=(1/ss)*rr;
end

------------------------------------------------------------------------------------------\\
% PROGRAMA PARA CALCULAR LAS RAICES (METODO DE NEWTON)
x0=-10;
fx=@(x)(0.8888*x^2+2.778*x-1);
gx=@(x)(2*0.8888*x+2.778);
x(1)=x0-fx(x0)/gx(x0);
for i=1:1000
x(i+1)=x(i)-fx(x(i))/gx(x(i));
if abs(x(i+1)-x(i))<0.00001
disp(la raiz de la ecuacion es: )
disp(x(i+1))
return
end
end

17

Das könnte Ihnen auch gefallen