This free tool turns the classic root-finding and numerical integration algorithms from a first-year engineering numerical methods course into something you can watch happen. Pick one of three preset functions, then step (or auto-play) through bisection and Newton-Raphson iterations on a live graph with a running iteration table, or drag a slider to add more Riemann-sum rectangles or trapezoids and watch the approximate integral converge on the true value.
Bisection starts from a bracket [a, b] where f(a) and f(b) have opposite signs, guaranteeing a root lies between them by the Intermediate Value Theorem. Each iteration evaluates the midpoint c = (a+b)/2 and keeps whichever half still brackets the sign change — the bracket width is cut in half every step, so convergence is slow but bulletproof as long as a valid bracket is supplied.
Newton-Raphson instead starts from a single guess x₀ and repeatedly follows the tangent line down to the x-axis: xₙ₊₁ = xₙ − f(xₙ)/f'(xₙ). It converges much faster (quadratically, versus bisection's linear rate) when it converges at all, but it has no bracket to protect it — a poor initial guess or a near-zero derivative can send it diverging, which is exactly what the "diverged" warning in this tool is showing you when it appears.
When an integral has no convenient closed form — or you only have a curve, not a formula — numerical integration approximates the area under it by chopping [a, b] into n subintervals and summing simple shapes. Left, right, and midpoint Riemann sums each use a rectangle per subinterval, sampling the function at the left edge, right edge, or midpoint respectively; the trapezoidal rule instead connects consecutive points with a straight line, forming a trapezoid whose area is the average of the two edge heights times the width.
As n grows, every one of these methods converges toward the true integral, but at different rates: midpoint and trapezoidal typically converge faster than plain left/right Riemann sums for smooth functions, because their errors partially cancel curvature on either side of each subinterval rather than compounding in one direction.
Rather than reaching for a symbolic math library, this tool computes its reference "true" integral the same way it computes the approximation you're adjusting — numerically — just with composite Simpson's rule at n = 20,000 subintervals, which is precise enough (error on the order of 10⁻¹² for these smooth preset functions) to treat as ground truth for comparison. Watch the absolute and relative error shrink as you drag the subinterval slider higher on your chosen method.
Choose a preset function from the dropdown at top, then use the Root-Finding / Integration tabs to switch modes. In Root-Finding, pick Bisection or Newton-Raphson, adjust the bracket (a, b) or initial guess x₀, and use Step to advance one iteration at a time or Play to auto-advance — the iteration table on the right fills in as you go. In Integration, pick a method, set the bounds, and drag the subinterval slider to see the rectangles or trapezoids redraw in real time alongside the updated approximation, true value, and error readouts.
Bisection relies on the Intermediate Value Theorem: if f is continuous on [a, b] and f(a) and f(b) have opposite signs, at least one root must lie between them. If f(a) and f(b) share the same sign, that guarantee disappears — there may be zero roots in the bracket, or an even number of them that the method cannot reliably isolate — so this tool flags the bracket as invalid and disables stepping until you pick a and b that straddle a sign change.
Newton-Raphson can fail when the tangent line at the current guess is nearly flat (f'(x) close to zero, so the next step divides by a tiny number and overshoots wildly) or when the initial guess starts far from the root in a region where the function's curvature sends iterations away rather than toward it. Try a different x₀ closer to where the curve visibly crosses zero on the graph.
For a fixed number of subintervals on a smooth function, the trapezoidal rule and midpoint Riemann sum generally beat left and right Riemann sums, because their error terms are proportional to the second derivative and shrink faster as subintervals are added — the classic next step up in accuracy is Simpson's rule (used internally here as the "true value" reference), which fits a parabola through each pair of subintervals instead of a straight line.
Yes — this tool is a hands-on companion to that article's coverage of root-finding, integration, and ODE solvers. Bisection, Newton-Raphson, Riemann sums, and the trapezoidal rule are exactly the techniques it walks through conceptually; this visualizer lets you watch them execute step by step on real functions instead of just reading the pseudocode.