Resources » Articles/Knowledge Sharing » Computer & Technology

UNDERSTANDING BISECTION METHOD USING FORTRAN


Posted Date: 12-Mar-2008  Last Updated:   Category: Computer & Technology    
Author: Member Level: Gold    Points: 4



BISECTION METHOD
Bisection Method is very simple and convenient method for solving all types of Algebric and Transcendental Equation.
Let us suppose the equation to be solved be f(x) =0. This is the general form of the equation. Here we have to find the value of x for which f(x) becomes zero. To understand the bisection method first of all we consider any two arbitrary point x1 & x2 such that f(x1) & f(x2) opposite signs. Clearly the solution will be in the range x1-x2. To find the next approximation in the method we get the middle most point of the interval given by m=(x1+x2)/2. If f(m)~0 then m is the solution otherwise the sign of f(m) is compared with the sign of f(x2). If the sign of both is same then x1 is shifted to m otherwise x2 is shifted to m. By this the range is reduced the earlier range by half. This process is evaluating the middle point, comparing the sign of f(m) with f(x1) ….etc. is repeated until we get f(m)~0. This value of m is the solution of given Equation. For example

Fortran Programs for Bisection Method:

C SOLUTION OF BISECTION METHOD
FUNCTION F(X)
F=2*X*X-4*X+1
RETURN
END
2 WRITE(*,*)'ENTER TWO NUMBERS'
READ(*,*) X1,X2
IF(F(X1)*F(X2)) 3,4,2
4 IF(F(X1).EQ.0) THEN
WRITE(*,*)'SOLUTION=',X1
ELSE
WRITE(*,*)'SOLUTION=',X2
ENDIF
3 WRITE(*,*)'ENTER TOL'
READ(*,*) TOL
5 AM=(X1+X2)/2
Y=F(AM)
IF(ABS(Y).LE.TOL) THEN
WRITE(*,*)'SOLUTION=',AM
STOP
ELSE
IF(Y*F(X1).GT.0) THEN
X1=AM
ELSE
X2=AM
ENDIF
ENDIF
GO TO 5
END


Output

BISEC.FOR

Microsoft (R) Segmented-Executable Linker Version 5.15
Copyright (C) Microsoft Corp 1984-1991. All rights reserved.

Object Modules [.OBJ]: BISEC.OBJ
Run File [BISEC.exe]: BISEC.EXE
List File [NUL.MAP]: NUL
Libraries [.LIB]:
Definitions File [NUL.DEF]: ;

D:\FORTRAN\BINB>BISEC
ENTER TWO NUMBERS
2
3
ENTER TWO NUMBERS
2
1
ENTER TOL
.005
SOLUTION= 1.707031
Stop - Program terminated.


Did you like this resource? Share it with your friends and show your love!




Responses to "UNDERSTANDING BISECTION METHOD USING FORTRAN"
Guest Author: ravi punniyakoti     27 Feb 2013
sample program in fortran for bisection method and Bisection Method is very simple and convenient method for solving all types of Algebric and Transcendental Equation is helpful for me, thanks


Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.