program main
X=1.
K=0
100 K=K+1
FX=X*X*X-8
C 这儿输入公式
DFX=2*X*X
CALL NEWTON (X,FX,DFX,TOL)
IF (TOL.LT.1.E-4) GOTO 200
GOTO 100
200 WRITE(*,*)X
STOP
END program main
SUBROUTINE NEWTON(X,FX,DFX,TOL)
DX=-FX/DFX
TOLER=ABS(DX)
X=X+DX
RETURN
END
1.png (47.91 KB, 下载次数: 84)
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |