Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Gauss seidal
! solution of linear equations by Gauss-Seidal iteration method real sum,sum1 integer i,j,t dimension a(10,10),b(10),x(10),y(10),d(10) write(*,*)'Enter the dimension of the system' read (*,*) n write(*,*)'Enter the element of the A(row wise)' do i=1,n read(*,*) (a(i,j),j=1,n),b(i) enddo Do i=1,n ! Initial gauss values x(i)=0 end do do i=1,n s=0 max=abs(a(i,i)) Do j=1,n s=s+a(i,j) max2=abs(s) End do p=abs(max2-max) End do 10 do i=1,n y(i)=x(i) sum=b(i) do j=1,n if (i.eq.j) then else sum=sum-a(i,j)*x(j) endif enddo x(i)=sum/a(i,i) if (abs(x(i)-y(i)).lt.0.0001) then ! it chack correction upto six decimal place d(i)=1 else d(i)=0 endif enddo sum1=0 do i=1,n sum1=sum1+d(i) end do if (sum1.eq.n) then goto 40 else t=t+1 goto 10 endif 40 write(*,*)' THE SOLUTION VECTOR ARE :' Write(*,*)(x(i),i=1,n) Write(*,*)' SOLUTIONS CORRECTED UPTO THREE DECIMAL PLACE ARE:' Do i=1,n write(*,60)i,x(i) End do 60 format('x(',I2,')=',f5.2) write(*,*)'NUMBER OF ITERATIONS =',t stop end
run
|
edit
|
history
|
help
0
Ashish.txt
Q5
Bissection Method
Practice 2(I) second time
euler-cromer
DO WHILE DO
Rvc
first
Exercise 02
Fixed point for several variables