Program For Bisection Method In Fortran Format

2020. 2. 16. 12:51카테고리 없음

FortranBisectionExample

Program For Bisection Method In Fortran Format Excel

BISECTION METHODWRITE(.,.)'VALUES OF X1,X2'READ (.,.)X1,X2WRITE(.,.)'ENTER ERROR YOU WANT'READ(.,.)ERFX1=F(X1)WRITE(.,10)FX1FX2=F(X2)WRITE(.,10)FX210 FORMAT(F8.3)FP=FX1.FX2IF (FP.GT.0) GO TO 10015 X3=(X1+X2)/2FX3=F(X3)IF (ABS(FX3).LE.ER) THENWRITE (.,20)X320 FORMAT(5X,'THE ROOT IS='F8.4)WRITE(.,30)FX330 FORMAT(5X,'THE VALUE OF FUNCTION AT ROOT',F8.4)GO TO 200ELSEFP=FX1.FX3WRITE(.,.)FPIF (FP.LT.0)THENX2=X3FX2=FX3GO TO 15ELSEX1=X3FX1=FX3GO TO 15ENDIFENDIFGO TO 200100 WRITE(.,.)'THE ROOT DOES NOT LIE IN THE INTERVAL'200 STOPENDFUNCTION F(X)F=X.3-5.X+3RETURNEND.