Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Q1a
! Creating a program to solve a numerical by gauss elimination method (forward substitution) Real a(10,10),b(10),x(10),pivot,sum Integer i,j,k,n WRITE(*,*)'enter here the dimensions of the matrix' Read(*,*)n Write(*,*)'enter here the coefficients of the given equations in matrix form ,inputting the values row wise' Do i=1,n Read(*,*)(a(i,j),j=1,n),b(i) !read the matrix End do Write(*,*)'So the matrix form by the given coefficient of the equations is' ! Entered matrix and vector Do i=1,n WRITE(*,*) (a(i,j),j=1,n) End do Write(*,*)' hence the B vector is' Do i=1,n Write(*,*)b(i) End do Do i=n,1,-1 ! lower triangle matrix Do j=i-1,1,-1 pivot=a(j,i)/a(i,i) Do k=1,n a(j,k)=a(j,k)-pivot*a(i,k) End do b(j)=b(j)-pivot*b(i) End do End do Write(*,*)' and the lower triangular matrix right after gauss elimination' Do i=1,n Write(*,*)(a(i,j),j=1,n) End do Write(*,*)'Corresponding B vector:' Do I=1,n WRITE(*,*) b(i) End do Do i=1,n ! Forward substitution sum=0 Do j=1,n-1 sum=sum+a(i,j)*x(j) End do x(i)=(b(i)-sum)/a(i,i) End do Write(*,*)' So The solution will be as follows :' Do i=1,n WRITE(*,10)i,x(i) End do 10 format('X(',I3,')=',f10.5) Stop End
run
|
edit
|
history
|
help
0
5
Factorial problem
A_04 SIMPSON'S RULE(3(I))
Example 45 175 page
I m
A_01 FALSE_POSITION_METHOD
A_02 GUASSIAN ELIMINATION METHOD
Random walk by using Monte Carlo method
points on,inside circle
Sum of inverse square series