Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Gauss pivot elimination
! program gause_pivot_elimination DIMENSION A(10,11),X(10) WRITE(*,*)'ENTER THE DIMENSION OF THE SYSTEM' READ(*,*)N WRITE(*,*)'ENTER THE ELEMENT OF A (ROW-WISE)' DO I=1,N READ(*,*)(A(I,J),J=1,N+1) END DO DO 10 K=1,N-1 CALL INTERCHANGE(N,A,K) PIVOT=A(K,K) ! C1 IF(PIVOT.LT.0.00001)THEN ! C1 WRITE(*,*)'RESUFFLE THE EQUATION' ! C1 STOP ! C1 ENDIF DO 20 I=K+1,N FACTOR=A(I,K)/PIVOT DO 30 J=1,N+1 A(I,J)=A(I,J)-FACTOR*A(K,J) 30 CONTINUE 20 CONTINUE 10 CONTINUE ! ****CHECK FOR TRAINGULIZATION***** DO I=1,N WRITE(*,*)(A(I,J),J=1,N+1) END DO ! **** BACK SUBSTITUTIONS***** X(N)=A(N,N+1)/A(N,N) DO 40 K=N-1,1,-1 SUM=0 DO 50 J=K+1,N SUM=SUM+A(K,J)*X(J) 50 CONTINUE X(K)=(A(K,N+1)-SUM)/A(K,K) 40 CONTINUE ! ******RESULT********** WRITE(*,*)'THE SOLUTION VECROT IS' DO I=1,N WRITE(*,60)I,X(I) END DO 60 FORMAT('X(',I2')='F10.5) STOP END !**SUBROUTINE TO FIND THE LARGEST NUMBER AS WELL AS THE ! INTERCHANGING OF THE ROWS !*****TO FIND THE LARGEST ELEMENT IN THE COLUMN***** SUBROUTINE INTERCHANGE(N,A,K) DIMENSION A(10,11) INTEGER ROW ROW=K LARGE=ABS(A(K,K)) DO 5 I=K+1,N IF(ABS(A(I,K)).GT.ABS(A(K,K))) THEN LARGEl=ABS(A(I,K)) ROW=I ENDIF 5 CONTINUE ! ****INTERCHANGING THE I'TH ROW WITH THE K'TH ROW****** IF (ROW.NE.K)THEN DO 6 J=1,N+1 TEMP=A(ROW,J) A(ROW,J)=A(K,J) A(K,J)=TEMP 6 CONTINUE ENDIF RETURN END ! WE CAN DO THIS PIVOT BY USING "C1" COMMENT ! WITH OUT USING SUBROUTINE
run
|
edit
|
history
|
help
0
Jacobi
A_02 JACOBIAN NEWTON'S ITERATIVE METHOD
A_02 JACOBI METHOD
Fortran!
Dynamical Memory Allocation fortran
Gauss for
The Sum of the chain (fortran)
Fortran Homework 1
euler-cromer
Bissection Method