# Category : Miscellaneous Language Source Code

Archive : FORTRN77.ZIP

Filename : NAREGU.FOR

C

C THIS SUBROUTINE FINDS THE ROOT OF THE EQUATION F(X) = 0

C THROUGH THE METHOD OF FALSE POSITION(REGULA FALSI).

C

NMAX = N

N = 0

CALL VALUE(XHI,FXHI)

CALL VALUE(XLOW,FXLOW)

IF(FXHI.GE.0.0) GO TO 20

XP = XLOW

FXP = FXLOW

XQ = XHI

FXQ = FXHI

GO TO 7

20 XP = XHI

FXP = FXHI

XQ = XLOW

FXQ = FXLOW

7 XNEW = XP - FXP*(XP - XQ)/(FXP - FXQ)

CALL VALUE(XNEW,FXNEW)

N = N + 1

IF(ABS(FXNEW).GT.EPS) GO TO 2

ROOT = XNEW

N = 1

RETURN

2 IF(N.LT.NMAX) GO TO 40

ROOT = XNEW

N = 2

RETURN

40 IF(FXNEW.GT.0.0) GO TO 4

X = XNEW - FXNEW*(XNEW-XQ)/(FXNEW - FXQ)

XQ = XNEW

FXQ = FXNEW

15 IF(XP.LE.XQ) GO TO 6

IF(XP.LE.X) GO TO 7

IF(X.LE.XQ) GO TO 7

9 N = N + 1

CALL VALUE(X,FX)

IF(ABS(FX).GT.EPS) GO TO 17

ROOT = X

N = 1

RETURN

17 IF(N.LT.NMAX) GO TO 18

ROOT = X

N = 2

RETURN

18 IF(FX.GT.0.0) GO TO 11

XQ = X

FXQ = FX

GO TO 7

11 XP = X

FXP = FX

GO TO 7

6 IF(XQ.LE.X) GO TO 7

IF(X.LE.XP) GO TO 7

GO TO 9

4 X = XNEW - FXNEW*(XNEW - XP)/(FXNEW - FXP)

XP = XNEW

FXP = FXNEW

GO TO 15

RETURN

END

Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/