keisoku

Bisection Method Equation Solver

Solve f(x)=0 with the bisection method. Enter a function and an interval to get the approximate root, f(root), the iteration count, and the error, plus a per-step table of intervals and midpoints and a function graph.

Input

Use + - * / for arithmetic, ^ for powers, and functions such as sin/cos/exp/log/sqrt. Constants: pi, e. Variable: x.

Stop once half the interval width drops to this value or below

Result

Approximate root x

1.4142135605

Converged within the tolerance

Value of f(root)

-5.237e-9

Iterations

28

Estimated error

7.451e-9


Graph of y = f(x) and the computed root

0-0.32.3x ≈ 1.4142

Iteration log

StepabMidpoint cf(c)
1021-1.000e+0
2121.52.500e-1
311.51.25-4.375e-1
41.251.51.375-1.094e-1
51.3751.51.43756.641e-2
61.3751.43751.40625-2.246e-2
71.406251.43751.4218752.173e-2
81.406251.4218751.4140625-4.272e-4
91.41406251.4218751.417968751.064e-2
101.41406251.417968751.416015635.100e-3
111.41406251.416015631.415039062.336e-3
121.41406251.415039061.414550789.539e-4
131.41406251.414550781.414306642.633e-4
141.41406251.414306641.41418457-8.200e-5
151.414184571.414306641.414245619.063e-5
161.414184571.414245611.414215094.315e-6
171.414184571.414215091.41419983-3.884e-5
181.414199831.414215091.41420746-1.726e-5
191.414207461.414215091.41421127-6.475e-6
201.414211271.414215091.41421318-1.080e-6
211.414213181.414215091.414214131.617e-6
221.414213181.414214131.414213662.687e-7
231.414213181.414213661.41421342-4.056e-7
241.414213421.414213661.41421354-6.846e-8
251.414213541.414213661.41421361.001e-7
261.414213541.41421361.414213571.584e-8
271.414213541.414213571.41421355-2.631e-8
281.414213551.414213571.41421356-5.237e-9

How it works

  • The bisection method exploits the fact that when f(a) and f(b) have opposite signs (f(a)·f(b) < 0), a root must lie between them, repeatedly halving the interval to close in on it.
  • The function f(x) may use arithmetic operators, the power operator ^, parentheses, and a unary minus, plus functions such as sin, cos, tan, exp, log (natural log), log10, sqrt, and abs, and the constants pi and e. Use x for the variable.
  • Choose the left endpoint a and right endpoint b so that the function changes sign between them. The method cannot be applied on an interval where the sign stays the same, and an error is shown.
  • The tolerance is the stopping criterion: convergence is declared once half the interval width drops to this value or below. A smaller value increases accuracy but requires more iterations.
  • The maximum iteration count is a safety limit. If convergence is not reached within that many steps, the current approximation is reported as not converged.
  • Because the interval is halved exactly each step, convergence is stable and reliable, though slower than methods such as Newton's. When several roots exist, the one you find depends on how the interval is chosen.