Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Linear Algebra: Direct Solutions to Linear Systems of Algebraic Equations, Slides of Numerical Methods in Engineering

An overview of direct solutions to linear systems of algebraic equations, including cramer's rule and gauss elimination. Topics covered include the efficiency of direct procedures versus indirect procedures, the process of finding the determinant using expansion by cofactors, and the triangularization and backward substitution procedures. The document also discusses the advantages of banded matrices and the savings on storage and computations for banded matrices.

Typology: Slides

2011/2012

Uploaded on 02/20/2012

damyen
damyen 🇺🇸

4.4

(27)

274 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CE 341/441 - Lecture 2 - Fall 2004
p. 2.1
LECTURE 2
DIRECT SOLUTIONS TO LINEAR SYSTEMS OF ALGEBRAIC EQUATIONS
Solve the system of equations
The solution is formally expressed as:
AXB=
a11,a12,a13,a14,
a21,a22,a23,a24,
a31,a32,a33,a34,
a41,a42,a43,a44,
x1
x2
x3
x4
b1
b2
b3
b4
=
XA1 B=
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download Linear Algebra: Direct Solutions to Linear Systems of Algebraic Equations and more Slides Numerical Methods in Engineering in PDF only on Docsity!

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

LECTURE 2DIRECT SOLUTIONS TO LINEAR SYSTEMS OF ALGEBRAIC EQUATIONS • Solve the system of equations

  • The solution is formally expressed as:

A

X

B

a

1 1

,^

a

1 2

,^

a

1 3

,^

a

1 4

,

a

2 1

,^

a

2 2

,^

a

2 3

,^

a

2 4

,

a

3 1

,^

a

3 2

,^

a

3 3

,^

a

3 4

,

a

4 1

,^

a

4 2

,^

a

4 3

,^

a

4 4

,

x

1 x

2 x

3 x

4

b

1 b

2 b

3 b

4

X

A

1

B

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

  • Typically it is more efficient to solve for

directly without solving for

since finding

the inverse is an expensive (and less accurate) procedure

  • Types of solution procedures
    • Direct Procedures
      • Exact procedures which have infinite precision (excluding roundoff error)• Suitable when

is relatively fully populated/dense or well banded

  • A predictable number of operations is required
    • Indirect Procedures
      • Iterative procedures• Are appropriate when

is

  • Large and sparse but not tightly banded• Very large (since roundoff accumulates more slowly)
    • Accuracy of the solution improves as the number of iterations increases

X

A

1

A

A

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

where

= specified value of= specified value of

minor

= determinant of the sub-matrix obtained by deleting the

i

th

row and the

j

th

column

  • Procedure is repeated until

matrices are established (which has a determinant by

definition):

I

i

J

j

cof

a

i

j ,

i^

j

minor a

i

j ,

a

i

j ,

×

A

a

1 1

,^

a

1 2

,

a

2 1

,^

a

2 2

,

a

1 1

,^

a

2 2

,^

a

2 1

,^

a

1 2

,

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

Example • Evaluate the determinant of

A

det

A

[

]

A

a

1 1

,^

a

1 2

,^

a

1 3

,

a

2 1

,^

a

2 2

,^

a

2 3

,

a

3 1

,^

a

3 2

,^

a

3 3

,

det

A

[

]

a

1 1

,^

1

1

(

)

a

2 2

,^

a

2 3

,

a

3 2

,^

a

3 3

,

a

1 2

,^

1

2

(

)

a

2 1

,^

a

2 3

,

a

3 1

,^

a

3 3

,

a

1 3

,^

1

3

(

)

a

2 1

,^

a

2 2

,

a

3 1

,^

a

3 2

,

det

A

[

]

a

1 1

,^

a

2 2

,^

a

3 3

,^

a

3 2

,^

a

2 3

,

a

1 2

,^

a

2 1

,^

a

3 3

,^

a

3 1

,^

a

2 3

,

a

1 3

,^

a

2 1

,^

a

3 2

,^

a

3 1

,^

a

2 2

,

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

Gauss Elimination - A Direct Procedure • Basic concept is to produce an upper or lower triangular matrix and to then use back-

ward or forward substitution to solve for the unknowns.

Example application • Solve the system of equations• Divide the first row of

and

by

pivot element)

to get

a

1 1

,^

a

1 2

,^

a

1 3

,

a

2 1

,^

a

2 2

,^

a

2 3

,

a

3 1

,^

a

3 2

,^

a

3 3

,

x

1 x

2 x

3

b

1 b

2 b

3

A

B

a

1 1

,

a

'^

1 2

,^

a

'^

1 3

,

a

2 1

,^

a

2 2

,^

a

2 3

,

a

3 1

,^

a

3 2

,^

a

3 3

,

x

1 x

2 x

3

b

'^

1 b

2 b

3

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

  • Now multiply row 1 by

and subtract from row 2

and then multiply row 1 by

and subtract from row 3

  • Now divide row 2 by

pivot element

a

2 1

,

a

3 1

a

'^

1 2

,^

a

'^ 1 3

,

a

'^

2 2

,^

a

'^ 2 3

,

a

'^

3 2

,^

a

'^ 3 3

,

x

1 x

2 x

3

b

'^

1

b

'^

2

b

'^

3

a

'^ 2 2

,

a

'^

1 2

,^

a

'^ 1 3

,

a

2 3

,

a

'^

3 2

,^

a

'^ 3 3

,

x

1 x

2 x

3

b

'^1

b

2

b

'^3

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

  • We can very conveniently solve the

upper triangularized

system of equations

  • We apply a

backward substitution

procedure to solve for the components of

  • We can also produce a lower triangular matrix and use a forward substitution procedure

a

'^ 1 2

,^

a

'^

1 3

,

a

2 3

,

x

1 x

2 x

3

b

'^1

b

2

b

3

X

x

3

b

3

x

2

a

2 3

,^

x

3

b

2

x

2

b

2

a

2 3

,^

x

3

x

1

a

'^ 1 2

,^

x

2

a

'^

1 3

,^

x

3

b

'^1

x

1

b

'^

1

a

'^ 1 2

,^

x

2

a

'^

1 3

,^

x

3

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

  • Number of operations required for Gauss elimination
    • Triangularization• Backward substitution• Total number of operations for Gauss elimination equals

versus

for

Cramer’s rule

  • Therefore we save

operations as compared to Cramer’s rule

Gauss-Jordan Elimination - A Direct Procedure • Gauss Jordan elimination is an adaptation of Gauss elimination in which both elements

above and below the pivot element are cleared to zero

the entire column except the

pivot element become zeroes

  • No backward/forward substitution is necessary

N

(^3)

N

(^2)

O N

3

O N

4

O N

x

1 x

2 x

3 x

4

b

1

b

2

b

3

b

4

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

  • Convert

through Gauss-Jordan elimination

  • However through the manipulations

and therefore

  • The right hand side matrix,

, has been transformed into the inverted matrix

A

I

AA

1

I

A

A

1

I

A

A

I

IA

1

I

A

1

I

I

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

  • Notes:
    • Inverting a diagonal matrix simply involves computing reciprocals• Inverse of the product relationship

A

a

11

a

22

a

33

A

1

a

11

a

22

a

33

AA

1

I

A

1

A

2

A

3

[

]

1

A

3

1

A

2

1

A

1

1

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

  • Notes on banded matrices
    • The advantage of banded storage mode is that we avoid storing and manipulating

zero entries

outside

of the defined bandwidth

  • Banded matrices typically result from finite difference and finite element methods

(conversion from p.d.e.

algebraic equations)

  • Compact banded storage mode can still be sparse (this is particularly true for

large

finite difference and finite element problems)

Savings on storage for banded matrices •

for full storage versus

for banded storage

where

= the size of the matrix and

= the bandwidth

  • Examples:

N

M

full

banded

ratio

6

3

12

9

N

(^2)

NM

N

M

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

Savings on computations for banded matrices • Assuming a Gauss elimination procedure

versus

(full)

(banded)

  • Therefore save

operations since we are not manipulating all the zeros outside

of the bands!

  • Examples:

N

M

full

banded

ratio

O

(6.4x

7

O

(1.6x

5

O

6

3

O

18

O

12

O

6

O N

(^3)

O N M

2

O N

(^2)

M

2

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

Alternative Compact Storage Modes for Direct Methods • Skyline method defines an alternative compact storage procedure for symmetrical

matrices

  • The skyline goes below the last non-zero element in a column^ INSERT FIGURE NO. 123b

a

11

a

12 a

22

a

23 a

33

a

34 a

o^44 a

14

a

o o o^45 a

55

o o a

36 a

46 a

56 a

66

symmetrical

o

Skyline goes above the lastnon-zero element in a column

CE 341/441 - Lecture 2 - Fall 2004

p. 2.

  • Store

all

entries between skyline and diagonal into a vector as follows:

INSERT FIGURE NO. 124 • Accounting procedure must be able to identify the location within the matrix of

elements stored in vector mode in

Store locations of diagonal terms in

o

o

symmetrical A(1)

o

A(3)

A(9)

A(2)

A(5) A(8)

o

o

A(4) A(7)

o

A(15)

A(6)

A(14)

A(11)

A(13)

A(10)

A(12)

A i

A i

MaxA