Вы находитесь на странице: 1из 41

The Finite Element Method

Matrix algebra

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Matrix Algebra
A matrix is an m x n array of numbers arranged in m rows and n columns. m = n A square matrix. m = 1 A row matrix. n = 1 A column matrix. aij Element of matrix a row i, column j

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Matrix Operations
Multiplication of a matrix by a scalar.
[a] = k [c] aij = kcij

Addition of matrices.
Matrices must be of same order (m x n) Add them term by term [c] = [a] +[b] cij = aij + bij

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Matrix Operation
Multiplication of two matrices
If [a] is m x n then [b] must have n rows [c] = [a] [b]

cij = a iebej
e =1

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Matrix Operations
Transpose of a matrix:
Interchange of rows and columns

aij = aji

If [a] is m x n then [a]T is n x m

If [a] = [a]T then [a] is symmetric.


[a] must be a square matrix

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Matrix Operations
The identity matrix (or unit matrix) is denoted by the symbol [I]:
[a][I] = [I][a] = [a]

1 0 [I ] = 0

0 1 0

0 0 1

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Matrix Operations
The inverse of a matrix is such that:

[a ][a ]
The Finite Element Method Computational Mechanics, AAU, Esbjerg

= [I ]

Matrix algebra

Matrix Operations
Differentiating a matrix:

daij d [a] = dx dx
The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

Matrix Operations
Differentiating a matrix:
a11 a12 x 1 U = [x y] 2 a21 a22 y U x a11 a12 x = U a21 a22 y y
The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

Matrix Operations
Integrating a matrix:

[a]dx = a ij dx

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

The Inverse of a Matrix


Need to find the determinant

a = determinant of matrix
Need to find the co-factors of [a]

[a]

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Cofactors
Cofactors of [aij] are given by:
C ij = ( 1) i + j d where matrix d is the first minor of a ij and is matrix [ a ] with row i and column j deleted.

Then :

[a ij ]

[C ] =
a

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Cramers Rule
[a ] { x }
or in in d e x = {c} n o ta tio n :
j

L et

j= 1

a ij x

= ci m a tr ix [a ] by {c}.

m a tr ix [d (i) ] b e

w ith c o lu m n

i repaced T h en : d (i) a

xi =
The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Example:
Consider the following equations: x1 + 3x 2 2x 3 = 2 2x1 4x 2 + 2x 3 = 1 4x 2 + x 3 = 3

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Example:
In matrix form : 1 3 2 x 1 2 2 4 2 x 2 = 1 4 1 x 3 3 0
The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

Solving:
2 3 2 2 41 = = 4.1 2 10 1 2 1 1 4 x1 = d( 1 ) a = 3 1 2 0
The Finite Element Method Computational Mechanics, AAU, Esbjerg

4 3 4 4
Matrix algebra

Solving:
1 2 2 2 0 = x2 = 1 a 2 0
The Finite Element Method Computational Mechanics, AAU, Esbjerg

1 3 3 4 4

2 1 = 1.1 2 2 1

d( 2)

Matrix algebra

Solving:
1 2 0 = x3 = 1 a 2 0
The Finite Element Method Computational Mechanics, AAU, Esbjerg

4 1 4 3 = 1.4 3 2 4 4 2 1

( 3)

Matrix algebra

Inversion

[a ]{x} = {c} 1 1 [a ] [a ]{x} = [a ] {c} 1 [ I ]{x} = [a ] {c} 1 {x} = [a ] {c}


The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

Example
1 3 2 x 1 2 2 4 2 x 2 = 1 4 1 x 3 3 0

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Example
1.1 0.2 2 4.1 x 1 1.2 0.1 0.2 1 = 1.1 x 2 = 0. 2 x 3 0.8 0.4 0.2 3 1.4

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Solving:
1 2 x3 = d( 3 ) a = 0 1 2 0
The Finite Element Method Computational Mechanics, AAU, Esbjerg

4 1 4 3 4 4 3 2 2 1 = 1.4

Matrix algebra

Gaussian Elimination
General System of n equations with n unknowns:

a 11 a 21 M a n1

a 12 a 22 M an2

K a1n x 1 c1 K a2n x 2 c 2 = M M M K a nn x n c n
Matrix algebra

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Steps in Gaussian Elimination


Eliminate the coefficient of x1 in every equation except the first one. Select a11 as the pivot element.
Add the multiple -a21/ a11 of the first row to the second row. Add the multiple -a31/ a11 of the first row to the third row. Continue this procedure through the nth row

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

After this Step:


a 11 0 M 0 a 12 a 22 M a 2 n K a1n x 1 c1 K a n x 2 c 2 2 = M M M K a x n c n nn

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Steps in Gaussian Elimination


Eliminate the coefficient of x2 in every equation below the second one. Select a22 as the pivot element.
Add the multiple -a 32/ a 22 of the second row to the third row. Add the multiple -a 42/ a 22 of the second row to the fourth row. Continue this procedure through the nth row
The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

After This Step:


a 11 0 0 M 0 a 12 a 22 0 M 0 a 13 a 23 a 33 M a 3 n a1n x1 c1 L a n 2 x 2 c 2 K a n = 3 M M M x n c n K a nn K
Matrix algebra

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Steps in Gaussian Elimination


Repeat the process for the remaining rows until we have a triangularized system of equation.
a11 a12 0 a 22 0 0 0 0 M M 0 0 a13 a23 a33 0 M 0 a14 a24 a34 a 44 M 0 L L L L L x 1 c1 x c 2 2 x 3 c3 = x4 c4 M M M n 1 n 1 a nn x n cn a1n a2n a3n an 4

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Solve Using Back-substitution


cn 1 n xn = n 1 a nn 1 xi = a ii
n a 1, n + 1 a ir x r r = i +1

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Example

2 2 1 x 1 9 2 1 0 x = 4 2 x 6 1 1 1 3
The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

Solving:
Eliminate the coefficient of x1 in every equation except the first one. Select a11 =2 as the pivot element.
Add the multiple -a21/ a11 = -2/2 = -1 of the first row to the second row. Add the multiple -a31/ a11 = -1/2=-0.5 of the first row to the third row.

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Step 1

1 x1 9 2 2 0 1 1 x = 5 2 x 1.5 0 0 0 .5 3
The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

Steps in Gaussian Elimination


Eliminate the coefficient of x2 in every equation below the second one. Select a22 as the pivot element. (Already done in this example.)

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Step 2

1 x1 9 2 2 0 1 1 x = 5 2 x 1.5 0 0 0 .5 3
The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

Solve Using Back-substitution


c3 x3 = a33

(3 2 ) = 3 = (1 2 )

x2

( 5 + 3) = 2 =
1

x2

(9 2( 2) 3) = 1 =
2
Matrix algebra

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Gauss-Seidel Iteration
Write equations in form : 1 (c1 a12 x 2 a13 x 3 L a1n xn ) x1 = a11 1 (c 2 a 21x1 a 23 x 3 L a 2n xn ) x2 = a 22 M 1 (cn an1x1 an 2 x 2 L an .n 1xn 1 ) xn = a nn
The Finite Element Method Computational Mechanics, AAU, Esbjerg Matrix algebra

Gauss-Seidel Iteration
Assume a set of initial values for unknowns. Substitute into RHS of first equation. Solve for new value of x1 Use new value of x1and assumed values of other xs to solve for x2 in second equation. Continue till new values of all variables are obtained. Iterate until convergence.

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Example
4x1 x 2 x1 + 4x 2 x 3 x 2 + 4x 3 x 4 =2 =5 =6

x 3 + 2x 4 = 6 x1 = 1 x2 = 1 x3 = 1 x 4 = 1

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Example
x1 = 1 x2 = 1 x3 = 1 x4 = 1

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

(5 + x1 + x 3 ) = 1 4 (5 + 3 4 + 1) = 1.68 4 ( 2 + x 3 ) = 1 2 ( 2 + 1.67 ) = 0.16 2


Matrix algebra

(6 + x 2 + x 4 ) = 1 4 (6 + 1.68 + ( 1)) = 1.672 4

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Example
x1 = 1 x2 = 1 x3 = 1 x4 = 1

(2 + x 2 ) = 1 4 (2 + 1.68) = 0.922 4

(5 + x1 + x 3 ) = 1 4 (5 + 0.922 + 1.672) = 1.899 4 ( 2 + x 3 ) = 1 2 ( 2 + 1.944) = 0.0.28 2

(6 + x 2 + x 4 ) = 1 4 (6 + 1.899 + ( 0.16)) = 1.944 4

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Iteration x1

0 1 2 3 4 Exact
4

0.5 0.75 0.922 0.975 0.988 1.0

x2 1.0 1.68 1.899 1.979 1.9945 2.0

x3 1.0 1.672 1.944 1.988 1.9983 2.0

x4 -1.0 -0.16 -0.028 -0.006 -0.0008 0.0

The Finite Element Method Computational Mechanics, AAU, Esbjerg

Matrix algebra

Вам также может понравиться