Lab manual Computer Programming and Numerical Methods
Experiment No. 01
Title: Bisection Method
Aim: To find height (h) of tank to which the dipstick is wet with oil using Bisection Method.
Theory:
Write Theoretical Part from any Text Book
1. Explain Bisection Method with Graphical Representation
2. Write Advantages and Disadvantages of Bisection Method.
Problem Statement:
You have a spherical storage tank containing oil. The tank has a diameter of 6 ft. You are asked
to calculate the height h to which a dipstick 8 ft long would be wet with oil when immersed in
the tank when it contains 4 ft3 of oil.
Dipstick
Spherical Storage Tank
Figure 1: Spherical storage tank
The equation that gives the height, h, of the liquid in the spherical tank for the given volume and
radius is given by
f h h3 9h 2 3.8197 0 or 𝑉 =
𝜋ℎ 2 (3𝑟−ℎ)
3
Use the bisection method of finding roots of equations to find the height (h), to which the
dipstick is wet with oil.
Analytical Solution:
Solve the above problem by Bisection Method to find the height (h), to which the dipstick
is wet with oil.
Department of Chemical Engineering FAMT, Ratnagiri Prepared by, Prof Nitin G Kanse
Lab manual Computer Programming and Numerical Methods
Scilab Program Coding:
// Bisection Method
function [f]=bisect(x)
f=(x^3)-(9*x^2)+3.8197;
endfunction
function [x]=bisect1(a, b, n)
for i=1:n
fa=bisect(a);
fb=bisect(b);
c=(a+b)/2;
fc=bisect(c);
if((fc*fb)<0) then
a=c;
else
b=c;
end
end
x=c
endfunction
funcprot(0)
a=input(' Enter the value of a = ');
b=input(' Enter the value of b = ');
n=input( ‘Enter Number of iterations n = ');
x=bisect1(a,b,n);
disp(‘The height h to which the dipstick is wet with oil using Bisection Method is = ');
disp(x)
Result: The height (h), to which the dipstick is wet with oil using Bisection Method is
1. By Analytically =
2. By using Scilab =
Department of Chemical Engineering FAMT, Ratnagiri Prepared by, Prof Nitin G Kanse