Sistemas de Ecuaciones MATLAB

44
Carrera: Ingeniería Industrial Materia: Algebra Lineal y Geometría Analítica Profesora: Bloeck, Marina Beatriz Alumno: Juan Manuel Santillan

description

Sistema de ecuaciones MATLAB programa computadora ejercicios

Transcript of Sistemas de Ecuaciones MATLAB

Carrera: Ingeniería Industrial

Materia: Algebra Lineal y Geometría Analítica

Profesora: Bloeck, Marina Beatriz

Alumno: Juan Manuel Santillan

Guía N°5: Sistemas de Ecuaciones

Año 2015

1) Resolver los siguientes sistemas de ecuaciones utilizando los tres procedimientos descriptos anteriormente. Clasificarlos

a) { 2x+ y+z=3x− y+z=0

3x− y+2 z=2

Primera forma de resolución:

>> A=[2 1 1;1 -1 1; 3 -1 2]

A =

2 1 1

1 -1 1

3 -1 2

>> b=[3;0;2]

b =

3

0

2

>> Ab=[A b]

Ab =

2 1 1 3

1 -1 1 0

3 -1 2 2

>> rref(Ab)

ans =

1 0 0 1

0 1 0 1

0 0 1 0

Luego x= 1, y=1 y z=0

Entonces: Sol= {(1;1;0)}. Sistema Compatible Determinado

Segunda forma de resolución:

>> x=inv(A)*b

x =

1.0000

1.0000

0.0000

Luego x= 1, y=1 y z=0

Entonces: Sol= {(1;1;0)}. Sistema Compatible Determinado

Tercera forma de resolución:

>> x=(A)\b

x =

1.0000

1.0000

0.0000

Luego x= 1, y=1 y z=0

Entonces: Sol= {(1;1;0)}. Sistema Compatible Determinado

b) { x− y=1iy+z=0

x+ (1−i ) y=iPrimera forma de resolución:

A=[1 -1 0;0 i 1;1 1-i 0]

A =

1 + 0i -1 + 0i 0 + 0i

0 + 0i 0 + 1i 1 + 0i

1 + 0i 1 - 1i 0 + 0i

>> b=[1;0;i]

b =

1 + 0i

0 + 0i

0 + 1i

>> Ab=[A b]

Ab =

Columns 1 through 3

1 + 0i -1 + 0i 0 + 0i

0 + 0i 0 + 1i 1 + 0i

1 + 0i 1 - 1i 0 + 0i

Column 4

1 + 0i

0 + 0i

0 + 1i

>> rref(Ab)

ans =

Columns 1 through 3

1 + 0i 0 + 0i 0 + 0i

0 + 0i 1 + 0i 0 + 0i

0 + 0i 0 + 0i 1 + 0i

Column 4

2/5 + 1/5i

-3/5 + 1/5i

1/5 + 3/5i

Luego x= 25+ 1

5i, y=

−35

+ 15i y z=

15+ 3

5i

Entonces: Sol= {( 25+ 1

5i ;

−35

+ 15i ; z=

15+ 3

5i)}. Sistema Compatible

Determinado

Segunda forma de resolución:

>> x=inv(A)*b

x =

2/5 + 1/5i

-3/5 + 1/5i

1/5 + 3/5i

Luego x= 25+ 1

5i, y=

−35

+ 15i y z=

15+ 3

5i

Entonces: Sol= {( 25+ 1

5i ;

−35

+ 15i ; z=

15+ 3

5i)}. Sistema Compatible

Determinado

Tercera forma de resolución:

>> x=(A)\b

x =

2/5 + 1/5i

-3/5 + 1/5i

1/5 + 3/5i

Luego x= 25+ 1

5i, y=

−35

+ 15i y z=

15+ 3

5i

Entonces: Sol= {( 25+ 1

5i ;

−35

+ 15i ; z=

15+ 3

5i)}. Sistema Compatible

Determinado

c) { x+2 y+4 z=1x+ y+3 z=2

2x+5 y+9 z=1

Primera forma de resolución:

>> A=[1 2 4;1 1 3;2 5 9]

A =

1 2 4

1 1 3

2 5 9

>> b=[1;2;1]

b =

1

2

1

>> Ab=[A b]

Ab =

1 2 4 1

1 1 3 2

2 5 9 1

>> rref(Ab)

ans =

1 0 2 3

0 1 1 -1

0 0 0 0

Entonces: Sistema Compatible Indeterminado

>> x=inv(A)*b

Warning: Matrix is singular to working precision.

x =

1/0

1/0

1/0

>> x=(A)\b

Warning: Matrix is singular to working precision.

x =

0/0

0/0

0/0

Entonces: Sol: Sistema Compatible Indeterminado

d) {x− y+iz=1iy−z=i

Primera forma de resolución:

>> A=[1 -1 i;0 i -1]

A =

1 + 0i -1 + 0i 0 + 1i

0 + 0i 0 + 1i -1 + 0i

>> b=[1;i]

b =

1 + 0i

0 + 1i

>> Ab=[A b]

Ab =

Columns 1 through 3

1 + 0i -1 + 0i 0 + 1i

0 + 0i 0 + 1i -1 + 0i

Column 4

1 + 0i

0 + 1i

>> rref(Ab)

ans =

Columns 1 through 3

1 + 0i 0 + 0i 0 + 2i

0 + 0i 1 + 0i 0 + 1i

Column 4

2 + 0i

1 + 0i

Entonces: Sol: Sistema Compatible Indeterminado

>> x=inv(A)*b

Error using inv

Matrix must be square.

Entonces: Sol: Sistema Compatible Indeterminado

>> x=(A)\b

x =

0 + 0i

0 + 0i

0 - 1i

Entonces: Sol: Sistema Compatible Indeterminado

e) { x−iy=2y+iz=1+2 ix+ y=1+i

Primera forma de resolución:

>> A=[1 -i 0;0 1 i;1 1 0]

A =

1 + 0i 0 - 1i 0 + 0i

0 + 0i 1 + 0i 0 + 1i

1 + 0i 1 + 0i 0 + 0i

>> b=[2;1+2i;1+i]

b =

2 + 0i

1 + 2i

1 + 1i

>> Ab=[A b]

Ab =

Columns 1 through 3

1 + 0i 0 - 1i 0 + 0i

0 + 0i 1 + 0i 0 + 1i

1 + 0i 1 + 0i 0 + 0i

Column 4

2 + 0i

1 + 2i

1 + 1i

>> rref(Ab)

ans =

Columns 1 through 3

1 + 0i 0 + 0i 0 + 0i

0 + 0i 1 + 0i 0 + 0i

0 + 0i 0 + 0i 1 + 0i

Column 4

1 + 0i

0 + 1i

1 - 1i

Luego x=1, y=i y z=1-i

Entonces: Sol= {(1;i;1-i)}. Sistema Compatible Determinado

Segunda forma de resolución:

>> x=inv(A)*b

x =

1 + 0i

0 + 1i

1 - 1i

Luego x=1, y=i y z=1-i

Entonces: Sol= {(1;i;1-i)}. Sistema Compatible Determinado

Tercera forma de resolución:

>> x=(A)\b

x =

1 + 0i

0 + 1i

1 - 1i

Luego x=1, y=i y z=1-i

Entonces: Sol= {(1;i;1-i)}. Sistema Compatible Determinado

f) { x+ y+z=23 x−2 y−z=4−2x+ y+2 z=2

Primera forma de resolución:

>> A=[1 1 1;3 -2 -1;-2 1 2]

A =

1 1 1

3 -2 -1

-2 1 2

>> b=[2;4;2]

b =

2

4

2

>> Ab=[A b]

Ab =

1 1 1 2

3 -2 -1 4

-2 1 2 2

>> rref(Ab)

ans =

1 0 0 1

0 1 0 -2

0 0 1 3

Luego x=1, y=-2 y z=3

Entonces: Sol= {(1;-2;3)}. Sistema Compatible Determinado

Segunda forma de resolución:

>> x=inv(A)*b

x =

1

-2

3

Luego x=1, y=-2 y z=3

Entonces: Sol= {(1,-2,3)}. Sistema Compatible Determinado

Tercera forma de resolución:

>> x=(A)\b

x =

1

-2

3

Luego x=1, y=-2 y z=3

Entonces: Sol= {(1,-2,3)}. Sistema Compatible Determinado

g) { 2 x+5 y=16x+3 y−2 z=−2

x+z=4

Primera forma de resolución:

>> A=[2 5 0;1 3 -2;1 0 1]

A =

2 5 0

1 3 -2

1 0 1

>> b=[16;-2;4]

b =

16

-2

4

>> Ab=[A b]

Ab =

2 5 0 16

1 3 -2 -2

1 0 1 4

>> rref(Ab)

ans =

1 0 0 -2

0 1 0 4

0 0 1 6

Luego x=-2, y=4 y z=6

Entonces: Sol= {(-2,4,6)}. Sistema Compatible Determinado

Segunda forma de resolución:

>> x=inv(A)*b

x =

-2

4

6

Luego x=-2, y=4 y z=6

Entonces: Sol= {(-2,4,6)}. Sistema Compatible Determinado

Tercera forma de resolución:

>> x=(A)\b

x =

-2

4

6

Luego x=-2, y=4 y z=6

Entonces: Sol= {(-2,4,6)}. Sistema Compatible Determinado

2) Estudiar la compatiblidad o incompatibilidad de los siguientes sistemas de ecuaciones utilizando el teorema de Rouche-Frobenius y resolverlos en el caso que sean compatibles:

i.

a) { x+ y−z=02x+ y+z=0x+z=1

>> A=[1 1 -1;2 1 1;1 0 1]

A =

1 1 -1

2 1 1

1 0 1

>> b=[0;0;1]

b =

0

0

1

>> Ab=[A b]

Ab =

1 1 -1 0

2 1 1 0

1 0 1 1

>> rank(A)

ans =

3

>> rank(Ab)

ans =

3

Entonces:

r (A)=R(Ab)=3

r (A)= R(Ab)=3 (n° de incógnitas). Por lo tanto el Sistema es Compatible Determinado

>> x=inv(A)*b

x =

2

-3

-1

Luego x=2, y=-3 y z=-1

Entonces: Sol= {(2,-3,-1)}. Sistema Compatible Determinado

b) { x−2 y+ z=22x+ y−z=1

2 x− y=0−x+2 y−z=−2

>> A=[1 -2 1;2 1 -1;2 -1 0;-1 2 -1]

A =

1 -2 1

2 1 -1

2 -1 0

-1 2 -1

>> b=[2;1;0;-2]

b =

2

1

0

-2

>> Ab=[A b]

Ab =

1 -2 1 2

2 1 -1 1

2 -1 0 0

-1 2 -1 -2

>> rank(A)

ans =

3

>> rank(Ab)

ans =

3

Entonces:

r (A)=R(Ab)=3

r (A)= R(Ab)=3 (n° de incógnitas). Por lo tanto el Sistema es Compatible Determinado

>> x=(A)\b

x =

3

6

11

Luego x=3, y=6 y z=11

Entonces: Sol= {(3,6,11)}. Sistema Compatible Determinado

c) { 3 x− y+z−t=12 x+4 y−6 t=0x+ y−z+2 t=0

3x+6 y−9 t=−1

>> A=[3 -1 1 -1;2 4 0 -6;1 1 -1 2;3 6 0 -9]

A =

3 -1 1 -1

2 4 0 -6

1 1 -1 2

3 6 0 -9

>> b=[1;0;0;-1]

b =

1

0

0

-1

>> Ab=[A b]

Ab =

3 -1 1 -1 1

2 4 0 -6 0

1 1 -1 2 0

3 6 0 -9 -1

>> rank(A)

ans =

3

>> rank(Ab)

ans =

4

r (A)≠R(Ab)

r (A)≠ R(Ab)¿4 (n° de incógnitas). Por lo tanto el Sistema Incompatible

d) {2x+2 y−z+t=−1x− y+z=2

>> A=[2 2 -1 1;1 -1 1 0]

A =

2 2 -1 1

1 -1 1 0

>> b=[-1;2]

b =

-1

2

>> Ab=[A b]

Ab =

2 2 -1 1 -1

1 -1 1 0 2

>> rank(A)

ans =

2

>> rank(Ab)

ans =

2

r (A)¿R(Ab)

r (A)= R(Ab)¿4 (n° de incógnitas). Por lo tanto el Sistema es Compatible Indeterminado

ii.

a) {2x−5 y+3 z=4x−2 y+z=3

5 x+ y+7=11 ∼{2x−5 y+3 z=4

x−2 y+z=35 x+ y=4

>> A=[2 -5 3;1 -2 1;5 1 0]

A =

2 -5 3

1 -2 1

5 1 0

>> b=[4;3;4]

b =

4

3

4

>> Ab=[A b]

Ab =

2 -5 3 4

1 -2 1 3

5 1 0 4

>> rank(A)

ans =

3

>> rank(Ab)

ans =

3

r (A)¿R(Ab)

r (A)= R(Ab)=3 (n° de incógnitas). Por lo tanto el Sistema es Compatible Determinado

>> x=(A)\b

x =

3/2

-7/2

-11/2

Luego x=32, y=−7

2y z=−11

2

Entonces: Sol= {(32;−7

2;−11

2)}. Sistema Compatible Determinado

b) { x+4 y+ z=7x+6 y−z=132x− y+2 z=5

>> A=[1 4 1;1 6 -1;2 -1 2]

A =

1 4 1

1 6 -1

2 -1 2

>> b=[7;13;5]

b =

7

13

5

>> Ab=[A b]

Ab =

1 4 1 7

1 6 -1 13

2 -1 2 5

>> rank(A)

ans =

3

>> rank(Ab)

ans =

3

r (A)=R(Ab)

r (A)= R(Ab)=3 (n° de incógnitas). Por lo tanto el Sistema es Compatible Determinado

>> x=(A)\b

x =

5

1

-2

Luego x=5, y=1 y z=-2

Entonces: Sol= {( 5;1;-2 )}. Sistema Compatible Determinado

c) {3x+2 y+z+u−w=3x+2 z+u−w=2

3 x−2 z+u−w=0

>> A=[3 2 1 1 -1;1 0 2 1 -1;3 0 -2 1 -1]

A =

3 2 1 1 -1

1 0 2 1 -1

3 0 -2 1 -1

>> b=[3;2;0]

b =

3

2

0

>> Ab=[A b]

Ab =

3 2 1 1 -1 3

1 0 2 1 -1 2

3 0 -2 1 -1 0

>> rank(A)

ans =

3

>> rank(Ab)

ans =

3

r (A)=R(Ab)

r (A)= R(Ab)¿5 (n° de incógnitas). Por lo tanto el Sistema es Compatible Indeterminado

d) { x+ y+ z=02 y−3 z=5 ix+iy=−1

>> A=[1 1 1;0 2 -3;1 i 0]

A =

1 + 0i 1 + 0i 1 + 0i

0 + 0i 2 + 0i -3 + 0i

1 + 0i 0 + 1i 0 + 0i

>> b=[0;5i;-1]

b =

0 + 0i

0 + 5i

-1 + 0i

>> Ab=[A b]

Ab =

Columns 1 through 3

1 + 0i 1 + 0i 1 + 0i

0 + 0i 2 + 0i -3 + 0i

1 + 0i 0 + 1i 0 + 0i

Column 4

0 + 0i

0 + 5i

-1 + 0i

>> rank(A)

ans =

3

>> rank(Ab)

ans =

3

r (A)=R(Ab)

r (A)= R(Ab)=3 (n° de incógnitas). Por lo tanto el Sistema es Compatible Determinado

>> x=(A)\b

x =

-0.0000 + 0.0000i

0.0000 + 1.0000i

0.0000 - 1.0000i

Luego x=0 ,y=i y z=-i

Entonces: Sol= {( 0;i;-i )}. Sistema Compatible Determinado

e) { x+ z=4−x+2 y+z=6y+ z=−3

>> A=[1 0 1;-1 2 1;0 1 1]

A =

1 0 1

-1 2 1

0 1 1

>> b=[4;6;-3]

b =

4

6

-3

>> Ab=[A b]

Ab =

1 0 1 4

-1 2 1 6

0 1 1 -3

>> rank(A)

ans =

2

>> rank(Ab)

ans =

3

r (A)≠R(Ab)

r (A)¿ R(Ab)=3 (n° de incógnitas). Por lo tanto el Sistema es Compatible Incompatible

3) Resolver los siguientes sistemas utilizando uno de los tres procedimientos anteriormente descriptos. Clasificarlos.

i.

a) { x+2 y−z=72x+ y+z=6x− y+3 z=−1

>> A=[1 2 -1;2 1 1;1 -1 3]

A =

1 2 -1

2 1 1

1 -1 3

>> b=[7;6;-1]

b =

7

6

-1

>> Ab=[A b]

Ab =

1 2 -1 7

2 1 1 6

1 -1 3 -1

>> x=inv(A)*b

x =

5/3

8/3

0

Luego x=53, y=8

3y z=0

Entonces: Sol= {( 53;

83;0)}. Sistema Compatible Determinado

b) { x+ y=2x− y=2 i

>> A=[1 1;1 -1]

A =

1 1

1 -1

>> b=[2;2i]

b =

2 + 0i

0 + 2i

>> Ab=[A b]

Ab =

1 + 0i 1 + 0i 2 + 0i

1 + 0i -1 + 0i 0 + 2i

>> x=inv(A)*b

x =

1 + 1i

1 - 1i

Luego x= 1+i y y= 1-i

Entonces: Sol= {( 1+i;1-i)}. Sistema Compatible Determinado

c) {2 x+3 y−5 z−2=03x− y+2 z+1=0

5x+4 y−6 z−3=0∼ {2x+3 y−5 z=2

3x− y+2 z=−15 x+4 y−6 z=3

>> A=[2 3 -5;3 -1 2;5 4 -6]

A =

2 3 -5

3 -1 2

5 4 -6

>> b=[2;-1;3]

b =

2

-1

3

>> Ab=[A b]

Ab =

2 3 -5 2

3 -1 2 -1

5 4 -6 3

>> x=inv(A)*b

x =

-1/5

14/5

6/5

Luego x=−15, y=14

5y z=6

5

Entonces: Sol= {(−15;

145;

65

)}. Sistema Compatible Determinado

ii.

a) { x+ y=4x+ y+z=12 y+z=1

>> A=[1 1 0;1 1 1;0 2 1]

A =

1 1 0

1 1 1

0 2 1

>> b=[4;1;1]

b =

4

1

1

>> Ab=[A b]

Ab =

1 1 0 4

1 1 1 1

0 2 1 1

>> x=inv(A)*b

x =

2

2

-3

Luego x=2 ,y=2 y z=-3

Entonces: Sol= {(2;2;-3)}. Sistema Compatible Determinado

b) { x−2 z=12x+ y+z=5x−2 y=7

>> A=[1 0 -2;2 1 1;1 -2 0]

A = 1 0 -2 2 1 1 1 -2 0 >> b=[1;5;7]

b = 1 5 7

>> Ab=[A b]Ab = 1 0 -2 1 2 1 1 5 1 -2 0 7 >> x=inv(A)*bx = 3 -2 1

Luego x=3 ,y=-2 y z=1

Entonces: Sol= {(3;-2;1)}. Sistema Compatible Determinado

c) { 2 x+ y+2 z=7x+3 y+z=7

3x+4 y−2 z=8

>> A=[2 1 2;1 3 1;3 4 -2]

A =

2 1 2

1 3 1

3 4 -2

>> b=[7;7;8]

b =

7

7

8

>> Ab=[A b]

Ab =

2 1 2 7

1 3 1 7

3 4 -2 8

>> x=inv(A)*b

x =

8/5

7/5

6/5

Luego x=85, y=7

5y z=6

5

Entonces: Sol= {( 85;

75;

65

)}. Sistema Compatible Determinado

iii.

a) { 3 x+2 y+z=15x+3 y+4 z=2x+ y−z=1

>> A=[3 2 1;5 3 4;1 1 -1]

A =

3 2 1

5 3 4

1 1 -1

>> b=[1;2;1]

b =

1

2

1

>> Ab=[A b]

Ab =

3 2 1 1

5 3 4 2

1 1 -1 1

>> x=inv(A)*b

x =

-4

6

1

Luego x=-4 ,y=6 y z=1

Entonces: Sol= {(-4;6;1)}. Sistema Compatible Determinado

b) { x+ y+z=12x+3 y−4 z=9x− y+z=−1

>> A=[1 1 1;2 3 -4;1 -1 1]

A =

1 1 1

2 3 -4

1 -1 1

>> b=[1;9;-1]

b =

1

9

-1

>> Ab=[A b]

Ab =

1 1 1 1

2 3 -4 9

1 -1 1 -1

>> x=inv(A)*b

x =

1

1

-1

Luego x=1 ,y=1 y z=-1

Entonces: Sol= {(1;1;-1)}. Sistema Compatible Determinado

4) Plantear y resolver los siguientes problemas:

a) El propietario de un restaurante planea utilizar “x” mesas para 4 personas, “y” mesas para 6 personas y “z” mesas para 8 personas, para un total de 20 mesas. En plena ocupación, se sientan en la mesa 108 clientes. Si solo se utilizan la mitad de las mesas “x”, la mitad de las mesas “y” y un cuarto de las mesas “z”, todas ellas completamente ocupadas, entonces solo se sientan 46 clientes. Obtener “x”,”y” y ”z”.

{4 x+6 y+8 z=108x+ y+z=20

2 x+3 y+2 z=46

>> A=[4 6 8;1 1 1; 2 3 2]

A =

4 6 8

1 1 1

2 3 2

>> b=[108;20;46]

b =

108

20

46

>> Ab=[A b]

Ab =

4 6 8 108

1 1 1 20

2 3 2 46

>> x=inv(A)*b

x =

10

6

4

Entonces: Solución= {(10,6,4)}.

b) Se desea distribuir 178 tn de trigo en tres silos cuyas capacidades suman exactamente esa cantidad ¿Cuántas tn caben en cada silo si la razón entre la capacidad del primero y la del segundo es 2/5 y entre la de este y la del tercero es 7/8?

{S1+S2+S3=178

S1S2

=25

S 2S 3

=78

∼ {S1+S2+S3=1785S1−2S2=08 S2−7 S3=0

>> A=[1 1 1;5 -2 0;0 8 -7]

A =

1 1 1

5 -2 0

0 8 -7

>> b=[178;0;0]

b =

178

0

0

>> x=inv(A)*b

x =

28

70

80

Entonces: Solución= {(28,70,80)}.

c) Una empresa ha vendido 42000 artículos de papelería, bolígrafos, gomas y rotuladores, al precio de 1.2, 1.5 y 2$ respectivamente. El total de los ingresos producidos por esas ventas asciende a 64000 $. Se sabe, además, que el número de bolígrafos que se ha vendido es el 40% del número, total del resto de artículos vendidos. Determinar el número de cada tipo de artículos vendidos.

{ b+g+r=420001.2b+1.5g+2r=64000

b=0.4 (g+r )∼ { b+g+r=42000

1.2b+1.5g+2r=64000b−0.4 g−0.4 r=0

>> A=[1 1 1;1.2 1.5 2;1 -0.4 -0.4]

A =

1 1 1

6/5 3/2 2

1 -2/5 -2/5

>> b=[42000;64000;0]

b =

42000

64000

0

>> Ab=[A b]

Ab =

1 1 1 42000

6/5 3/2 2 64000

1 -2/5 -2/5 0

>> x=inv(A)*b

x =

12000

20800

9200

Entonces: Solución= {(b = 12000, g = 20800, r = 9200)}.