adding bisection method implemented as a function