Você está na página 1de 34

CHENMAT

REPORT
Jacobi Method | Gauss-Seidel Method
BY:
Mark Rosalio M. Delgado
Sofia Aidrianne Marina G. Galindez
Ryan Kenneth L. Lim
Joshua Romel P. Lintag

Jacobi Method
This method is named after Carl Gustav Jacob Jacobi.
There are two assumptions made in the Jacobi method:
1.

2.

The system given below has a unique solution:


a11+ a12x2 + ...a1nxn = b1
a21x1 + a22x2 + ...a2nxn = b2
.
.
.
an1x1 + an2x2 + ...an3xn = bn
a11, a22, ann should all be non-zeros.

Jacobi Method
Short version of Jacobi Method:
STEP 1:
To solve for x1, use equation 1. To solve for x2, use equation 2. To solve for xn, use equation n. Thus giving a
general equation of:
x1 = 1/a11 (b1 - a12x2 + ...a1nxn)
x2 = 1/a22 (b2 - a21x1 + ...a2nxn)
.
.
.
xn = 1/ann (bn - an1x1 + ...an,n-1xn-1)
This will serve as the rewritten equations for the table later.

Jacobi Method
Short version of Jacobi Method:
STEP 2:
For the first iteration, an initial guess x(0) is required. x1, x2 and x3 are set as x(0) and then plugged into the
right side of the rewritten equations to calculate for the approximate values of x1, x2, ... xn.

Jacobi Method
Short version of Jacobi Method:
STEP 3:
For the second iteration, just substitute the first approximate values to the right side of the rewritten
equations and this will give the second approximate values of x1, x2, ... xn .

Jacobi Method
Short version of Jacobi Method:
STEP 4:
Continue to repeat this process until it converges. The iteration can stop if the relative error is less than or
equal to the given tolerance.

Jacobi Method | Matrix


Form
Let Ax = B be a system of n linear equations where,

Then A is split into a diagonal D and its remainder R:

Jacobi Method | Matrix


Form
The solution for x(k+1) is achieved through:

where x(k) and x(k+1) is the iteration and the next iteration of x, respectively. The general formula for xi(k+1) is:

Note: In computing for xi(k+1), each of the elements in x(k) is needed except for itself.

Jacobi Method
Sample Table:
iteration

xi(k)

x2(k)

x3(k)

K=0

K=1
K=2
K=3

rewritten equations:
x1 = 1/a11 (b1 - a12x2 + ...a1nxn)
x2 = 1/a22 (b2 - a21x1 + ...a2nxn)
.
.
xn = 1/ann (bn - an1x1 + ...an,n-1xn-1)

Jacobi Method | Example


solve using Jacobis
method
(short
version)
given:

x1, x2 and x3

5x -

+ 2x = 12

x2

3x + 8x -2x =-25
1

x1

x2

+ 4x =6
3

Jacobi Method | Example


(short version)
xi(k)

Iteration

x2(k)

x3(k)

k=0

k=1

2.4

-3.125

1.5

k=2

1.175

-3.65

1.68125

k=3

0.9975

-3.1453

1.992575

The actual values are

xi

= 1,

x2

= -3,

x3

=2

Jacobi Method | References


1.

Wikipedia. (2016). Jacobi method. Retrieved March 5, 2016, from https://en.wikipedia.org/wiki/Jacobi_method

2.

Jacobi method. Retrieved March 5, 2016, from https://www3.nd.edu/~zxu2/acms40390F12/Lec-7.3.pdf

gauss-seidel Method
- aka liebmann method
- named after Carl friedrich gauss and
philipp ludwig von seidel
matrix of form:
= [c]nx1

[A]nxn [x]nx1

where :
[A] - quotient matrix
[x] solution vector/unknown
[c] - righthand side

gauss-seidel Method vs
use gauss-seidel method?
gaussianwhyelimination
1.computationally more efficient and easier to use for large n
( n matrices with many rows and columns)
2.round off error can be controlled

gauss-seidel Method | step


[A] [x] = [c]
1
nxn

nx1

nx1

write 1st equation in terms of x1


1st eqtn:

a11x1 + a12x2 + . . . + a1nxn = c1


c1 - a12x2 - . . . - a1nxn
x1 =

__________________________________

a11

gauss-seidel Method | step


do the same for x , . . . , x
1
2

th

equation in terms of xi

i th eqtn:
(1 i n)

ai 1x1 + . . . + ai ixi + . . . + ai nxn = ci


ci - ai 1x1 - . . . - ai nxn ci xi = _________________________________________ =
ai i
ai i

ai j xj
_____________________

*i = 1 , . . . ,
n

gauss-seidel Method | step


assume an initial solution
2
[x10 , x20 , . . . , xn0]

gauss-seidel Method | step


substitute the solutions in the equation
3
ci - ai 1x1 - . . . - ai nxn
xi =

___________________________________________

ai i
as you proceed to the next equations, substitute the
most recent values. values get updated after each
substitution, not at the end of every iteration.

gauss-seidel Method | step


continue iterating until | |
4
a

Where:

a - absolute relative approximate error


s - pre-specified tolerance

gauss-seidel Method | step


x
-x
4
i

|ai | =

new

0ld
i
_______________________

x 100 ; i = 1 , . . . , n

xinew
choose maximum |a| for each iteration
check if |a| max s

EXAMPLE
Solve for x1 , x2 , and x3 using Gauss-Seidel Method.
Start from [ x1 x2 x3 ] = [ 1 0 1 ]
Tolerance: 1%

12x1 + 3x2 5x3 = 1


x1 + 5x2 + 3x3 = 28
3x1 + 7x2 + 13x3 = 76

STEP 1: REWRITE
EQUATIONS
x = 1 - 3x + 5x
1

12
x2 = 28 - x1 - 3x3
5
x3 = 76 - 3x1 - 7x2
13

STEP 2-3

STEP 4

GAUSS-SEIDEL LIMITATIONS
From previous example:

(1) 12x1 + 3x2 5x3 = 1


(2) x1 + 5x2 + 3x3 = 28
(3) 3x1 + 7x2 + 13x3 = 76

GAUSS-SEIDEL LIMITATIONS
Interchange eq. 1 and 3:

(1) 3x1 + 7x2 + 13x3 = 76


(2) x1 + 5x2 + 3x3 = 28
(3) 12x1 + 3x2 5x3 = 1

GAUSS-SEIDEL LIMITATIONS
Apply Step 1:

X1 = 76 - 7X2 - 13X3
3
X2 = 28 - X1 - 3X3
5
X3 = 1 - 12X1 - 3X2
-5

GAUSS-SEIDEL LIMITATIONS

DIVERGES!

GAUSS-SEIDEL METHOD
MAY OR MAY NOT
CONVERGE.
HOWEVER...

Gauss-Seidel method
certainly converges if [A] is
DIAGONALLY DOMINANT

HOW TO CHECK DIAGONAL


From
first set of equations:
DOMINANCE

HOW TO CHECK DIAGONAL


DOMINANCE

*The absolute value of the coefficients in the main diagonal must be greater than the sum of
the absolute values of the other elements on the same row. Therefore [A] is diagonally
dominant.

REMEMBER...
If A is diagonally dominant, Gauss-Seidel
method will converge. If A is not diagonally
dominant, Gauss-Seidel may or may not
converge.

REFERENCES
Black, Noel and Moore, Shirley. "Gauss-Seidel Method." From
MathWorld--A Wolfram Web Resource, created by Eric W. Weisstein.
http://mathworld.wolfram.com/Gauss-SeidelMethod.html
N. (2010). Gauss-Seidel Method of Solving Simultaneous Linear
Equations: Example [Motion picture on Youtube]. Youtube.

Você também pode gostar