My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
|
UNDERSTANDING BISECTION METHOD USING FORTRAN
Posted Date: 12 Mar 2008 Resource Type: Articles/Knowledge Sharing Category: Computer & Technology
|
Posted By: ashish singh Member Level: Diamond Rating: 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.
|
Responses
|
No responses found. Be the first to respond and make money from revenue sharing program.
|
|
Watch TV Channels
|