jacobi method
TRANSCRIPT
JACOBI METHOD
BASIC IDEA ON JACOBI METHOD
Convert the system: into the equivalent system:
dCxx
3333132131
2323122121
1313212111
bxaxaxabxaxaxabxaxaxa
33
32
33
321
33
313
22
23
22
231
22
212
11
13
11
132
11
121
abx
aax
aax
abx
aax
aax
abx
aax
aax
BAx
BASIC IDEA ON JACOBI METHOD
Generate a sequence of approximation:
,..., )2()1( xx dCxx kk )1()(
JACOBİ İTERATİON METHOD
nnnnnn
nn
nn
bxaxaxa
bxaxaxabxaxaxa
2211
22222121
11212111
0
02
01
0
nx
xx
x
)(1 01
02121
11
11 nn xaxab
ax
)(1 02
0323
01212
22
12 nn xaxaxab
ax
)(1 011
022
011
1 nnnnnn
nnn xaxaxab
ax
å å
1
1 1
1 1 i
j
n
ij
kjij
kjiji
ii
ki xaxab
ax
JACOBI METHOD WITH EXAMPLES
Consider the two-by-two system
Start with
Simultaneous updatingNew values of the variables are not used until a New iteration step is begun
4113
413
21
4113
413
21
)1()2(
)1()2(
xy
yx
6262
yxyx
321
321
xy
yx
)1(x
)1(y
)2(y
)2(x
JACOBI METHOD Con’t
8133
8113
21
8133
8113
21
)2()3(
)2()3(
xy
yx
JACOBI METHOD : EXAMPLE 1
The set of equations:
0 20i12i 5i- 2- 12i -20i 0i
10 5i -0i 9i
321
321
321
Let us write for i1, i2 and i3 as
)(.
)()(
3i60000i0.2500 /2012i i5i20.6000i0.1000- /2012i 2-i10.5556i1.1111 /95i 10i
21313
232
231
Let us make an initial guess as i1 = 0.0; i2 =0.0 and i3 = 0.0
First iteration results: i1 = 1.1111; i2 =-0.1000 and i3 = 0.0
JACOBI METHOD : EXAMPLE 1
First iteration results: i1 = 1.1111; i2 =-0.1000 and i3 = 0.0
Second iteration results: i1 = 1.1111; i2 =-0.1000 and i3 = 0.22
Third iteration results: i1 = 1.23; i2 = 0.03 and i3 = 0.22 Fourth iteration results: i1 = 1.23 ; i2 = 0.03 and i3 = 0.33
Fifth iteration results: i1 = 1.29; i2 = 0.1 and i3 = 0.33 Sixth iteration results: i1 = 1.29; i2 = 0.1 and i3 = 0.38
)(.
)()(
3i60000i0.2500 /2012i i5i20.6000i0.1000- /2012i 2-i10.5556i1.1111 /95i 10i
21313
232
231
JACOBI METHOD : EXAMPLE 2Consider the following set of equations.
1511
256
83102
311210
432
4321
4321
321
xxxxxxxxxxx
xxx
Convert the set Ax = b in the form of x = Tx + c.
815
81
83
1011
101
101
51
1125
113
111
111
53
51
101
324
4213
4312
321
xxx
xxxx
xxxx
xxx
JACOBI METHOD : EXAMPLE 2
815
81
83
1011
101
101
51
1125
113
111
111
53
51
101
)0(3
)0(2
)1(4
)0(4
)0(2
)0(1
)1(3
)0(4
)0(3
)0(1
)1(2
)0(3
)0(2
11
xxx
xxxx
xxxx
xxx )(
.0and0,0,0 )0(4
)0(3
)0(2
)0(1 xxxx
815(0)
81(0)
83
1011(0)
101(0)
101(0)
51
1125(0)
113(0)
111(0)
111
53(0)
51(0)
101
)1(4
)1(3
)1(2
11
x
x
x
x )(
8750.1
1000.1
,2727.2
,6000.0
)1(4
)1(3
)1(2
)1(1
x
x
x
x
JACOBI METHOD : EXAMPLE 2
815
81
83
1011
101
101
51
1125
113
111
111
53
51
101
)1(3
)1(2
)2(4
)1(4
)1(2
)1(1
)2(3
)1(4
)1(3
)1(1
)2(2
)1(3
)1(2
21
xxx
xxxx
xxxx
xxx )(
815
81
83
1011
101
101
51
1125
113
111
111
53
51
101
)1(3
)1(2
)(4
)1(4
)1(2
)1(1
)(3
)1(4
)1(3
)1(1
)(2
)1(3
)1(21
kkk
kkkk
kkkk
kk(k)
xxx
xxxx
xxxx
xxx
JACOBI METHOD : EXAMPLE 2Results:
iteration 0 1 2 3 0.0000 0.6000 1.0473 0.9326
0.0000 2.2727 1.7159 2.0530
0.0000 -1.1000 -0.8052 -1.0493
0.0000 1.8750 0.8852 1.1309
)( kx1
)( kx2)( kx3)( kx4
JACOBI METHOD : EXAMPLE 3Solve the linear system by Jacobi’s method
4x -y + z = 7
4x -8y+ z = -21
-2x + y + 5z = 15.
Solution
From the system of linear equation we get:
.5
yx215z
,8
zx421y
,4
zy7x
1n1nn
1)(n1)(nn
1)(n1)(nn
If we start with (x0, y0, z0) = (0, 0, 0),
.5
yx215z
,8
zx421y
,4
zy7x
.5
yx215z
,8
zx421y
,4
zy7x
1n1nn
1)(n1)(nn
1)(n1)(nn
zn yn xn n
0 0 0 0
3 2.625 1.75 1
3.175 3.875 1.656 2
2.887 3.85 1.925 3
3 3.948 1.99 4
2.997 3.995 1.99 5
2.997 3.995 1.9995 6
The iteration appears to converge to the solution (2, 4, 3)
JACOBI METHOD:EXAMPLE 3
JACOBI METHOD : EXAMPLE 4
5x – 2y + 3z = -1-3x + 9y + z =22x - y -7z = 3
Solve the linear system by Jacobi’s method
Continue the iterations until two successive approximations are identical when rounded tothree significant digits.To begin, write the system in the form
If we start with (x0, y0, z0) = (0, 0, 0),
.7
yx23z
,9
zx32y
,5
z3y21x
JACOBI METHOD : EXAMPLE 4
PROGRAM OF JACOBI METHOD#include<stdio.h>#include<conio.h>#include<math.h>#define ESP 0.0001#define X1(x2,x3) ((17 - 20*(x2) + 2*(x3))/20)#define X2(x1,x3) ((-18 - 3*(x1) + (x3))/20)#define X3(x1,x2) ((25 - 2*(x1) + 3*(x2))/20)
void main(){ double x1=0,x2=0,x3=0,y1,y2,y3; int i=0; clrscr(); printf("\n__________________________________________\n"); printf("\n x1\t\t x2\t\t x3\n"); printf("\n__________________________________________\n"); printf("\n%f\t%f\t%f",x1,x2,x3); do {
PROGRAM OF JACOBI METHOD y1=X1(x2,x3); y2=X2(x1,x3); y3=X3(x1,x2); if(fabs(y1-x1)<ESP && fabs(y2-x2)<ESP && fabs(y3-x3)<ESP ) { printf("\n__________________________________________\n"); printf("\n\nx1 = %.3lf",y1); printf("\n\nx2 = %.3lf",y2);
printf("\n\nx3 = %.3lf",y3); i = 1; } else { x1 = y1; x2 = y2; x3 = y3; printf("\n%f\t%f\t%f",x1,x2,x3); } }while(i != 1);getch();}
PROGRAM OF JACOBI METHOD
x1 x2 x3
0.000000 0.000000 0.0000000.850000 -0.900000 1.2500001.875000 -0.965000 1.0300001.918000 -1.129750 0.9177502.071525 -1.141812 0.8887372.080686 -1.166292 0.8715762.103449 -1.168524 0.8669882.105223 -1.172168 0.8643762.108606 -1.172565 0.8636532.108930 -1.173108 0.8632552.109434 -1.173177 0.863141__________________________________________
x1 = 2.109
x2 = -1.173
x3 = 0.863
Output:
Thank you.
Presented by: Grishma Maravia