56
Puff! The magic dragon, live by the sea… 第6第 線線線線線線線 Linear Algebraic Equations

第 6 章 線性代數方程式 Linear Algebraic Equations

  • Upload
    tara

  • View
    109

  • Download
    7

Embed Size (px)

DESCRIPTION

第 6 章 線性代數方程式 Linear Algebraic Equations. linear. 5x-2y=13 7x+3y=24 Linear ~ dependent variable 不可以有一次以外的次方. 6.1 Elementary Solution Methods. Successive elimination of variables Gauss elimination. Gauss elimination. -x+y+2z=2(1) 3x-y+z=6(2) -x+3y+4z=4(3) -x+y+2z=2(1) - PowerPoint PPT Presentation

Citation preview

Page 1: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

第 6章 線性代數方程式Linear Algebraic Equations

Page 2: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

linear

5x-2y=137x+3y=24

• Linear ~ dependent variable 不可以有一次以外的次方

Page 3: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

6.1 Elementary Solution Methods

• Successive elimination of variables• Gauss elimination

Page 4: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Gauss elimination

-x+y+2z=2 (1)3x-y+z=6 (2)-x+3y+4z=4 (3)

-x+y+2z=2 (1) 2y+7z=12 (4) 2y+2z=2 (5)

Page 5: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Gauss elimination

-x+y+2z=2 (1) 5z=10 (6) y=-1 (7)

x=1

Page 6: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Self test p.334

Page 7: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Singular & ill-conditioned problems

1. 3x-4y=5 6x-10y=2 Sol. (7,4)2. 3x-4y=5 6x-8y=10 Infinite solutions3. 3x-4y=5 6x-8y=3 empty set

Page 8: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 9: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 10: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Homogeneous equations

6x+ay=02x+4y=0(a-12)y=0If a~=12, x=0If a=12, infinite solutions

Page 11: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Ill-conditioned equations

3x-4y=5 (1)6x-8.002y=3 (2)(11 y=(3x-5)/4(11 y=(3x-1.5)/4.001

(x,y)=(4668, 3500)Very sensitive !

Page 12: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Matrix methods for linear equations

75

4392

75

4392

743592

2

1

2

1

21

21

bxA

bAx

xx

xx

xxxx

Page 13: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

mn

mnmm

n

n

mn

mnmm

n

n

mnmnmm

nn

nn

b

bb

x

xx

aaa

aaaaaa

b

bb

x

xx

aaa

aaaaaa

bxaxaxa

bxaxaxabxaxaxa

2

12

1

21

22221

11211

2

12

1

21

22221

11211

2211

22222121

11212111

bxA

bAx

Page 14: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Determinants 行列式

3792106143

A

A=[3,-4,1;6,10,2;9,-7,3];det(A)ans = 0

Page 15: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Determinants and singular problems

• If determinant of A=0, then a singular problem.

• If determinant of A ~= 0• If determinant of A = 0

Page 16: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Left-division methodA=[3,2,-9;-9,-5,2;6,7,3];det(A)b=[-65;16;5];A\b

ans = 288ans = 2.0000 -4.0000 7.0000

Page 17: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Right-division method

]193[5326

][ 21

xx

d/CxdxC

Page 18: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Ex.6.2-2 p.342

• Kirchhoff’s law

• Current conservation at a node

532

421

iiiiii

00

0

23355

552244

44111

viRiRiRiRiR

iRiRv

Page 19: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea… 0

00

23355

552244

44111

viRiRiRiRiR

iRiRv

532

421

iiiiii

Page 20: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

% resist.m% solve the current i_1,i_2,i_3R=[5,100,200,150,250]*1000;v1=100; v2=50;A1=[R(1)+R(4),-R(4),0];A2=[-R(4),R(2)+R(4)+R(5),-R(5)];A3=[0,R(5),-(R(3)+R(5))];A=[A1;A2;A3];b=[v1;0;v2];current=A\b;disp('The currents are:')disp(current)The currents are: 1.0e-003 *

0.9544 0.3195 0.0664

235325

35254214

124141

)(0)(

)(

viRRiRiRiRRRiR

viRiRR

Page 21: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Exercise p.343-345

Page 22: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Matrix inverse

bAxxIbAAxAIAAAA

bAx

1

11

11

Page 23: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

An example of Statics

• Derivation of equilibrium equations.• Solve the linear equations by matlab.• P.346-348

Page 24: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Ex. 6.2-5• Check by matlab as well as by hand for an inversion of 2 by 2

matrix.

2x+9y=53x-4y=7

A=[2,9;3,-4];b=[5;7];x=inv(A)*bx = 2.3714 0.0286

Page 25: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 26: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Cramer’s method

• Self test …

Page 27: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

6.4 Underdetermined systems

A=[1,3];b=6;x=A\b

x = 0 2

solutionsinfinite36

631

63

yxyxyx

Page 28: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Underdetermined systems

0A

Page 29: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Matrix rank 矩陣的秩

2rank

157943

4437210

03792106143

A=[3,-4,1;6,10,2;9,-7,3];rank(A)

ans =

2

Page 30: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Existence and uniqueness of solutions

• Augmented matrix

108627935

][

107

,862935

][

bA

bA

bA

Page 31: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Existence and uniqueness of solutions

• Augmented matrix

][rank][rankifonlyandifunknowns) eqns., (11

bAAbxA

nmmnnm

Page 32: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Singular matrix0A

Page 33: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Ex 6.4-1

3x-2y+8z=48-6x+5y+z=-129x+4y+2z=24

A=[3,-2,8;-6,5,1;9,4,2];b=[48;-12;24];rank(A)rank([A b])x=A\b

ans =3ans = 3x = 2.0000 -1.0000 5.0000

Page 34: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Ex 6.4-22x-4y+5z=-4-4x-2y+3z=42x+6y-8z=0

• A=[2,-4,5;-4,-2,3;2,6,-8];• b=[-4;4;0];• rank(A)• rank([A b])• x=A\b

• ans =• 2• ans =• 2• Warning: Matrix is singu

lar to working precision.• x =• Inf• Inf• Inf

Page 35: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

pinv command & Euclidean norm

• x=pinv(A)*b

x = -1.2148 0.2074 -0.1481

Page 36: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Ex 6.4-3

• Statically indeterminate problem

Page 37: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

1600400

0510111

][

1600400

,0510111

1600400

0510111

0510)4(400,0400,

3

2

1

3

2

1

21

321

Ab

x

bA

0M0F

TTT

TTT

TTTTT

Page 38: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

32

31

12

248080

2320

TTTT

TT

Page 39: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

A=[1,1,1;10,5,0];b=[400;1600];rank(A)rank([A b])A\bans = 2ans = 2ans = 160.0000 0 240.0000

pinv(A)*bans = 93.3333 133.3333 173.3333

Page 40: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Ex 6.4-4, pp.3622x-4y+5z=-4-4x-2y+3z=42x+6y-8z=0

• x+0y-0.1z=-1.2• 0x+y-1.3z=0.4• 0x+0y+0z=0

A=[2,-4,5;-4,-2,3;2,6,-8];b=[-4;4;0];x=pinv(A)*brref([A b])x = -1.2148 0.2074 -0.1481ans = 1.0000 0 -0.1000 -1.2000 0 1.0000 -1.3000 0.4000 0 0 0 0

Page 41: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Underdetermined systems• P.363-364 ex.6.4-55x+3y+3z=403x+3y+4z=30

• x-0.5z=5• y+1.8333z=5

zyx

xBA3040

433335

A=[5,3,3;3,3,4];b=[40;30];rref([A b])

ans = 1.0000 0 -0.5000 5.0000 0 1.0000 1.8333 5.0000

Page 42: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Ex 6.4-6 p.364

100+200=f1+f4f1+f2=300+200600+400=f2+f3f3+f4=300+500

4

3

2

1

8001000500300

1100011000111001

ffff

xbA

bAx

800200300

0800200300

000011001-0101001

b])rref([A

43

42

41

ffffff

Page 43: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 44: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 45: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 46: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 47: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 48: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 49: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 50: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 51: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 52: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 53: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 54: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 55: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…

Page 56: 第 6 章   線性代數方程式 Linear Algebraic Equations

Puff! The magic dragon, live by the sea…