Sie sind auf Seite 1von 6

T u j u a n

P r a k t ik u m

T U

J U

A

M e t o d e

N

D

B A

A

N

B

D

N u m e r ik |

L a b o r a t o r i u m

I

A

S A

R

T E O

R

I

S i s t e m

K o m

p u t e r

1

.

M

e n g u a s a i

i t e r a s i

G

a u s s - S i e d e l

y a n g

d i g u n a k a n

d a l a m

k o m

p u t a s i

n u m

e r i k

.

2

.

M

e m

a h a m

i

a l g o r i t m

a

p e m

r o g r a m

a n

u n t u k

m

e r a n c a n g

p r o g r a m

m

e t o d e

G

a u s s - S i e d e l

y a n g

a d a

 

d a l a m

k o m

p u t a s i

n u m

e r i k

.

3

.

M

e n e r a p k a n

a l g

o r i t m

a

u n t u k

p e r a n c a n g a n

d a n

p e m

b u a t a n

p r o g r a m

m

e t o d e

G

a u s s

- S i e d e l .

D

a s a r

T e o r i

 
 

M

e t o d e

G

a u s s - S i e d e l

d i g u n a k a n

u n t u k

m

e n y e l e s a i k a n

S i s t e m

P e r s a m

a a n

L i n e a r

( S P L )

b

e r u k u r a n

b e s a r

d a n

p r o p o r s i

k o e f i s i e n

n o l n y a

b e s a r ,

s

e p e r t i

s i s t e m

- s i s t e m

y a n g

b a n y a k

d i t e m

u k a n

d

a l a m

s i s t e m

p e r s a m

a a n

d i f e r e n s i a l .

M

e t o d e

i t e r a s i

 

G

a u s s - S i e d e l

d i k e m

b a n g k a n

d a r i

g a g a s a n

m

e t o d e

i t e r a s i

p a d a

s o l u s i

p

e r s a m

a a n

t a k

l i n i e r .

 
 

T

e k n i k

i t e r a s

i

j a r a n g

d i g u n a k a n

u n t u k

m

e n y e l e s a i k

a n

S P L

b e r u k u r a n

k e c i l

k a r e n a

m

e t o d e -

m

e t o d e

l a n g s u n g

s

e

p

e r t i

m

e t o

d e

e l i m

i n a s

i

G

a u s

s

l e b i h

e f i s i e

n

d a r i p a d a

m

e t o

d e

i t e r a t i f .

A

k a n

t e t a

p i ,

u

n t u k

S P L

b e r u k u r a n

b e s a r

d e n g a n

p r e s e n t a s e

e l e m

e n

n o l

p a d a

m

a t r i k s

k o

e f i s i e

n

b e s a r ,

t e k n i k

i t e r a s i

l e b i h

e f i s i e n

d a r i p a d a

m

e t o d e

l a n g s u n g

d a l a m

h a l

p e n g g u n a a n

m

e m

o r i

k o m

p u t e r

m

a u p u n

w

a k t u

k

o m

p u t a s i .

D

e n g a n

 

m

e t o d e

i t e r a s i

G

a u s s - S i e d e l

s e s a t a n

p e m

b u l a t a n

d a p a t

d i p e r k e c i l

k a r e n a

d a p a t

m

e n e r u s k a n

i t e r a s i

 

s a m

p a i

s o l u s i n y a

s e t e l i t i

m

u n g k i n

s e s u a i

d e n g a n

b a t a s

s e s a t a n

y a n g

d i p e r b o l e h k a n .

 

S u

a t u

s i s t e m

p e r s a m

a a n

l i n i e r

 

t e r d i r i

a t a s

s

e j u m

l a h

b e r h i n g g a

p e r s a m

a a n

l i n i e r

d

a l a m

s

e j u m

l a h

b e r h i n g g a

 

v a r i a b e l .

M

e n y e l e s a i k a n

s u

a t u

s i s t e m

p e r s a m

a a n

l i n i e

r

a d a l a h

m

e n c a r i

n i l a

i - n i l a

i

v

a r i a b e l

y a n g

b e l u m

d i k e t a h u i

y a n g

m

e m

e n u h i

s e m

u a

p e r s a m

a a n

l i n i e r

y a n g

d i b e r i k a n .

 

A

l g o r i t m

a

:

 

a s u k k a n

1 m

.

M

 

a t r i k

A

,

d a n

v e k t o r

B

b e s e r t a

u k u r a n n y a

n

2 b a t a s

.

T e n t u k a n

m

3 t o l e r a n s

.

T e n t u k a n

4 n i l a i

.

T e n t u k a n

a w

5 .

S i m

p a n

x i

d a l a m

a k s i m

u m

i t e r a s i

m

a

x _ i t e r

i

e r r o r

ε

a l

d a r i

x i ,

u n t u k

i = 1

s / d

n

s i ,

u n t u k

i = 1

s / d

n

6 .

7 .

8 .

U

n t u k

I t e r a s i

B i l a

d a r i

i = 1

i t e r a s i

s / d

n

h i t u n g

:

i t e r a s i +

1

l e b i h

d

a r i

m

a x _ i t e

r

a d a l a h

x i

e b i h d a r i m a x _ i t e r

p e n y e l e s a i a n n y a

a x _ i t e r a d a l a h x i p

(

a t a u

t i d a k

u n t u k

i = 1

)

|

t e r d a p a t

e i < ε

u n t u k

i = 1

s / d

n

s / d

n .

B i l a

t i d a k

m

a k a

u l a n g i

|

m

a k a

p r o s e s

l a n g k a h

( 5 )

d i h e n t i k a n

P r a k t ik u m

M

e t o d e

 

N u

m e

r ik |

L a b o r a t o r i u m

S i s t e m

K o m

p u t e r

 

B

A

B

I I

A

L A

T

D

A

N

B A

H

A

N

I I . 1 .

A

l a t

d a n

B a h a n

1 S . a t u u n i t P e r s o
1 S
.
a t u
u n i t
P e r s o n a l
C o m
p u t e r
2 B l o o d s h e d
.
D
e v - C + +
I D
E
d a n B a h a n 1 S . a t u u n
d a n B a h a n 1 S . a t u u n
d a n B a h a n 1 S . a t u u n
 

P r a k t ik u m

M e t o d

e

N u m e r ik |

L a b o r a t o r i u m

S i s t

e m

K o

m

p u t e r

 

B A

B

I I I

 

P R

O

S E

D

U

R

P E R

C

O

B A

A

N

P r o s e d u r

U

m

u m

1 e n u l i s

.

U

n t u k

m

p r o g r a m

b a r u

c

a r a n y a

t e k

a n

C T R

L + N

a t a u

p i l i h

 

N

E W

l a l u

k l i k

S o

u r c e

F i l e

t e r l e b i h

d

a h u l u

s e b e l u m

m

e n g e t i k

p r o g r a m

.

2 K

.

e t i k k a n

p r o g r a m

a n d a .

 

3 .

S i m

p a n

p r o g r a m

 

d e n g a n

m

e n e k a n

t o m

b o l

C

T

R L + F

1

2 ,

p i l i h

S a v e

k e m

u d i a n

p a d a

k o t a k

d i a l o g

y

a n g

m

u n c u l

k e t i k k a n

n a m

a

p r o g r a m

p a d a

t e m

p a t

y a n g

t e r s e d i a

 

m

i s a l n

y a

C

o n t o h 1 . c p p ,

k e m

u d i a n

k l i k

S a v e

a t a

u

t e k a n

< E

N

T E R >

 

4 J a l a n k a n

.

p r o g r a m

d e n g a n

t e r l e

b i h

d a h u l u

m

e l a k u k a n

k o

m

p i l a s i .

 

H

a l

i n

i

d a p a t

d i l a k u k a n

s e k a l i g u s

d

e n g a n

m

e n g k l i k

C

o m

p i l e

&

R

u n

( F

9 )

p a d a

m

e n u b a r

a t a u

l a n g s u n g

m

e n e k a n

F 9

p a d a

k e y b o a r d .

5 k o m

.

B

i l a

p i l a s i

t i d a

k

b e r h a s i l

d a n

m

e m

u n c u l k a n

p e s a n

e r r o

r ,

p e r i k s a

k e m

b a l i

k o d e

p r o g r a m

y a n g

a

d a

k e m

u d i a n

p e r b a i k i

k e s a l a h a n

d a n

l a k u k a n

k e m

b

a l i

l a n g k a h

3

d a n

4 .

6 n t u k

.

U

m

e m

b u k a

a r s i p

y a n g

a d a ,

g u n a k a n

O

P E N

a t a u

t e k a n

C T R L + O

p a d a

k e y b o a r d .

 
g a d a , g u n a k a n O P E N
g a d a , g u n a k a n O P E N
 

P r a k t ik u m

M e t o

d e

N u m e r ik |

L a b o r a t o r i u m

S i s t e m

K o m

p u t e r

 

B

A

B

I V

 
 

A

N

A

L I S A

P E R

C

O

B A

A

N

B e r i k u t

i n i

s o u r c e

c o d e

p r o g r a m

u n t u k

m

e t o d e

G

a u s s

S e i d e l l

 

#include <iostream> #include <stdio.h> #include <stdlib.h>

#include <conio.h>

using namespace std;

int

main()

{

float

float toleransi; int batas;

x,

y,

z;

printf("Batas Iterasi : ");scanf("%d", &batas);

printf("Error Toleransi : ");scanf("%f", &toleransi);

printf("Harga Awal X : ");scanf("%f", &x); printf("Harga Awal Y : ");scanf("%f", &y); printf("Harga Awal Z : ");scanf("%f", &z);

printf(" \ n"); printf(" no. \ t nilai x \ t nilai y \ t nilai z \ n"); printf(" ------------------------------------------------------- \ n");

printf("awal%15f%15f%15f \ n", x, y, z);

double selisihX_lama=1, selisihY_lama=1, selisihZ_lama=1;

for(int

< batas; i++){

double

double checkX, checkY, checkZ;

double selisihX, selisihY, selisihZ; double Xnext, Ynext, Znext;

i

=

1;

i

Cx,

Cy,

Cz;

Xnext

=

(13

-

y

+

z)/4;

 

Ynext

=

(

8

+ Xnext

-

z)/5;

Znext

=

(

2

+ (2*Xnext)

- Ynext)/6;

+ z)/4;   Ynext = ( 8 + Xnext - z)/5; Znext = ( 2 +
+ z)/4;   Ynext = ( 8 + Xnext - z)/5; Znext = ( 2 +

P r a k t ik u m

M e t o d e

N u m e r ik |

L a b o r a t o r i u m

S i s t e m

K o m

p u t e r

selisihX = Xnext

- Cx = selisihX/selisihX_lama; checkX = (Cx/(1 - Cx))*selisihX;

if((checkX <= toleransi)&&(checkX >= - (toleransi))){ -

x ;

y ; Cy = selisihY/selisihY_lama;

checkY = (Cy /(1 - Cy))*selisihY; if((checkY <= toleransi)&&(checkY >= - (toleransi))){

selisihY = Ynext

selisihZ = Znext

Cz = selisihZ/selisihZ_lama; checkZ = (Cz/(1 - Cz))*selisihZ; if((checkZ <= toleransi)&&(checkZ >= -

-

z

;

(toleransi))){

printf("%4d%15.10f%15.10f %15.10f \ n", i,

Xnext, Ynext, Znext);

printf("======================================================== \ n"); printf("root didapat pada iterasi ke - %d", i);

}

else

break; { selisihZ_lama = selisihZ;

}

} { selisihY_lama = selisihY;

else

}

} { selisihX_lama = selisihX;

else

x=Xnext;

y=Ynext;

z=Znext; printf("%4d%15.10f%15.10f%15.10f%15.10f \ n", i, Xnext, Ynext, Znext, checkX);

}

}

printf(" \ n");

system ("pause"); return 0;

}

O

u t p u t

i, Xnext, Ynext, Znext, checkX); } } printf(" \ n"); system ("pause"); return 0; } O
i, Xnext, Ynext, Znext, checkX); } } printf(" \ n"); system ("pause"); return 0; } O
i, Xnext, Ynext, Znext, checkX); } } printf(" \ n"); system ("pause"); return 0; } O

P r a k t ik u m

M e t o d e

N u m e r ik |

L a b o r a t o r i u m

S i s t e m

K o m

p u t e r

 

B A

B

V

 

K

E S I M

P U

L A

N

B

e r d a s a r k a n

p e n u r u n a n

a l g o

r i t m

a

d a n

p e n e r a p a n

d a l a m

K

a s u s

d a p a t

d i p e r o l e h

k e s i m

p u l a n

s e b a g a i

b e r i k u t

:

.

1 e t o d e

.

M

G

a u s s - S e i d e l l

d a p a t

d i g u n a k a n

d a l a m

b e r b a g a i

k a s u s ,

s e p e r t i

p e

r m

a s a l a h a n

p

e n e n t u a n

b a n y a k

p r o d u k

 

b e r d a s a r k a n

p e r s e d i a a n

b a h a n

d a n

p

e r m

a s a l a h a n

a l i r a

n

p

a n a s

p a d a

p

l a t

b a j a .

2 P e n g g u n a a n

.

m

e t o d e

i t e

r a

s i

G

a u s s - S e i d e l

g a l a t

p e m

b u l a t a n n y a

d a p a t

d i p e r k e c i l .

H

a l

i n

i

d i k a r e n a k a n

i t e r a s i n y

a

d a p a t

m

e n e r u s k a n

s a m

p a i

s o l u s i n y a

b e n a r - b e n a r

t e l i t i

s e s u a i

d e n g a n

y a b e n a r - b e n a r t e l
y a b e n a r - b e n a r t e l

b a t a s

g a l a t

y a n g

d i p e r b o l e h k a n

.