﻿ lista1-sol - Álgebra Linear II
5 pág.

# lista1-sol

Disciplina:Álgebra Linear II705 materiais7.713 seguidores
Pré-visualização1 página
(1.2)(1.2)

(1.6)(1.6)

(1.9)(1.9)

(1.8)(1.8)

(1.1)(1.1)

(1.5)(1.5)

(1.4)(1.4)

(1.3)(1.3)

(1.7)(1.7)

LLLLIIIISSSSTTTTAAAA 1111

Exercício 1

with(linalg):
eqns := {2*x+3*y+5*z=5,3*x-y+2*z=2};

eqns := 2 x 3 y 5 z = 5, 3 x y 2 z = 2

A := genmatrix(eqns, [x,y,z],flag);

A :=
2 3 5 5
3 1 2 2

backsub(gausselim(A));
1 _t1 1 _t1 _t1

eqns := {4*x+3*y=7,3*x-2*y=1,2*x-7*y=-5};
eqns := 4 x 3 y = 7, 3 x 2 y = 1, 2 x 7 y = 5

A := genmatrix(eqns, [x,y],flag);

A :=
4 3 7
3 2 1
2 7 5

backsub(gausselim(A));
1 1

eqns := {4*x+3*y=7,3*x-2*y=1,2*x-7*y=-1};
eqns := 4 x 3 y = 7, 3 x 2 y = 1, 2 x 7 y = 1

A := genmatrix(eqns, [x,y],flag);

A :=
4 3 7
3 2 1
2 7 1

backsub(gausselim(A));
Error, (in linalg:-backsub) inconsistent system

Não tem solução, veja a última linha da matriz aumentada após escalonamento.
rref(A);

(1.9)(1.9)

(2.2)(2.2)

(2.3)(2.3)

(2.1)(2.1)

(2.4)(2.4)

(2.5)(2.5)

1 0 0
0 1 0
0 0 1

Exercício 2

a:=matrix([[1,2,3],[2,3,5],[3,5,7]]);

a :=

1 2 3
2 3 5
3 5 7

u:=LUdecomp(a, L='l', P='p'); evalm(l);

u :=

1 2 3
0 1 1
0 0 1

1 0 0
2 1 0
3 1 1

evalm(a-l&*u);
0 0 0
0 0 0
0 0 0

a:=matrix([[1,2,3],[2,4,5],[3,5,7]]);

a :=

1 2 3
2 4 5
3 5 7

u:=LUdecomp(a, L='l',P='p'); evalm(l);

u :=

1 2 3
0 1 2
0 0 1

(2.6)(2.6)

(2.9)(2.9)

(2.8)(2.8)

(2.7)(2.7)

1 0 0
3 1 0
2 0 1

evalm(a-l&*u);
0 0 0
1 1 2
1 1 2

O que deu errado? Precisamos da permutação!
evalm(p);evalm(p&*a-l&*u);

1 0 0
0 0 1
0 1 0

0 0 0
0 0 0
0 0 0

a:=matrix([[1,2,0,0,0],[1,1,0,0,0],[1,1,1,0,0],[1,1,1,1,0],
[1,1,1,1,1]]);

a :=

1 2 0 0 0
1 1 0 0 0
1 1 1 0 0
1 1 1 1 0
1 1 1 1 1

u:=LUdecomp(a, L='l',P='p'); evalm(l);

u :=

1 2 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1

(3.1)(3.1)

(3.3)(3.3)

(2.10)(2.10)

(3.2)(3.2)

1 0 0 0 0
1 1 0 0 0
1 1 1 0 0
1 1 1 1 0
1 1 1 1 1

evalm(a-l&*u);

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

Exercício 3

a:=matrix([[3,2,2],[0,2,3],[2,1,1]]);

a :=

3 2 2
0 2 3
2 1 1

e1:=vector([1,0,0]):e2:=vector([0,1,0]):e3:=vector([0,0,1]):
u:=LUdecomp(a, L='l', P='p'); evalm(l);

u :=

3 2 2
0 2 3

0 0 16

1 0 0
0 1 0
2
3

1
6 1

y1:=forwardsub(augment(l,e1));x1:=backsub(augment(u,y1));
#conferindo
evalm(a&*x-e1);

(3.6)(3.6)

(3.4)(3.4)

(3.3)(3.3)

(3.5)(3.5)

y1 := 1 0 23

x1 := 1 6 4

0 0 0

y2:=forwardsub(augment(l,e2));x2:=backsub(augment(u,y2));
#conferindo
evalm(a&*x2-e2);

y2 := 0 1 16

x2 := 0 1 1

0 0 0

y3:=forwardsub(augment(l,e3));x3:=backsub(augment(u,y3));
#conferindo
evalm(a&*x3-e3);

y3 := 0 0 1

x3 := 2 9 6

0 0 0

inversa:=augment(x1,x2,x3); #conferindo
evalm(inverse(a)-inversa);

inversa :=
1 0 2
6 1 9
4 1 6

0 0 0
0 0 0
0 0 0