Professional Documents
Culture Documents
BY FORTRAN
PROGRAMMING
or vice-versa.
⚫ Step 2 : Calculate a midpoint c as the arithmetic mean
between a and b such that
c = (a + b) / 2
This is called interval halving.
⚫ Step 3:Evaluate the function f(x) for the value of
c.
STEPS FOR B I S E C T I O N M E T H O D
⚫ Step 5 : If f(c) ≠ 0, then we need to check
• Step 6 : Then we replace a with c if f(c) has the
same sign as f(a) and we keep the same value for b.
⚫ Step 7 : We replace b with c if f(c) has the same
sign as
f(b), and we keep the same value for a.
⚫ Step 8 : Again if f(c)≠ 𝒐 To get the correct value with
the new value of a or b, we need to go back to step 2
And recalculate c.
⚫ Step 9 : And similarly we proceed many iterations and
narrow the interval until we achieve our root up-to
significant no. of decimal places.
P R O G R A M M I N G OF B I S E C T I O N M E T H O D
A LG O R I T H M
⚫ Programing bisection method.
⚫ Write implicit none
⚫ Define the required variables a, b and x.
⚫ Define the parameter (e=0.000001).
⚫ Take the input of values a and b.
⚫ If the absolute value of function f(x) is less
than the the parameter (e=0.000001) then print
the root of function and stop .
⚫ Calculate the value of 𝑥=(𝑎+𝑏)/2
⚫ Else if f(a)*f(x) is less than zero then a=x or
b=x..
⚫ End Program.
F LO W C H A R T
Input :
a,b
X=(a+b)/2
F(a)*F(x)
<0
b=x a=x
P R O G R A M M I N G C O D E FOR B I S E C T I O N M E T H O D
OUTPUT
G R A P H I C A L REPRESENTATION
P R O G R A M M I N G C O D E FOR B I S E C T I O N M E T H O D
O U TPUT
G R A P H I C A L REPRESENTATION
A D VA N TA G E
⚫ This is a easy method of finding root of
a equation.
⚫ The bisection method is very simple and
easy to program on the computer.
⚫ Does not involve complex calculations.
⚫ The bisection method guarantees converges
to a root in an interval as long as the
function is continuous.
DISADVANTAGE
⚫ This method is very slow and
involves lengthy calculation.