Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
A_02 questions 3
PROGRAM N_I_M IMPLICIT NONE REAL::X,Y,F1,F2,DXF1,DYF1,DXF2,DYF2,MAT(3,2),TOL INTEGER::I,J,K PRINT*,'INPUT THE VALUE OF TOL:' READ*,TOL X=2.0 Y=2.0 DO I=1,10 MAT(1,1)=DXF1(X,Y) MAT(2,1)=DYF1(X,Y) MAT(3,1)=-1*F1(X,Y) MAT(1,2)=DXF2(X,Y) MAT(2,2)=DYF2(X,Y) MAT(3,2)=-1*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*,MAT STOP END PROGRAM N_I_M REAL FUNCTION F1(X,Y) IMPLICIT NONE REAL::X,Y,PI=3.1415926 F1=LOG(ABS(X-Y**2))-SIN(X*Y)-SIN(PI) RETURN END FUNCTION F1 REAL FUNCTION DXF1(X,Y) IMPLICIT NONE REAL::X,Y DXF1=(1/(X-Y**2))-Y*COS(X*Y) RETURN END FUNCTION DXF1 REAL FUNCTION DYF1(X,Y) IMPLICIT NONE REAL::X,Y DYF1=((1/(X-Y**2))*(-2*Y))-X*COS(X*Y) RETURN END FUNCTION DYF1 REAL FUNCTION F2(X,Y) IMPLICIT NONE REAL::X,Y,e=2.718281 F2=e**(X*Y)+COS(X-Y)+2 RETURN END FUNCTION F2 REAL FUNCTION DXF2(X,Y) IMPLICIT NONE REAL::X,Y,e=2.718281 DXF2=Y*e**(X*Y)-SIN(X-Y) RETURN END FUNCTION DXF2 REAL FUNCTION DYF2(X,Y) IMPLICIT NONE REAL::X,Y,e=2.718281 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
A_04 TRAPEZOIDAL RULE (3(II))
machine epsilon
Rand
hello world
Practice 4
A_04 SIMPSON'S ONE THIRD(3(I))
Practice 4(I) recently
prime list 2
Comparison of three numbers
Gauss seidal