function root=bisection(a, b)
y=@g;
if(y(a)*y(b)>0)
    root='Both a and b are positive or negative'
else
    for i=1:500
        c=(a+b)/2;
        if(y(a)*y(c)<0)
            b=c;
        else
            a=c;
        end
        root=b;
    end
end
root
% (-1,-.5), (-.5,0), (1,1.25), (2,2.25) Configuration 1
%(-.8,-.6),(-.4,-.2),(0,.1),(.4,.6),(.9,1),(2.5,2.6) Configuration 2
%p2=7.001
%For number 6, p2=9, (1.5,1.6), (2.2, 2.4)