Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Fyyh
! gauss elimination with partial pivoting (backward substitution) Real a(10,10),b(10),x(10),pivot,sum Integer i,j,k,n,p Write(*,*)'enter the dimension of the matrix' Read(*,*)n Write(*,*)'enter the co efficient of the equation in mayrix form,input values row wise' Do i=1,n Read(*,*)(a(i,j),j=1,n),b(i) !read the matrix End do Write(*,*)' matrix form by the coefficient of the eqn is' Do i=1,n !write the matrix Write(*,*)(a(i,j),j=1,n) End do Write(*,*)' and the vector B is' Do i=1,n Write(*,*)b(i) End do Do i=1,n !loop begins max=abs(a(i,i)) !pivoting starts here d=i Do j=i+1,n If(abs(a(j,i)).gt.max)then max=abs(a(j,i)) p=j Do k=1,n !interchange row temp1=a(p,k) a(p,k)=a(d,k) a(d,k)=temp1 End do temp2=b(p) b(p)=b(d) b(d)=temp2 pivot=a(p,d)/a(d,d) Do k=1,n a(p,k)=a(p,k)-pivot*a(d,k) End do b(p)=b(p)-pivot*b(d) Else pivot=a(j,d)/a(d,d) Do k=1,n a(j,k)=a(j,k)-pivot*a(d,k) End do b(j)=b(j)-pivot*b(d) End if End do End do Write(*,*)'trianfle matrix' Do i=1,n Write(*,*)(a(i,j)j=1,n) End do Write(*,*)'corresponding B vector is' Do i=1,n Write(*,*)b(i) End do Do i=n,1,-1 !back sub sum=0.0 Do j=i+1,n sum=sum+a(i,j)*x(j) End do x(i)=(b(i)-sum)/a(i,i) End do Write(*,*)'solutionz of the liner eqn' Do i=1,n Write(*,10)i,x(i) End do 10 format('X(',13,')=',f10.5) Stop End
run
|
edit
|
history
|
help
0
Jánošík 2018
New
G b
A_04 SHOOTING METHOD
A_03 TAYLOR_METHOD
Summation of 1 to 100 square integer namber
Subroutine problem
Forward
A_01 FIXED_POINT_IM(I)
Rand