Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
A_01 SECANT_METHOD
PROGRAM SECANT_METHOD IMPLICIT NONE REAL::A,B,C,X,TOL,F,D,E INTEGER::N,I PRINT*,'INPUT THE VALUE OF A AND B:' READ*,A,B PRINT*,'INPUT THE VALUE OF N AND TOL:' READ*,N,TOL I=2 D=F(A) E=F(B) IF(D*E>0) THEN PRINT*, 'RE-ENTER THE INPUTS:' STOP END IF DO IF (I>N) THEN PRINT*,'FAILED' STOP END IF C=((A*E)-(B*D))/(E-D) IF (ABS(C-A)<TOL) THEN PRINT*,'THE REAL ROOT IS:',C STOP END IF I=I+1 A=B D=E A=C D=F(C) END DO END PROGRAM SECANT_METHOD REAL FUNCTION F(X) IMPLICIT NONE REAL::X F=X**3.0-2.0*X-5 END FUNCTION
run
|
edit
|
history
|
help
0
A_02 QUESTIONS NUMBER 3
fucugigugug
Finding trace
exercise
I m
Regression
Finite difference practice
Hello / fortran
evaluation
Test