## Fortran Bisection Method

- This method is used for finding an approximate solution to an equation f(x)=0 to the desired degree of accuracy.
- This method is based on a concept that states that if a function f(x) is continuous in the closed interval a<=x<=b and f(a), f(b) are of opposite signs,
- then there must exist at least one real root between x=a and x=b.
- F(X) =2.0*X**3-5.0*X-2.15

**Write a program to demonstrate the application of the Bisection method to locate the root of the equation.?**

```
PROGRAM BISECT
C
C PROGRAM TO LOCATE THE ROOT OF AN EQUATION USING THE BISECTION METHOD
C
C GIVEN EQUATION
F(X) =2.0*X**3-5.0*X-2.15
C
100 WRITE (*,*)' ENTER YOUR ESTIMATE OF ROOT (LOWER LIMIT, UPPER LIMIT)'
READ (*,*) XL, XR
C FIND IF ESTIMATES ARE CORRECT
CHK=F(XL)*F(XR)
C ENTER DATA AGAIN IF ESTIMATES DO NOT BRACKET THE ROOT
IF (CHK.GT.0.0) GOTO 100
I=0
400 I=I+1
C FIND ROOT POSITION USING ARITHMETIC MEAN
XM=(XL+XR)/2.0
CHK=ABS (F (XM))
C EXIT LOOP IF ROOT FOUND
IF (CHK.LE.0.0001) GOTO 200
C EXIT LOOPS IF UNABLE TO FIND ROOT EVEN AFTER 100+ CYCLES
IF (I.GT.100) GOTO 300
C GET NEW LOWER AND UPPER LIMITS FOR THE NEXT CYCLE
CHK=F(XL)*F(XM)
IF(CHK.LT.0.0)THEN
XR=XM
ELSE
XL=XM
ENDIF
C START NEXT CYCLE
GOTO 400
200 WRITE (*,*)'ROOT FOUND AT X=', XM
STOP
300 WRITE (*,*)'ROOT NOT FOUND. PROGRAM TERMINATED.'
STOP
END
#OUTPUT
ENTER YOUR ESTIMATE OF ROOT (LOWER LIMIT, UPPER LIMIT)
2 4
ROOT FOUNDATION AT X = 2.5815153
```