BL2.ru

Root finding online(bisection, Newton, regula falsi, secant)

Solve a nonlinear equation f(x) = 0 numerically: enter the function, an interval [a; b] and tolerance ε. Every iteration is shown.

= 0
Allowed: x^2, 2x, sin(x), cos x, e^x, exp(x), ln(x), lg(x), log(2, x), sqrt(x), abs(x), pi; decimal point or comma.
Calculate

Why numerical methods

Equations like x³ − 2x − 5 = 0, cos x = x or ex = 3x have no general formula. Numerical methods approach the root step by step to any tolerance ε.

Methods

  • Bisection halves the interval keeping the half with a sign change. Always converges, slowly.
  • False position (chords): x = b − f(b)·(b − a) / (f(b) − f(a)). Usually faster, always converges.
  • Newton–Raphson: xk+1 = xk − f(xk) / f′(xk). Very fast near the root, needs a good start (the interval midpoint here).
  • Secant: Newton with the derivative replaced by the slope through the last two points.

Example

x³ − 2x − 5 = 0 on [2; 3]: root x ≈ 2.0945515. Bisection with ε = 0.0001 needs about 14 iterations, Newton about 4.

FAQ

Bisection or Newton?
Bisection is robust but slow; Newton converges in a few steps but may diverge from a poor start. A common practice is to narrow the interval by bisection and refine with Newton.
What if f(a) and f(b) have the same sign?
The interval has no roots or an even number of them. Check the graph and narrow the interval.
How to find all roots?
Use a wide interval: it is scanned for sign changes and each root is refined. Roots where the graph only touches the axis are not detected by scanning.
What tolerance should I use?
Typically 0.001 or 0.0001 in coursework.