12.07.2015 Views

Numerical Mathematics - A Collection of Solved Problems

Numerical Mathematics - A Collection of Solved Problems

Numerical Mathematics - A Collection of Solved Problems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

96 NUMERIČKI METODI U LINEARNOJ ALGEBRIIterativni proces suksesivne gornje relaksacije, za dati sistem linearnih jednačina,ima vektorski oblik (videti [1, str. 272])hDx (k) = Dx (k−1) + ω b − C 1 x (k) − (D + C 2 )x (k−1)i (k = 1, 2, . . .),gde je ω relaksacioni množilac, dok je njegov skalarni oblik:a iiˆx (k)ix (k)i= − X jia ij x (k−1)j+ b i ,− x (k−1)i),Odgovarajući kod na FORTRAN jeziku za generisanje prvih deset iteracija (uaritmetici sa običnom preciznošću), startujući sa nula vektorom, ima sledeći oblik:dimension a(4,4),b(4),x(4)open(unit=2, name=’podaci’,status=’unknown’,* access=’sequential’,form=’formatted’)read(2,*) ndo 5 i=1,ndo 5 j=1,n5 read(2,*) a(i,j)read(2,*) (b(i),i=1,n)write(1,35)do 50 korak=1,4omega=0.4*korakwrite(1,40) omegado 10 i=1,n10 x(i)=0do 50 iter=1,10do 25 i=1,ns=b(i)do 20 j=1,nif(i.ne.j) thens=s-a(i,j)*x(j)end if20 continuex(i)=x(i)+omega*(s/a(i,i)-x(i))25 continue50 write(1,30) iter,(x(i),i=1,n)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!