Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Summary and Synthesis

Root Finding and Quadrature | Numerical Methods Module 2 | COMP 521

Step acceptance, stopping, and accuracy

Keep these three decisions separate:

DecisionRoot findingQuadrature
Accept a proposalA line search tests decrease; a hybrid tests a bracket-preserving proposal.An adaptive method compares local estimates before accepting a panel.
Stop the algorithmCheck the declared bracket, residual, or step criterion and iteration budget.Check the allocated estimated-error budget and refinement limits.
Trust the answerCheck physical root selection, conditioning, and independent cases.Check sampling adequacy, smoothness assumptions, cancellation, and independent cases.

The backtracking example illustrates one accepted Newton step, not a complete solve. Line search does not preserve a bracket. Levenberg regularization changes the direction itself. These extensions are conceptual context; Project 3 still implements only its specified bisection, Newton, and secant methods.

For nested calculations, an outer root solver acts on the function supplied by an inner calculation. Neither accepted steps nor smaller outer tolerances can remove a fixed quadrature or trajectory error. The investigation below gives a concrete example of that limit.

Module Summary

The diagram separates two task families. They share the need for an explicit contract and convergence evidence; one is not the inverse of the other.

Part 1 introduces root-finding methods for Block 3:

Part 2 supplies the Project 2 quadrature methods and a conceptual comparison:

Use the same review questions for either task: What is being approximated? What regularity or sampling assumption is required? What error is measured? Which test can show that the requested tolerance is met?

The implementation details and convergence laws remain specific to the task.

Key Takeaways

Investigation: an integral inside a root problem

Consider a dimensionless accumulated amount

A(r)=∫0re−x dx.A(r)=\int_0^r e^{-x}\,dx.

We want the location where A(r)=0.9A(r)=0.9, so the root residual is F(r)=A(r)−0.9F(r)=A(r)-0.9. The integral measures an accumulated quantity; the root solver finds the position where that quantity reaches a target. These remain separate numerical tasks even when one calls the other.

An independent reference is available here: A(r)=1−e−rA(r)=1-e^{-r} and r∗=−ln⁡(0.1)=ln⁡10r_*=-\ln(0.1)=\ln 10. We use it to evaluate the evidence, not as an input to the numerical solvers.

Predict which tolerance matters

A reference calculation uses composite trapezoids for A(r)A(r), then bisects its computed residual on [0,4][0,4]. For each root tolerance it keeps the quadrature panel count fixed. Before looking at the results, predict:

  1. Will a root half-width tolerance of 10-10 necessarily locate r∗r_* to 10-10?

  2. What should happen when we keep that tolerance fixed but increase the number of quadrature panels?

  3. Which information would let us bound the final position error?

Tightening the root tolerance at fixed quadrature resolution produces a position-error plateau. Increasing the quadrature panel count reduces the error, and a bound including quadrature stays above the measured error.

Figure 1:Each curve in the left panel solves a different fixed-resolution approximation to the integral. A narrow bracket for that approximate function is not a narrow bracket for the exact function. The right panel fixes the root tolerance and compares actual error with a conservative bound including quadrature error. All quantities are dimensionless.

Open full-size figure

Derive the shared error budget

Let F^\widehat F be the computed residual and suppose a justified bound at the returned position satisfies

∣F(r^)−F^(r^)∣≤ηquad.|F(\widehat r)-\widehat F(\widehat r)|\le\eta_{\mathrm{quad}}.

Assume the exact root and r^\widehat r lie in an interval where FF is continuously differentiable and ∣F′∣≥m>0|F'|\ge m>0. The mean value theorem and triangle inequality give

m∣r^−r∗∣≤∣F(r^)∣≤∣F^(r^)∣+ηquad,m|\widehat r-r_*|\le |F(\widehat r)| \le |\widehat F(\widehat r)|+\eta_{\mathrm{quad}},

and therefore

∣r^−r∗∣≤∣F^(r^)∣+ηquadm.\boxed{|\widehat r-r_*|\le \frac{|\widehat F(\widehat r)|+\eta_{\mathrm{quad}}}{m}.}

The two terms in the numerator have the residual’s units. Dividing by a slope converts them into position units. The first term describes how closely the computed equation was solved; the second describes how closely that equation approximates the intended one.

Here F′(r)=e−r≥e−4F'(r)=e^{-r}\ge e^{-4} on [0,4][0,4], so we may use m=e−4m=e^{-4}. For nn uniform trapezoid panels on [0,r^][0,\widehat r], the integrand has ∣f′′(x)∣=e−x≤1|f''(x)|=e^{-x}\le1, giving the exact-arithmetic bound

ηquad≤r^312n2.\eta_{\mathrm{quad}}\le\frac{\widehat r^3}{12n^2}.

This bound is conservative; it uses the largest second derivative on every panel and the smallest residual slope on the full root-search interval. Floating-point evaluation and accumulation errors must also be included if they are material. In this example their scale is small relative to the displayed margins. If ηquad\eta_{\mathrm{quad}} comes from an adaptive estimator instead of a proven bound, the final allowance is an estimate too.

n=  8: residual=9.70e-13, position error=5.70e-02, bound=8.05e-01
n= 32: residual=1.93e-12, position error=3.86e-03, bound=5.40e-02
n=128: residual=2.72e-12, position error=2.43e-04, bound=3.39e-03

The printed residual can be tiny while the position error is much larger. For a desired absolute position error τr\tau_r, the bound suggests requiring ∣F^(r^)∣+ηquad≤mτr|\widehat F(\widehat r)|+\eta_{\mathrm{quad}}\le m\tau_r. An equal split is one possible budget, not a universal optimum: the relative costs of reducing the two contributions determine a sensible allocation.

A subtle consequence: even the signs can be uncertain

If F^(x)\widehat F(x) has absolute error bounded by η\eta, its sign is certified positive only when F^(x)−η>0\widehat F(x)-\eta>0, and certified negative only when F^(x)+η<0\widehat F(x)+\eta<0. Otherwise the allowed interval includes zero. A sign change in uncertain computed values alone cannot certify a bracket for FF. In the reference calculation, bisection narrows the approximate equation; the shared budget is the additional check against the exact equation.

Transfer: report only the claim your evidence supports

A collaborator reports: “The solver converged at tolerance 10-10.” Write a replacement explanation naming the target quantity, both approximation errors, the assumption converting residual to position, and one comparison that could falsify the claimed accuracy. If the target amount 0.9 also has a known absolute uncertainty, explain where that additional term belongs in the budget.

Looking Forward

For the current sequence:

Before moving on, be able to name the quantity, state the rule’s preconditions, and show a test or convergence result for an implementation.


Quick Reference Tables

Root Finding Methods

MethodFormulaConvergenceIterations for εWhen to Use
Bisectionc=a+b2c = \frac{a+b}{2}Interval width halves⌈log⁡2(L/ϵ)⌉\lceil\log_2(L/\epsilon)\rceil for width ≤ϵ\leq\epsilonContinuous sign-change bracket
Newtonxn+1=xn−f(xn)f′(xn)x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}Quadratic locally near a simple rootProblem-dependentDerivative and suitable initial guess
Secantxn+1=xn−f(xn)xn−xn−1f(xn)−f(xn−1)x_{n+1} = x_n - f(x_n)\frac{x_n-x_{n-1}}{f(x_n)-f(x_{n-1})}Superlinear locallyProblem-dependentNo analytic derivative; suitable starting pair

Integration Methods

MethodLocal ErrorGlobal ErrorFunction EvalsBest For
Left rectangleO(h2)O(h^2)O(h)O(h)nnBaseline rule; one-sided panels
TrapezoidO(h3)O(h^3)O(h2)O(h^2)n+1n+1Smooth callable or tabulated data
SimpsonO(h5)O(h^5)O(h4)O(h^4)n+1n+1; nn evenSmooth callable with even panel count
Gauss-LegendreExact through degree 2n−12n-1 for nn nodesDepends on the integrand and interval mappingnnSmooth integrands; extension beyond Project 2
Monte Carlo—RMS O(N−1/2)O(N^{-1/2}) with independent finite-variance samplesNNHigh-dimensional or irregular domains when sampling is practical

Method Selection Guide

If your problem has...Use this methodBecause...
Continuous sign-change bracketBisectionPreserves a bracket while reducing its width
Root with an expensive derivativeSecant or a safeguarded methodAvoids analytic derivative evaluation
Smooth one-dimensional integralSimpsonFourth-order global error after verifying the regime
Tabulated dataTrapezoidUses measured endpoint values without inventing a global interpolant
High-dimensional or irregular-domain integralMonte Carlo candidateRate avoids tensor-grid scaling; compare variance and sampling cost
Several possible zerosUse physical constraints, scan, and investigate candidatesA sign scan can miss tangencies or several crossings within a cell; one bracket need not isolate one root
Near machine precisionReformulate and inspect error scaleMore refinement may not improve a floating-point result

Common Failure Modes and Fixes

ProblemSymptomSolution
f′(x)≈0f'(x) \approx 0Newton step is unstable or uninformativeSafeguard the step or use a bracketed method
No sign changeBisection cannot startScan the domain or use a method with different assumptions
Oscillatory integrandPoor or misleading convergenceResolve the shortest wavelength, split intervals, and verify refinement
High-dimensional integralTensor grid cost grows rapidlyCompare Monte Carlo, importance sampling, or problem-specific structure
Odd nn for SimpsonProject 2 contract is violatedRaise ValueError; do not silently alter the rule
Round-off dominanceConvergence plateauReport the plateau and reconsider the scale or formulation

Glossary

Adaptive quadrature: An integration method that estimates local error and subdivides intervals selectively. The estimate and stopping rule are part of the method contract.

Bisection method: A root-finding algorithm that repeatedly halves an interval containing a sign change. For a continuous function, the interval width is halved at every iteration.

Bracketing: Maintaining opposite endpoint signs on an interval. Continuity on that interval is required for the Intermediate Value Theorem to guarantee a root.

Catastrophic cancellation: Severe loss of significant digits when subtracting nearly equal floating-point numbers.

Condition number: A measure of how input perturbations affect an output. For a simple scalar root rr, 1/∣f′(r)∣1/|f'(r)| describes the sensitivity of the root to an additive perturbation of the function value; its units depend on the problem’s variables.

Iteration order: A local relation ∣ek+1∣∼C∣ek∣p|e_{k+1}|\sim C|e_k|^p between successive root errors. This differs from quadrature refinement order, ∣E(h)∣∼Chp|E(h)|\sim C h^p, which compares different grid spacings at fixed integration limits. In both cases the stated regime and a nonzero leading term matter.

Curse of dimensionality: Rapid growth in the number of grid cells needed to resolve each additional dimension. The practical limit depends on resolution, structure, and computational budget; it is not a fixed dimension threshold.

Gaussian quadrature: A quadrature rule using nodes and weights chosen from an orthogonal-polynomial family. An nn-node Gauss-Legendre rule is exact for polynomials through degree 2n−12n-1 on its reference interval.

Hybrid method: Algorithm combining multiple approaches, like Brent’s method mixing bisection’s reliability with interpolation’s speed for robust root finding.

Ill-conditioned: A problem in which small input perturbations can cause a large output change. Rapid oscillation creates a resolution problem; it is not by itself a condition-number statement.

Intermediate Value Theorem: If f is continuous on [a,b] and k is between f(a) and f(b), then there exists c ∈\in [a,b] where f(c) = k; strictly intermediate values occur in (a,b).

Interpolation: Approximating a function between known points using simpler functions (lines for secant method, parabolas for Simpson’s rule).

Kepler’s equation: Transcendental equation E - e·sin(E) = M relating eccentric anomaly E to mean anomaly M for elliptical orbits. Classic root-finding application.

Lagrange points: Five equilibrium configurations of the circular restricted three-body problem. A spacecraft mission near one models an orbit in a rotating frame; the physical coordinate and stability conventions must be specified.

Linear convergence: Asymptotically the error decreases by a constant factor below one. Bisection halves a guaranteed interval-width bound; its actual midpoint error need not decrease by exactly one half.

Monte Carlo integration: A statistical estimator based on random samples. With independent finite-variance samples, its root-mean-square error scales as N−1/2N^{-1/2}. Its suitability depends on variance, sampling method, dimensional structure, and cost.

Newton-Raphson method: A root-finding method using a tangent-line update. It has quadratic local convergence near a simple root under suitable smoothness and initialization assumptions.

Quadratic convergence: A local error law of the form en+1∝en2e_{n+1} \propto e_n^2. Newton’s method has this behavior near a simple root when its assumptions hold.

Quadrature: Numerical integration — approximating continuous integrals with discrete sums. From Latin “quadratura” meaning squaring, originally finding square with same area as curve.

Richardson extrapolation: Using results at different resolutions to cancel leading error terms, achieving higher accuracy from lower-order methods.

Root/Zero: A value x∗x^* for which f(x∗)=0f(x^*)=0. In physics, it can represent an equilibrium or an event location. An extremum is a root of a derivative only when that derivative exists and is the quantity being solved.

Secant method: Root-finding using line through two points instead of tangent. Achieves superlinear convergence (order ≈\approx1.618, the golden ratio) without needing derivatives.

Simpson’s rule: Integration using parabolic interpolation through consecutive triplets of points. Achieves fourth-order accuracy despite using only quadratic polynomials.

Superlinear convergence: ∣ek+1∣/∣ek∣→0|e_{k+1}|/|e_k|\to0. Quadratic convergence belongs to this category; the secant method has the particular local order ϕ≈1.618\phi\approx1.618 under its assumptions.

Transcendental equation: An equation involving functions such as sine, exponential, or logarithm. Many require numerical solution; special cases can have explicit answers.

Trapezoidal rule: Integration by connecting consecutive data points with straight lines. It is second-order accurate for a sufficiently smooth uniform grid; for measured data, it is a defined interpolation choice rather than a guarantee about an unknown underlying curve.

Well-conditioned: A problem whose output is relatively insensitive to the specified input perturbations and scaling. Algorithmic stability concerns how the numerical procedure propagates its own errors. A well-conditioned problem can still be evaluated by an unstable algorithm.


For Project 2, use the quadrature contract and its tests. Root-finding implementations and the Star class enter in Project 3.