Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
A_02 JACOBIAN NEWTON'S ITERATIVE METHOD
PROGRAM N_I_M IMPLICIT NONE REAL::X,Y,F1,F2,DXF1,DYF1,DXF2,DYF2,MAT(3,2),TOL,PI=3.1415926,e=2.718281 INTEGER::I,J,K,N PRINT*,'INPUT THE VALUE OF TOL:' READ*,TOL PRINT*,'INPUT THE VALUE OF N:' READ*,N X=2.0 Y=2.0 DO I=1,N MAT(1,1)=DXF1(X,Y) MAT(2,1)=DYF1(X,Y) MAT(3,1)=-1.0*F1(X,Y) MAT(1,2)=DXF2(X,Y) MAT(2,2)=DYF2(X,Y) MAT(3,2)=-1.0*F2(X,Y) CALL NEW(MAT) X=X+MAT(3,1) Y=Y+MAT(3,2) WRITE (*,20)X,Y 20 FORMAT (' THE ROOT IS:',F6.3) IF((ABS(MAT(3,1))<=TOL).OR.(ABS(MAT(3,2))<=TOL)) EXIT END DO PRINT*,'THE JACOBIAN MATRIX IS:' PRINT*,MAT STOP END PROGRAM N_I_M REAL FUNCTION F1(X,Y) IMPLICIT NONE REAL::X,Y,PI F1=LOG(ABS(X-Y**2.0))-SIN(X*Y)-SIN(PI) RETURN END FUNCTION F1 REAL FUNCTION DXF1(X,Y) IMPLICIT NONE REAL::X,Y DXF1=(1/(X-Y**2.0))-Y*COS(X*Y) RETURN END FUNCTION DXF1 REAL FUNCTION DYF1(X,Y) IMPLICIT NONE REAL::X,Y DYF1=((1/(X-Y**2.0))*(-2.0*Y))-X*COS(X*Y) RETURN END FUNCTION DYF1 REAL FUNCTION F2(X,Y) IMPLICIT NONE REAL::X,Y,e F2=e**(X*Y)+COS(X-Y)+2.0 RETURN END FUNCTION F2 REAL FUNCTION DXF2(X,Y) IMPLICIT NONE REAL::X,Y,e DXF2=Y*e**(X*Y)-SIN(X-Y) RETURN END FUNCTION DXF2 REAL FUNCTION DYF2(X,Y) IMPLICIT NONE REAL::X,Y,e DYF2=X*e**(X*Y)+SIN(X-Y) RETURN END FUNCTION DYF2 SUBROUTINE NEW(MAT) REAL::MAT(3,2),D INTEGER::I,J,K DO K=1,2 D=MAT(K,K) DO I=1,3 MAT(I,K)=MAT(I,K)/D END DO DO J=1,2 IF(K==J) CYCLE D= MAT(K,J) DO I=1,3 MAT(I,J)=MAT(I,J)-(MAT(I,K)*D) END DO END DO END DO RETURN END SUBROUTINE NEW
run
|
edit
|
history
|
help
0
Practice am4
Gauss forward elimination
NEWTON SECOND LAW
hello world
Finite
expx
A_04 SHOOTING METHOD
CHARACTER REVOLVING
A_002 THE GUASS SEIDEL
Question1(b)