2 added 2 characters in body edited Apr 12 '17 at 1:44 J. M. will be back soon♦ 101k1010 gold badges317317 silver badges477477 bronze badges I know this question is quite old, but here's my attempt. It's as fast as MichaelsMichael's, but much simpler: Bisection[f_, int_, tol_, niter_] := Block[ {m = tol + 1, prev, ym, yl = f[Last@int]}, NestWhile[( prev = m; m = Total@#/2; ym = f[m]; If[ym*yl > 0, yl = ym; {First@#, m}, {m, Last@#}] ) &, int, ym != 0 && Abs[m - prev] > tol &, 2, niter] ]  Testing it with func[t_?NumericQ] := 1 + NIntegrate[Sin[x^2] - x, {x, 0, t}]; Bisection[func, {1, 2.20}, 10^-14, 1000] // Timing {0.109375, {1.9252809180739163253, 1.9252809180739234307}}  I know this question is quite old, but here's my attempt. It's as fast as Michaels but much simpler Bisection[f_, int_, tol_, niter_] := Block[ {m = tol + 1, prev, ym, yl = f[Last@int]}, NestWhile[( prev = m; m = Total@#/2; ym = f[m]; If[ym*yl > 0, yl = ym; {First@#, m}, {m, Last@#}] ) &, int, ym != 0 && Abs[m - prev] > tol &, 2, niter] ]  Testing it with func[t_?NumericQ] := 1 + NIntegrate[Sin[x^2] - x, {x, 0, t}]; Bisection[func, {1, 2.20}, 10^-14, 1000] // Timing {0.109375, {1.9252809180739163253, 1.9252809180739234307}}  I know this question is quite old, but here's my attempt. It's as fast as Michael's, but much simpler: Bisection[f_, int_, tol_, niter_] := Block[ {m = tol + 1, prev, ym, yl = f[Last@int]}, NestWhile[( prev = m; m = Total@#/2; ym = f[m]; If[ym*yl > 0, yl = ym; {First@#, m}, {m, Last@#}] ) &, int, ym != 0 && Abs[m - prev] > tol &, 2, niter] ]  Testing it with func[t_?NumericQ] := 1 + NIntegrate[Sin[x^2] - x, {x, 0, t}]; Bisection[func, {1, 2.20}, 10^-14, 1000] // Timing {0.109375, {1.9252809180739163253, 1.9252809180739234307}}  1 answered Apr 12 '17 at 0:57 lombardo2 15111 silver badge44 bronze badges I know this question is quite old, but here's my attempt. It's as fast as Michaels but much simpler Bisection[f_, int_, tol_, niter_] := Block[ {m = tol + 1, prev, ym, yl = f[Last@int]}, NestWhile[( prev = m; m = Total@#/2; ym = f[m]; If[ym*yl > 0, yl = ym; {First@#, m}, {m, Last@#}] ) &, int, ym != 0 && Abs[m - prev] > tol &, 2, niter] ]  Testing it with func[t_?NumericQ] := 1 + NIntegrate[Sin[x^2] - x, {x, 0, t}]; Bisection[func, {1, 2.20}, 10^-14, 1000] // Timing {0.109375, {1.9252809180739163253, 1.9252809180739234307}}