Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
A_04 POWER METHOD
PROGRAM Power_method IMPLICIT NONE INTEGER,PARAMETER::n=3 INTEGER::i,j,k,maxn,p REAL:: mu,tol,norm REAL,DIMENSION(n,n) :: a REAL,DIMENSION(n) :: x,xn,y Data a/-4.0,-5.0,-1.0,14.0,13.0,0.0,0.0,0.0,2.0/ Data x/1.0,1.0,1.0/ PRINT*,'ENTER THE VALUE OF MAXN:' READ*,maxn PRINT*,'ENTER THE VALUE OF TOL:' READ*,tol WRITE(*,*)'step x1 x2 x3 mu' WRITE(*,*)0,(x(i),i=1,n) DO k=1,maxn y=MATMUL(a,x) DO p=1,n IF(ABS(y(p))==MAXVAL(ABS(y))) EXIT END DO IF(y(p)==0) THEN WRITE(*,*)'eigenvector ',x WRITE(*,*)'A has the eigenvalue = 0, we have to choose a new vector x and restart.' STOP END IF mu=y(p) xn=y/y(p) norm=MAXVAL(ABS(x-xn)) x=xn WRITE(*,*)k,(x(i),i=1,n),mu IF(norm<tol)THEN WRITE(*,*)"Dominant Eigenvalue =",mu STOP END IF END DO WRITE(*,*)' Iteration exceeded.' END PROGRAM Power_method
run
|
edit
|
history
|
help
0
Comparison of three numbers
Practice 2(I)
Factorial num
first
Shooting
trapezna for
Pivot
4(ii)
A_01 BISECTION METHOD
SUM OF ODD NUMBERS