Chapter 1 · Existence, brackets and error certificates
Decide whether a scalar balance has a root, isolate it with a sign-changing interval and translate an equation residual into a bound in physical units.
From first principles
Turn a sign change into a location certificate
Suppose \(f\) is continuous on \([a,b]\) and the endpoint values have opposite signs. By the intermediate value theorem at least one zero lies between them. Evaluate the midpoint \(m=(a+b)/2\). If \(f(m)=0\), the equation has been solved. Otherwise exactly one of the two half intervals still has opposite signs at its endpoints. Keep that half and repeat. From an initial width \(w_0=b-a\), the width after \(n\) such updates is
for at least one enclosed root \(r\), where \(m_n\) is the midpoint of the current interval. To target an absolute location error \(\varepsilon>0\), a sufficient number of halvings is
The certificate uses reliable endpoint signs and continuity. A jump can change signs without crossing zero, while a tangential root can exist without changing signs. Monotonicity is optional for existence but can establish that the enclosed root is unique.
Background · Bracket
Continuity is needed to infer a zero between endpoints. A root of even multiplicity may exist without a sign change.
Derivation and applications
Certify the location obtained by intersecting an endpoint secant
A sign bracket guarantees an enclosed root. If derivatives are also bounded, its endpoint secant can produce a sharper certified location without a sequence of additional function evaluations. Assume \(f\in C^2[a,b]\), opposite endpoint signs, \(|f'|\ge m>0\), and \(|f''|\le M\). The derivative cannot change sign on the interval, so there is exactly one root \(r\). Form the line joining the endpoint values and solve it for zero,
The line vanishes at \(s\), so the true residual there is exactly the error made by interpolating \(f\) by that line. The two-node interpolation remainder and the mean value theorem applied between \(s\) and \(r\) give successively
Combining the inequalities gives a certified enclosure centred on the proposed root approximation,
Intersect this enclosure with the original bracket to retain both guarantees. The constants must hold over the whole interval; an observed derivative at one point supplies neither bound by itself. When the function is linear the curvature bound vanishes and the secant solves the problem exactly.
Worked example
Enclose a square root from two evaluations
For \(f(x)=x^2-2\) on \([1.4,1.5]\), the endpoint values are \(-0.04\) and \(0.25\). The secant gives \(s=1.4137931\). Since \(M=2\) and \(m=2.8\), the sharper bound is
The true root \(1.4142136\) indeed differs by \(0.0004205\), and the location guarantee is much tighter than half the original width.
Second application
Determine the bracket width needed for a certificate
Another calibration guarantees \(m=4\) and \(M=3\) throughout the working interval. To certify secant location error \(10^{-4}\), the uniform width criterion gives
Starting at width \(0.20\), three bisections give \(0.025\). Its worst secant error is then at most \(3(0.025)^2/32=5.86\times10^{-5}\).
Start from this chapter. Use the previous temperature and the ambient temperature as candidate endpoints. Check the residual signs before comparing the numerical solution of the implicit stage.
OneSimulation laboratory · Locate the root of an implicit cooling step
A bracket can collapse onto a pole
A measuring circuit returns a signed response as a control coordinate \(x\) traverses the unit interval. Someone proposes logging only the sign and using bisection to locate the point at which the response vanishes. How much can those signs actually certify? Let \(a=\sqrt2/4\). Compare two hypothetical responses \(f(x)=x-a\) and \(g(x)=1/(x-a)\). They have the same sign at every sampled point except the singular coordinate itself. Only the first has a zero. The second is undefined at \(a\) and never vanishes.
Start with endpoints zero and one. On every trial the bisection coordinate, sign decision and resulting interval will be identical for these two responses. This follows by induction: identical current intervals have the same midpoint, the midpoint signs coincide, and the same endpoint is replaced. The shrinking width therefore tracks a crossing in the sign pattern. Continuity on the entire retained interval is the extra information the intermediate value theorem requires to guarantee a zero.
Open full-size diagramInclude the amplitude of the response in the notebook's log. At any midpoint \(m\), excluding an exact tie, the product \(|f(m)||g(m)|\) equals one. As the bracket contracts about \(a\), the first magnitude tends to zero and the second grows without bound. If the first residual at a sample is \(2^{-14}\), the reciprocal response there is
A software check that accepts only the final width would treat these two very different observations as equally persuasive. A width criterion plus a scaled residual supplies stronger evidence, but finite samples alone cannot establish continuity for a completely unknown device between measurements.
In a physical instrument saturation may hide the growing amplitude. Then inspect the forward model and its domain: a quotient can change sign when its denominator passes through zero. Record the numerator, denominator, clipping events and units separately where possible. Scaling a residual by a quantity that also diverges can disguise the singularity a second time. A well-designed stopping test makes its assumptions about observability explicit.
A discontinuity also has consequences for existence guarantees based on intervals. If a constitutive law supplies an excluded denominator interval or explicitly brackets an undefined point, split the physical domain there before asking a root finder to operate. This small piece of model knowledge is stronger than an arbitrarily long list of sign samples.
Suppose one accepts whenever the bracket width is below \(10^{-5}\). How many halvings suffice on a unit interval, and what follows for the reciprocal model at the midpoint of that final bracket?
Work through the solution
Seventeen halvings make the width \(2^{-17}\simeq7.63\cdot10^{-6}\). Since \(a\) remains in the interval, its distance to the midpoint is at most half the remaining width. Thus the reciprocal response has magnitude at least \(2^{18}\), unless the midpoint exactly hits the undefined point. A tiny horizontal uncertainty has here located a singularity with high precision.
Change parameters · Explore this notebook example
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Establish the meaning of a root
A source supplies heat at a known rate, while a cooling surface loses heat at a rate that increases with temperature. A steady state equates the two rates. Writing generation minus loss as \(F(T)\) turns a physical balance into one scalar equation. Before selecting a numerical method, specify an admissible temperature interval and state which assumptions make the relation continuous there. A temperature-dependent material table with a discontinuous switch may require separate treatment of each regime.
If \(F\) is continuous and \(F(a)F(b)<0\), the intermediate value theorem guarantees at least one root in \((a,b)\). It does not count the roots. If \(F'\) has one strict sign throughout, the function is strictly monotonic and the root is unique. An even-multiplicity root can touch zero without changing sign, as \(F(x)=(x-1)^2\) does. Conversely, a sign change across the pole of \(1/x\) guarantees nothing. An interval and its regularity assumptions are part of the mathematical answer.
Turn existence into a controlled search
Evaluate the midpoint \(m=(a+b)/2\). If \(F(m)=0\) the machine has found a zero of its evaluated residual. Otherwise keep the half whose endpoint values have opposite signs. Continuity carries the existence argument through each subdivision. After \(n\) halvings the width is \(2^{-n}(b-a)\), so the midpoint has distance at most \(2^{-(n+1)}(b-a)\) from a root. A predetermined number of evaluations can therefore guarantee a target error in the independent variable even for an unknown local slope.
For \(F(x)=x^3+x-1\) on \([0,1]\), the derivative \(3x^2+1\) is positive, while the endpoints have opposite signs. Test \(0.5\), giving \(-0.375\), and keep \([0.5,1]\). Testing 0.75 gives \(0.171875\), narrowing the bracket to \([0.5,0.75]\). The next midpoint 0.625 gives approximately \(-0.13086\), hence \([0.625,0.75]\). After ten halvings the midpoint is guaranteed within \(1/2048\), independent of how the subsequent signs turn out. A function evaluation whose uncertainty covers zero cannot safely be classified as strictly positive or negative without additional information.
Translate a balance into a physical uncertainty
Let \(r\) be the root and suppose \(|F'|\geq m>0\) on a bracket containing both \(r\) and a candidate \(x\). By the mean value theorem \(F(x)-F(r)=F'(\xi)(x-r)\), so \(|x-r|\leq|F(x)|/m\). For the cubic, \(m=1\) is valid globally, and within \([0.625,0.75]\) the sharper bound \(m=1+3(0.625)^2\) applies. A balance mismatch can thus yield an informative location estimate when the slope is well separated from zero.
Suppose instead the residual of a thermal balance is expressed in watts and its slope is at least 2 W/K. A 0.1 W mismatch guarantees at most 0.05 K error under the exact model. Reporting a temperature tolerance of 0.1 solely from that residual would silently change units. Near a fold the slope can become arbitrarily small, so a tiny mismatch can coexist with substantial uncertainty about the state. In that case report the bracket, measurement uncertainty and nearby alternatives along with the small residual.
Calibrate the stop against a noisy measurement
Suppose temperatures 300 K and 302 K bracket a steady heat balance, and the residual slope is known to exceed 4 W/K. The net power sensor is accurate only to ±0.2 W. A reported mismatch of +0.1 W may have either sign, so it cannot safely choose a half-interval. Its magnitude plus the uncertainty is at most 0.3 W, however. The slope bound then implies distance at most 0.075 K from the exact balance under the model.
This gives two ways to use the same observation. If its error interval excludes zero, the sign can tighten a bracket. If it includes zero, a magnitude bound can still constrain the root location. A stopping rule that requires a residual below the instrument’s resolution might keep iterating without improving the physical estimate. Decide the temperature accuracy of interest first, then choose an appropriate balance test.
Background · What does a sign test mean at an instrument’s resolution?
A calibrated instrument reports residual \(m(x)\) with a guaranteed absolute error at most \(\eta\). A positive report establishes a positive physical residual only if \(m(x)-\eta>0\). A certified bracket therefore uses intervals whose entire sign is known. If an interior interval contains zero, assigning its sign from the midpoint alone can discard the true root.
For a continuously differentiable monotone residual with \(|f'|\geq s>0\) between the candidate and a known root, the mean-value theorem also supplies a distance estimate:
This estimate explains why requesting more digits from bisection cannot settle a flat, noisy balance. Repeating observations may reduce random error; a guaranteed calibration offset needs independent information.
Preserve a bracket while using slope information
A secant through the two endpoints of a sign-changing bracket usually crosses the axis at a more informative location than the midpoint. For continuous \(f\), opposite signs at \(a,b\) place the linear-interpolant root \(c=[af(b)-bf(a)]/[f(b)-f(a)]\) strictly inside the bracket. Replace whichever endpoint has the same sign as \(f(c)\). This false-position iteration preserves existence just as bisection does. It differs in one significant respect: without a further safeguard, the retained bracket width need not shrink by a prescribed factor.
Suppose \(f\) is strictly increasing and convex and has root \(r\). Its chord lies above the graph. At the chord root \(c\), therefore, \(f(c)\le0\), which places \(c\le r\). Every false-position update may replace the lower endpoint while leaving the upper one fixed. The false-position estimates themselves can still approach the root. But a stopping rule requiring a narrow bracketing interval can then fail to terminate. The distinction separates convergence of a point estimate from convergence of both bounds in a certified interval.
Prevent a distant high-value endpoint from pinning the search
For \(f(x)=x^{10}-1\) on \([0,2]\), the endpoint values are −1 and 1023. The first false-position estimate is \(2/1024=1/512\), with function value indistinguishable from −1 to ordinary displayed precision. The second estimate lies near \(1/512+(2-1/512)/1024\approx0.003904\), although the true root is one. Both steps satisfy the strict interior condition; neither meaningfully resolves the enormous function variation near the right endpoint. Bisection happens to land exactly on the root here, making the consequences of this imbalance especially easy to measure.
One safeguard accepts a secant candidate only if it lies in the central half of the current bracket. Otherwise it takes the midpoint. With exact reliable signs, accepting any point between the one-quarter and three-quarter positions guarantees the retained width is at most three quarters of its old value. A midpoint fallback cuts it in half. Thus after \(k\) accepted or fallback steps the bracket width is bounded by \((3/4)^k(b-a)\), whether or not the slope model reflects the underlying function.
To test the policy away from this exact midpoint coincidence, shift the equation to \(x^{10}-1.1=0\) on the same interval. The initial chord estimate becomes \(2(1.1)/1024\), below the central half, so the method takes one and obtains residual −0.1. The next bracket is \([1,2]\), immediately discarding the whole range of tiny false-position candidates. A steeply varying function still calls for careful arithmetic in forming the chord, especially if endpoint values approach overflow. If field measurements cannot determine the sign at an accepted point, none of these purely geometric safeguards certifies which side to retain.
The shifted root is \(1.1^{1/10}\approx1.00958\), so the first midpoint is already close despite keeping a relatively wide bracket. This again separates observed point accuracy from the available certificate. Subsequent safeguarded steps can tighten the certificate without relying on advance knowledge of this exact value.
Compare a midpoint’s actual error with its certificate
Bracket the positive root of \(x^3-2\) on [1,2]. At each step record both the midpoint’s distance to the analytic cube root and the half-width of the current sign-changing interval. Only the latter is known in a general application.

Read values from the plot
| Bisection step, starting at zero | Certified half-width | Actual midpoint error |
|---|---|---|
| 0 | 0.5 | 0.24008 |
| 3 | 0.0625 | 0.052579 |
| 6 | 0.0078125 | 0.0021085 |
| 10 | 0.00048828 | 0.00033286 |
| 13 | 6.1035e−5 | 2.7681e−5 |
Change parameters · Compare a midpoint’s actual error with its certificate
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Chapter 2 · Fixed-point iteration and contraction
Select an iteration map for a nonlinear balance, prove convergence on an invariant interval and use an observed increment to bound the remaining error.
From first principles
Bound fixed-point error by a geometric series
Rearrange an equation as \(x=g(x)\) and repeatedly set \(x_{k+1}=g(x_k)\). Suppose a closed interval contains the initial point, maps into itself under \(g\), and has a uniform slope bound \(|g'|\le q<1\). The mean value theorem gives
Successive increments therefore form a geometrically bounded series. Their sum converges, and the limit lies in the closed interval and is a fixed point by continuity. Two distinct fixed points would contradict the same contraction inequality. At step \(k\ge1\), summing the remaining increments gives the a posteriori estimate
A small observed update is meaningful only in relation to the contraction factor. When \(q\) is close to one, many small updates may still remain.
Background · Contraction
The map must also keep the chosen complete region invariant to obtain the standard fixed-point guarantee.
Derivation and applications
Choose a relaxation parameter from verified slope bounds
A fixed-point iteration can oscillate if the derivative of its update is negative, or move slowly if it stays near one. Suppose \(g\) is differentiable on an interval with \(a\le g'(x)\le b<1\), where \(a\) may be less than \(-1\). Form a relaxed map \(G_\omega(x)=x+\omega(g(x)-x)\) with \(\omega>0\). Every fixed point of one map is a fixed point of the other. The derivative transforms affinely,
Both bounds inside the final interval are positive. The largest allowed magnitude of \(G_\omega'\) is attained at one of its endpoints. Equalizing the signed endpoint derivatives with opposite signs gives the optimal common parameter and bound,
The denominator exceeds the numerator because \(b<1\). A usable global contraction certificate also requires the relaxed map to preserve the chosen domain. If a closed interval is centred at \(c\) with radius \(R\), the slope bound gives a convenient sufficient condition:
This last condition can fail even when the derivative bound is excellent. In such a case the slope bounds outside the verified interval would be unknown.
Worked example
Stabilize a map with an oscillatory steep branch
Suppose \(g'\in[-3,0.5]\) on a verified domain. The unrelaxed iteration can amplify error by a factor of three. Choose \(\omega_*=2/4.5=4/9\), giving endpoint derivatives \(-7/9\) and \(7/9\). If the interval radius is 2 and the relaxed centre moves by \(0.20\), the domain check gives
Both invariance and contraction are then certified.
Second application
Accelerate a map with uniformly positive slopes
In a second model \(g'\in[0.6,0.8]\). The optimal relaxed map uses \(\omega_*=2/0.6=10/3\), an extrapolation beyond the ordinary update. The slope bound falls to \(q_*=1/3\). Assuming the domain condition is independently verified, five steps reduce an initial location error of at most \(0.10\) to \(0.10/3^5=0.000412\). With the unrelaxed slope bound the corresponding guarantee is only \(0.0328\).
An equation can have several iteration maps
A fixed point satisfies \(x=g(x)\), but the rearrangement chosen for \(g\) is an algorithmic decision. A temperature balance might be written as a source update, a loss inversion or a relaxed combination of both. Every rearrangement can represent the same root and yet produce a different sequence from the same initial measurement. To judge the proposed sequence, examine how perturbations are propagated before investing in detailed model evaluations.
Let \(g\) map a closed interval \(I\) into itself, and suppose \(|g'(x)|\leq q<1\) there. Then \(|g(x)-g(y)|\leq q|x-y|\) by the mean value theorem. Starting from \(x_0\in I\), all iterates stay in \(I\). Successive changes shrink at least geometrically:
Summing the remaining geometric tail shows that the sequence is Cauchy. Its limit belongs to the closed interval, and continuity gives \(r=g(r)\). Two distinct fixed points would violate the strict contraction inequality, establishing uniqueness.
Estimate what remains after an observed update
The tail estimate gives
If only the last completed increment is available,
This is an a posteriori bound from the actual run and a proved Lipschitz constant. If \(q\) is very near one, small increments provide weak information: the remaining sum of many small changes can still be large. Invariance and contraction over a range should be distinguished from a local derivative estimate at one guessed solution.
For \(x^2+x-1=0\), take \(g(x)=1/(1+x)\) on \(I=[0.5,1]\). Its image \([0.5,2/3]\) lies within \(I\), and \(|g'|\leq4/9\). From \(x_0=1\), the sequence begins \(0.5,2/3,3/5,5/8\). The oscillation about the limit reflects the negative derivative. At \(x_4=0.625\), the last increment is 0.025, giving error at most \((4/9)/(5/9)\times0.025=0.020\). The exact root \((\sqrt5-1)/2\simeq0.61803\) confirms the guarantee is conservative.
Try a relaxed update
The alternative arrangement \(g_2(x)=1-x^2\) has slope \(-2r\simeq-1.236\) at the same positive root. Arbitrarily small generic perturbations grow under this unrelaxed iteration. The equivalent equation alone cannot make it reliable. Form a relaxed map \(g_\omega(x)=(1-\omega)x+\omega g_2(x)\). Its local multiplier is \(1-\omega+\omega g'_2(r)\). Choosing \(\omega=1/2\) changes that multiplier to approximately \(-0.118\).
In fact \(g_{1/2}'=0.5-x\) on \([0.5,1]\), so its magnitude is at most 0.5. The map sends the endpoints to 0.625 and 0.5, is decreasing on this interval, and remains inside it. This establishes global contraction on that range. Local cancellation could be made still stronger by tailoring \(\omega\) to an estimated derivative, but an inaccurate estimate can move the iteration outside the verified interval. A relaxation factor is a numerical parameter; changing it should alter convergence behaviour while leaving a converged physical state unchanged.
Transfer the same reasoning to two coupled states
For a vector iteration, a matrix norm bound replaces the scalar derivative bound. Consider \(g(x,y)=(0.2x+0.3y+1,\ 0.1x+0.4y+2)\). In the infinity norm the largest absolute row sum is 0.5. Subtraction of two evaluations therefore shows \(\|g(z)-g(w)\|_\infty\leq0.5\|z-w\|_\infty\), so the map contracts on all of \(\mathbb R^2\). Starting from zero the first two iterates are \((1,2)\) and \((1.8,2.9)\). The completed second increment has norm 0.9, bounding the remaining error by \(0.5(0.9)/(1-0.5)=0.9\).
Solving the two fixed-point equations gives \(x=8/3,\ y=34/9\), so the actual infinity-norm error after the second update is about 0.878. The bound is fairly sharp here. If the two state variables have different units, scale them before combining them into one maximum norm. The scale choice affects the usefulness of a contraction certificate while a converged balance still satisfies the same physical equations.
Check the invariant domain
A map can have derivative smaller than one on a chosen interval yet send its iterates outside it. For example \(g(x)=x/2+2\) has derivative one half on \([0,1]\) but maps zero to two. The usual contraction proof on that interval cannot even form its second iterate there. The same map on the full real line is a contraction with fixed point four. Domain and norm are part of a convergence certificate.
Eliminate a geometric error using three iterates
For a scalar iteration near a linearly attracting fixed point, successive errors often behave approximately as \(e_{k+1}=q e_k\). If the relation is exact with \(q\ne1\), three successive observations \(x_0,x_1,x_2\) determine both the geometric factor and the limiting state. The difference ratio \((x_2-x_1)/(x_1-x_0)\) equals \(q\). Summing the remaining geometric series, or eliminating \(q\) algebraically, gives the accelerated value \(x_0-(x_1-x_0)^2/(x_2-2x_1+x_0)\), provided the denominator is nonzero.
This expression is Aitken's delta-squared transformation. For a smooth nonlinear fixed-point map, the exact geometric relation is replaced by a first-order Taylor approximation about a simple fixed point. Taking \(x_1=g(x_0)\), \(x_2=g(x_1)\) and restarting from the accelerated value produces Steffensen iteration. Its local quadratic behaviour requires sufficient smoothness and \(g'(r)\ne1\). Indeed the denominator is asymptotically \((g'(r)-1)^2(x_0-r)\). If that coefficient is tiny or if function evaluations are inaccurate, two successive differences can suffer more cancellation than the fixed-point step itself.
Quantify both the gain and the sensitivity
A sensor calibration fixed point satisfies
Starting at zero gives \(x_1=1\) and \(x_2=1.8\). The second difference is −0.2, so the accelerated value is \(0-1^2/(-0.2)=5\), exactly the fixed point. Ordinary iteration still has error \(5-1.8=3.2\) at this same two-evaluation budget. Here the gain is exact because the iteration contains a single geometric mode with the same factor at every distance from the root.
Perturb only the reported second iterate from 1.8 to 1.81. The inferred limit rises to \(1/0.19\approx5.263\). A perturbation of 0.01 has moved the extrapolated estimate by 0.263. Differentiating the transformed estimate with respect to \(x_2\), holding the first two values fixed, gives magnitude \((x_1-x_0)^2/(x_2-2x_1+x_0)^2=25\) at the unperturbed readings. The predicted change of 0.25 is close to the actual result. The apparent speedup has been purchased with sensitivity to slight deviations from a geometric trend.
A residual check distinguishes these two cases without knowing the exact solution. The exact extrapolated value satisfies \(g(5)-5=0\). At the perturbed estimate the residual is about −0.0526, much larger than machine precision. For a reliable contraction factor 0.8 this implies an absolute error bound about 0.263 by dividing by \(1-0.8\). In a vector problem different modes generally have different convergence factors. Applying this scalar extrapolation separately to raw components may be unreliable when those components mix modes or when a denominator crosses zero in just one coordinate.
There is a second failure mode when the original map is nearly the identity. For \(g(x)=0.999x+0.001\), starting from zero gives 0.001 and 0.001999. The second difference is only \(-10^{-6}\). If observations are stored to three decimal places, the two reported values become 0.001 and 0.002 and the computed denominator vanishes. This behaviour is predictable from the accuracy of the acquisition and does not indicate that the underlying iteration lacks a fixed point.
Choose a relaxation that contracts both modes
Near a root let the Jacobian be symmetric with eigenvalues 0.5 and 2, and use \(x^+=x-\omega F(x)\). Its two independent error modes have factors \(1-\omega\lambda_i\). Minimise the larger magnitude, allowing a sign reversal in one mode.

Read values from the plot
| Relaxation parameter | Eigenvalue 0.5 | Eigenvalue 2 | Worst of both |
|---|---|---|---|
| 0.05 | 0.975 | 0.9 | 0.975 |
| 0.375 | 0.8125 | 0.25 | 0.8125 |
| 0.7 | 0.65 | 0.4 | 0.65 |
| 1.025 | 0.4875 | 1.05 | 1.05 |
| 1.35 | 0.325 | 1.7 | 1.7 |
Change parameters · Choose a relaxation that contracts both modes
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Study the full derivation
Accelerating fixed points with differences of residuals · Nonlinear systems and iterative methods
A slowly convergent physical iteration contains information in the direction of successive errors. Use a scalar extrapolation and a small residual-minimisation problem to exploit that information, then test the extrapolated state against the original equation.
Problem sheet 1 · Isolating and iterating roots
Use a verified interval to certify one solution, recognise the effect of a transformation on convergence and quantify a stopping rule.
Find a root within a specified distance
Show that \(F(x)=x+\ln x-2\) has exactly one root in \([1,2]\). Carry out two bisections. Determine how many halvings guarantee an absolute midpoint error below 0.001, and give a slope-based error bound for the trial value \(x=1.56\).
Worked solution
At 1 the residual is −1, while \(F(2)=\ln2>0\). Its derivative \(1+1/x\) is at least 1.5 throughout, giving strict monotonicity. At 1.5 the residual is approximately −0.0945 and at 1.75 it is +0.3096, so after two halvings the bracket is \([1.5,1.75]\).
The initial width is one. After nine halvings the midpoint bound is \(1/1024<0.001\). At \(x=1.56\), \(F\simeq0.004686\). The mean value bound gives an error at most \(0.004686/1.5=0.00313\), assuming the exact logarithm on the stated bracket.
Explore the related calculation with adjustable inputs. Compare actual root error with the shrinking bracket certificate. The explorer uses a cubic test residual; the continuity and slope checks in this exercise must still be carried out for its stated residual.
Compare two rearrangements
For \(x^2-3=0\) on \([1,2]\), consider \(g_1=3/x\) and \(g_2=(x+3/x)/2\). Starting at \(x_0=1.5\), compute two steps of each. Use the local derivatives to explain the different histories.
Worked solution
The first map produces 2, then 1.5, because applying the reciprocal transformation twice returns the start. At \(r=\sqrt3\) its derivative is \(-3/r^2=-1\). The second map first gives 1.75, then
At the root \(g_2'=(1-3/x^2)/2=0\), which cancels the linear error term. In particular, a fixed point for either formulation solves the original equation, but a repeated two-cycle of \(g_1\) need not solve it.
Explore the related calculation with adjustable inputs. Explore how initial values and the residual slope affect Newton and secant convergence on the quadratic reference problem; retain the stated residual when checking the present hand calculation.
Interpret a small update
A contraction with known factor at most 0.95 has just changed its state by 0.002 K. Bound the current state error. How small must the next completed increment be to certify 0.01 K by the same test? Explain why stopping at a fixed increment of 0.01 K would be misleading.
Worked solution
Summing the future geometric changes from the current iterate gives a bound \(q|\Delta x|/(1-q)=19(0.002)=0.038\) K. To guarantee 0.01 K requires \(|\Delta x|\leq0.01/19\simeq0.000526\) K.
For a slowly contracting process small updates can continue in the same direction over many iterations. A rule using the increment alone ignores that accumulated tail.
Explore the related calculation with adjustable inputs. Vary the contraction slope and compare the remaining error after a fixed evaluation budget.
Notebook practice · A bracket can collapse onto a pole
Chapter 3 · Newton and secant updates
Derive derivative-based and derivative-free updates, measure their convergence near a simple zero and explain why a repeated zero changes the convergence order.
From first principles
Build one root correction from a local line
Suppose \(f\) is differentiable near a root and a trial point \(x_k\) has a nonzero derivative. Taylor expansion models the function a short displacement \(s\) away by \(f(x_k)+f'(x_k)s\). Requiring this local line to vanish gives Newton’s update,
The true new residual is the nonlinear remainder. For twice continuously differentiable \(f\) and a segment where \(|f''|\le M\), Taylor’s theorem yields
Converting residual to a location error also requires a lower bound on \(|f'|\) near the root. If derivatives are unavailable, estimate the local slope by \([f(x_k)-f(x_{k-1})]/[x_k-x_{k-1}]\) to obtain the secant method. Its denominator must be resolved numerically. Both methods need caution far from the root, where the line can extrapolate outside the region where it represents the function.
Derivation and applications
Recover the multiplicity of a root from derivative measurements
At a multiple zero, the ordinary Newton step no longer removes the leading location error. Suppose \(f(x)=(x-r)^m h(x)\), with integer \(m\ge1\), smooth \(h\) and \(h(r)\ne0\). Write \(e=x-r\). Differentiating the product and keeping the leading powers gives
It follows that ordinary Newton leaves the fraction \(1-1/m\) of the error to first order. For known \(m\), multiplying the Newton correction by \(m\) cancels the leading error. When multiplicity is unknown, consider the auxiliary function \(u=f/f'\), which has a simple zero after continuous extension to \(r\). Its derivative and Newton correction are
The leading powers in the twice differentiated product give a local diagnostic,
Far from the zero the inferred value need not be integral or even positive. Near a flat root both derivatives and the function value can become very small, so the ratio needs sufficiently accurate evaluations. The derivation gives a local method and does not establish that a distant initial guess will enter its convergence region.
Worked example
Recover a triple zero from one set of values
For \(f(x)=(x-2)^3\) at \(x=2.2\), \(f=0.008\), \(f'=0.12\), \(f''=1.2\). The diagnostic gives
The ordinary Newton step lands at \(2.13333\), while multiplying its correction by three gives 2 exactly because \(h\) is constant.
Second application
Check the effect of a changing smooth factor
For a different function \(f(x)=x^2(1+x)\) at \(x=0.1\), the three values are \(0.011,0.23,2.6\). The apparent multiplicity is
Newton on \(u\) gives
Crossing the zero is consistent with the curvature of \(u\); the absolute location error nevertheless drops by a factor exceeding 24.
Start from this chapter. Differentiate the fourth-power loss in the implicit temperature residual. Predict which change alters the physical root: changing the time step or changing the Newton update.
OneSimulation laboratory · Locate the root of an implicit cooling step
Linearise the residual where you stand
Suppose a scalar balance \(F(x)=0\) is smooth, with a simple root \(r\), meaning \(F'(r)\ne0\). Replacing the unknown function by its tangent at a current estimate \(x_k\) gives
Hence \(x_{k+1}=x_k-F(x_k)/F'(x_k)\). The quotient has units of the unknown variable. When it is used in a coupled thermal model, for instance, a mismatch in watts divided by a derivative in W/K produces a temperature correction.
Assume both the current iterate and the root lie where \(|F''|\leq M\) and \(|F'|\geq m>0\). Taylor expand \(F(r)\) about \(x_k\) and insert the Newton update to obtain
For sufficiently small initial error the next iterate stays in the same neighbourhood and its error is of quadratic order. This is a local conclusion. A nearly horizontal tangent far away can give a huge update even when the desired root is simple.
Calculate the improvement explicitly
For \(F(x)=x^2-2\), Newton’s update is \((x+2/x)/2\). From 1.5 it gives \(17/12=1.4166667\), then
The absolute errors fall from approximately 0.08579 to 0.002453 and then to \(2.12\times10^{-6}\). An exact identity explains these figures:
The positive sequence stays on the high side after the first update and approaches the physically selected positive root.
When analytic derivatives are expensive, replace \(F'(x_k)\) by the slope between \(x_k\) and \(x_{k-1}\). The resulting secant update uses two initial estimates and only one new residual evaluation per subsequent step. For the same quadratic, the divided difference is exactly \(x_k+x_{k-1}\); algebra gives
where \(e_j=x_j-\sqrt2\). Near the root the denominator is nearly constant. If \(e_{k+1}\) scales as \(e_k^p\), consistency with the product relation gives
The positive solution is about 1.618, superlinear but less than two.
Examine a root of higher multiplicity
For \(F(x)=(x-r)^m\), the tangent correction is only \((x-r)/m\). Newton therefore leaves \(e_{k+1}=(1-1/m)e_k\), a fixed linear reduction. With \(m=3\) and an initial error of 0.3, the first two errors are 0.2 and 0.13333. Meanwhile the residual is cubed, so even a small residual may mask appreciable positional error. Multiplying the Newton correction by \(m\) restores the exact root in one step for this pure power and restores quadratic convergence more generally when the multiplicity is known and the remaining factor is smooth and nonzero.
Numerically differentiating a residual introduces its own scale. For the forward difference \([F(x+s)-F(x)]/s\), Taylor truncation decreases as \(O(s)\), while rounding or evaluation noise in the numerator is divided by \(s\). Blindly shrinking \(s\) can therefore spoil the derivative. Recompute at a second scale, compare with an analytic derivative when available, and check the final state against the original balance. A derivative that is accurate near the starting point need not stay accurate along the entire sequence.
Background · How can the iterates suggest a multiplicity?
Suppose an isolated root has multiplicity \(m>1\), so \(f(x)=(x-r)^m g(x)\) with smooth \(g(r)\ne0\). Dividing the function by its derivative shows that the leading Newton correction is \((x-r)/m\). Sufficiently near the root, successive corrections therefore obey
A sustained ratio of about \(2/3\) suggests a triple root. A single such ratio is weak evidence: a line search that repeatedly accepts one third of a full step can produce linear convergence even near a simple root. Check the actual step acceptance and the residual model before multiplying all subsequent corrections by three. Ratios of corrections also become unreliable once their sizes approach floating-point resolution.
Set stopping tests that survive a change of units
Multiplying a residual by a nonzero constant \(c\) leaves a Newton correction unchanged because both the residual and its derivative acquire that factor. Secant updates have the same invariance. An absolute stopping threshold on the residual alone, however, changes its meaning by \(c\). For \(F=x^2-2\) the trial \(x=1.414\) has \(|F|\simeq0.000604\). Reporting the equivalent balance as \(1000F\) gives a mismatch about 0.604, with the identical prospective Newton step.
A useful report contains a scaled residual, the size of the accepted update in variable units and the conditions used to leave the iteration. Near a simple root a final undamped correction estimates the remaining positional error to first order. A small damped correction can equally be the consequence of a line search rejecting progress. Recheck the undamped balance or a bracket before treating a tiny change in the displayed state as convergence.
Prove a local quadratic bound with an explicit radius
Let \(r\) be a simple root of a twice differentiable scalar \(f\). On a surrounding interval suppose \(|f'|\ge m>0\) and \(|f''|\le M\). Taylor expansion about a trial point \(x\) gives \(0=f(r)=f(x)+f'(x)(r-x)+f''(\xi)(r-x)^2/2\) for an intermediate \(\xi\). Subtract the exact root from the Newton update \(x_+=x-f(x)/f'(x)\). The linear terms cancel and \(|x_+-r|\le [M/(2m)]|x-r|^2\). This supplies both the mechanism and a coefficient for the familiar quadratic statement.
The constants must continue to hold at every iterate. If the closed ball of radius \(R\) about the root lies in the stated interval and \(MR/(2m)<1\), any starting point in that ball maps strictly closer to the root and remains in the ball. Repeating the bound is then justified by induction. Without such an invariant region, a single Taylor estimate says nothing about what happens after a step leaves the region of controlled derivatives. A relative update tolerance cannot substitute for a verified lower derivative bound near a flat or multiple root.
Certify a square root and assess an inexact division
For \(f(x)=x^2-9\), use the interval \([2,4]\), root three, \(m=4\), \(M=2\). The resulting quadratic error coefficient is \(1/4\). From \(x_0=2.4\) the true initial error is 0.6 and the first error is bounded by 0.09. The actual Newton update is \((2.4+9/2.4)/2=3.075\), leaving error 0.075. The next bound using the actual first error is
Independently the exact update error obeys \((x-3)^2/(2x)\), giving \(0.075^2/(2\cdot3.075)\approx0.0009146\). The guaranteed number is larger because it allows the smallest derivative on the whole interval.
Now suppose the computed Newton update has an additional absolute rounding uncertainty of \(10^{-4}\) each time. The same reasoning gives
Once \(|e|\) falls below roughly 0.02, the allowed update uncertainty exceeds the quadratic contribution. Continuing iterations can still help, but the mathematical inequality no longer promises a doubling of correct digits. This transition is visible from the size of the actual input and evaluation errors and should not be fitted away as a mysterious change of convergence order.
A final distance certificate can avoid using the exact root in a real calculation. If a sign-changing bracket is known to contain the root and \(|f'|\ge4\) throughout it, then \(|x-r|\le|f(x)|/4\) for a point \(x\) inside the bracket. The local Newton proof and the residual-based certificate therefore serve complementary roles: one predicts improvement per iteration, while the other assesses the current uncertainty from computable information.
In the same square-root example a residual of 0.0008 with the iterate inside \([2,4]\) certifies error at most 0.0002, even without relying on observed convergence ratios. If one instead used the interval \([-4,4]\), the derivative lower bound would be zero and the same residual could not tell which of the two roots was nearby. Certifying a branch is part of certifying a distance.
Change parameters · Newton and secant updates
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Study the full derivation
Choosing a derivative step in a nonlinear solve · Nonlinear systems and iterative methods
A smaller finite-difference step eventually makes Newton iterations worse. Derive truncation and evaluation errors, compare a complex perturbation and a directional derivative, and test which numerical derivative is meaningful for the actual residual implementation.
Chapter 4 · Newton’s method for coupled balances
Assemble a Jacobian from two coupled residuals, solve for a simultaneous correction and interpret how scaling changes the meaning of a norm.
From first principles
Derive simultaneous corrections from all balance equations
Suppose two unknowns \(u,v\) must satisfy residual equations \(F_1(u,v)=0,\ F_2(u,v)=0\). Changing either unknown can affect both balances. Expand each residual around the same trial state \(x=(u,v)^T\), with a small proposed correction \(s\). The partial derivatives form the Jacobian \(J\),
If the derivatives are locally Lipschitz and the linear model is reliable, choose the correction that cancels both leading residuals together,
A nonsingular Jacobian guarantees a unique local correction. Solving the system directly avoids constructing its inverse. A final small residual can only establish accurate state variables if the balances are sufficiently sensitive to changes in those variables. Scaling each quantity by a physically meaningful reference helps distinguish genuine insensitivity from a misleading comparison between different units.
Background · Newton correction
The correction solves a local linear model. Quadratic local convergence needs a suitable nonsingular derivative and a sufficiently close starting point.
Derivation and applications
Eliminate a coupled balance without losing its derivative
Some models contain one equation that can be solved quickly for an auxiliary variable. Suppose \(F(u,v)=0,\ G(u,v)=0\) and, locally, \(G_v\ne0\). If the auxiliary equation gives \(v=g(u)\), the reduced residual is
Differentiating \(G(u,g(u))=0\) first accounts for the effect of a changed \(u\) on the auxiliary state,
This same combination arises even when the current auxiliary state is not perfectly equilibrated. The full two-row Newton system gives a formula for the auxiliary correction from the second row. Substituting it into the first row yields
At an equilibrated state \(G=0\), this is exactly Newton’s scalar step for \(H\). The second row’s imbalance contributes to the right-hand side otherwise. The determinant identity
shows why an apparently harmless derivative \(F_u\) can hide a nearly singular coupled model. After a finite step, directly recomputing \(g(u+\delta u)\) can differ from \(v+\delta v\) by a second-order term when \(g\) is curved. Both choices share the same first-order model.
Worked example
Calculate a simultaneous correction from an imbalanced state
Take \(F=u+2v-5,\ G=v-u^2\), initially \((u,v)=(1,0.8)\). Then
The reduced derivative is 5 and the corrected right side is
Thus
The new state \((1.4,1.8)\) satisfies the linear \(F\) balance exactly; the remaining \(G=-0.16\) is the neglected quadratic term.
Second application
Identify a cancellation in a reduced slope
In a second model \(F=2u-v-1,\ G=v-1.99u\). The individual slope \(F_u=2\), but eliminating \(v\) leaves \(H(u)=0.01u-1\). Starting at zero the correct Newton correction is 100, giving \(v=199\), an exact solution of both linear balances. Using the partial slope of 2 while holding \(v\) fixed would instead propose \(u=0.5\) and miss the compensating response.
Linearise the whole model at one state
Two unknown physical quantities may influence both measured balances. Changing one to erase one residual can disrupt the other. The vector Taylor expansion \(F(x+s)=F(x)+J(x)s+O(\|s\|^2)\) collects the simultaneous first-order response. Entry \(J_{ij}\) is the derivative of residual \(i\) with respect to unknown \(j\) while holding the other unknowns fixed. A Newton step solves the linear system \(J(x)s=-F(x)\) and sets \(x_{new}=x+s\). Factor or iteratively solve that system rather than explicitly computing an inverse.
Suppose \(J\) is Lipschitz with constant \(L\) near a root, and the inverses in that neighbourhood satisfy
Integrate \(J\) along the line from the current point to the root. The error left by replacing \(J\) with its value at the start is bounded by \(L\|x-r\|^2/2\). Multiplying by the inverse yields the local Newton bound \(KL\|x-r\|^2/2\). This derivation makes explicit which objects must stay well behaved: derivative variation and amplification by the linear solve.
Intersect an energy constraint with a matching condition
Take the dimensionless equations \(F_1=x^2+y^2-1,\ F_2=x-y\), and choose the positive branch. The linearised system at \((0.8,0.6)\) has \(F=(0,0.2)\) and rows \((1.6,1.2),(1,-1)\). The point already lies on the unit circle but violates matching. Newton requires
substituting in the first row gives \(2.8s_x=-0.24\). Thus \(s_x=-0.0857143,\ s_y=0.114286\) and the new state is \((5/7,5/7)\).
The linear constraint is now exact. The circle residual is \(2(5/7)^2-1=1/49\), a second-order consequence of moving along its tangent rather than along the circle itself. At the next iteration the two corrections are equal. Solving \((20/7)s=-1/49\) gives \(s=-1/140\), hence
The desired value is
A different initial state could lead to the negative intersection. Physical admissibility must therefore supplement the algebraic equations.
Quantify the cost of freezing a Jacobian
A new Jacobian factorisation at every iterate can dominate the work of solving a coupled equilibrium. Fix \(B=J(x_0)\), factor it once, and take \(x_{k+1}=x_k-B^{-1}F(x_k)\). Near a simple root \(r\) write \(e=x-r\). Taylor expansion gives
With a current exact Jacobian the first-order term vanishes. A frozen Jacobian normally retains it, so convergence is generally linear and even local convergence requires control of this iteration matrix. A sufficient condition on a neighbourhood is \(\sup_x\|I-B^{-1}J(x)\|<1\), together with an invariant neighbourhood.
Consider \(F(x,y)=(x^2+y-3,x-y)^T\), starting at \((1,1)\). The fixed matrix has rows \((2,1)\) and \((1,-1)\). The second residual remains zero if both coordinates change equally. On that line the correction satisfies
The first increment is \(1/3\). The new first residual is \(1/9\). Reusing the factors gives the next increment \(-1/27\) and the state \(x=y=35/27\approx1.29630\). Refactoring at \(4/3\) would instead give increment \(-1/33\), reaching \(43/33\approx1.30303\). The exact positive root is \((\sqrt{13}-1)/2\approx1.30278\).
The local error multiplier along this line is \(1-\sqrt{13}/3\approx-0.202\), predicting alternating errors for the frozen calculation. Reusing a poor factorisation indefinitely can cost more residual evaluations than it saves. Compare actual reduction against the expected local factor and refresh the Jacobian when model changes make reuse ineffective.
Practise on sheet 2 · Decide when a reused slope is still informative. Further reading · ETH Zürich · Numerical Methods for Computational Science and Engineering · Remark 8.5.1.43, Simplified Newton method, and Code 8.5.1.44, p. 625.
Select scales and verify a derivative action
Changing units from metres to millimetres multiplies the displayed displacement by 1000 without changing the model. Yet an unscaled Euclidean norm of a state mixing displacement and temperature can then change radically. Choose characteristic scales in a positive diagonal matrix \(D_x\) and residual scales \(D_F\). Form the dimensionless unknown \(z=D_x^{-1}x\) and residual \(G=D_F^{-1}F(D_xz)\). By the chain rule \(J_G=D_F^{-1}J_FD_x\). For an exact undamped Newton solve this produces the same physical correction, but stopping tests, trust regions and finite differences now acquire interpretable scales.
To check a programmed Jacobian, choose a direction \(d\) with nonzero entries in multiple unknowns and compare \(Jd\) with \([F(x+sd)-F(x)]/s\) over several \(s\). For the circle constraint the discrepancy is exactly \(s(d_x^2+d_y^2)\), while for the linear matching condition it is zero in exact arithmetic. A one-direction check can miss a coding error orthogonal to that direction. Try additional directions emphasizing different couplings, keeping clear of nonsmooth switches. This test inspects the local derivative independently of the solver’s final residual.
Separate state sensitivity from linearisation error
Suppose the matching constraint in the intersection example is perturbed to \(x-y=\epsilon\), while the unit-circle measurement remains exact. About the positive root \(x=y=1/\sqrt2\), differentiating the circle implies \(\delta x+\delta y=0\). Differentiating the matching constraint gives
Thus a measurement offset of 0.02 moves the coordinates by approximately \(+0.01\) and \(-0.01\), even if the perturbed nonlinear equations are solved to roundoff.
Geometrically, uncertainty becomes much larger when the two constraint curves meet almost tangentially. Their Jacobian rows then point in nearly the same direction, leaving a poorly resolved transverse displacement. Reducing the Newton tolerance improves the algebraic solution of the supplied measurements, but cannot increase their independence. Inspecting singular directions of the scaled Jacobian near the converged state helps distinguish this physical uncertainty from difficulties caused by a poor initial guess.
Analyse the basins of a coupled two-dimensional problem
Identify a real state \((x,y)\) with \(z=x+iy\). Solving \(z^2-1=0\) is equivalent to solving \(x^2-y^2-1=0,\ 2xy=0\) for two real unknowns. The real Jacobian has rows \((2x,-2y)\) and \((2y,2x)\), with determinant \(4(x^2+y^2)\). It is nonsingular away from the origin. Complex division by \(2z\) implements exactly the real Newton correction for this system. Therefore the full update is \(N(z)=(z+1/z)/2\), and both roots \(+1\) and \(-1\) have local quadratic convergence.
To determine which root is selected, set \(w=(z-1)/(z+1)\), excluding the already solved point \(-1\). Direct substitution shows \(N(z)-1=(z-1)^2/(2z)\) and \(N(z)+1=(z+1)^2/(2z)\). Dividing yields
Hence \(w_k=w_0^{2^k}\) as long as the updates remain defined. If \(|w_0|<1\), this tends to zero and \(z=(1+w)/(1-w)\) tends to one. The condition means the starting point is closer to \(+1\) than to \(-1\), precisely the open right half-plane. The left half-plane similarly converges to the other root.
Predict a basin and trace a boundary failure
Start at \(z_0=1+i\), so
The first update is
Its inverse equals \(1.2-0.4i\), giving \(z_2=0.975-0.075i\). The iterates moved from above to below the real axis, but both remained in the basin of \(+1\). In transformed coordinates \(w_0=i/(2+i)=(1+2i)/5\), of magnitude \(1/\sqrt5\); after two steps the magnitude is \(1/25\). This quantifies progress without estimating the distance from \(z_1\) to either root by visual inspection.
The basin boundary is completely different. For \(z_0=i\), the first update is zero and the next Jacobian is singular. More generally a purely imaginary nonzero start remains purely imaginary for as long as the map is defined, because both \(z\) and \(1/z\) have zero real part. It cannot converge to either real root while staying on this line. Infinitesimal perturbations toward opposite sides of the line select different roots. A solver reporting a converged root from a point numerically very close to this boundary should identify which initial or rounding perturbations could change that result.
This example makes global multiplicity observable in a system whose local steps are cheap and whose Jacobian is invertible almost everywhere. A small final residual confirms that the reported state solves the equations. It says little about whether the originally intended physical branch was selected. Additional physical conditions or a continuation path from a known state can supply information that the equations and a nominal starting vector alone do not specify.
Initial guesses only \(10^{-6}\) to the right and left of the imaginary axis can therefore give final real parts differing by two. That discontinuity concerns the map from starting guess to selected solution, not a discontinuity of the original polynomial equations. It is one reason to report how physical branch selection was imposed when several roots correspond to substantially different states, even when every final residual is small.
Change parameters · Explore the worked calculation
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Study the full derivation
Choosing a derivative step in a nonlinear solve · Nonlinear systems and iterative methods
A smaller finite-difference step eventually makes Newton iterations worse. Derive truncation and evaluation errors, compare a complex perturbation and a directional derivative, and test which numerical derivative is meaningful for the actual residual implementation.
Problem sheet 2 · Tangents and Jacobians
Compute scalar, secant and coupled Newton corrections, and test what an incorrectly assembled derivative changes.
Use the secant on a cubic
For \(F(x)=x^3-3\), use the two starts \(x_0=1\) and \(x_1=2\). Find the next secant iterate, compare it with one Newton update from 2, and evaluate both residuals. Does one comparison prove an asymptotic convergence order?
Worked solution
The secant slope is \((5-(-2))/(2-1)=7\), giving \(x_2=2-5/7=9/7\) and residual \(729/343-3\simeq-0.875\). Newton uses slope 12, giving \(19/12\simeq1.58333\) and residual \(6859/1728-3\simeq0.970\).
The methods take corrections from different local models. One residual comparison on early iterates does not establish their asymptotic rates, which concern successive errors near the root.
Explore the related calculation with adjustable inputs. Explore how initial values and the residual slope affect Newton and secant convergence on the quadratic reference problem; retain the stated residual when checking the present hand calculation.
Locate two coupled unknowns
Take \(F_1=x^2+y-3,\ F_2=x+y^2-3\). At \(x=y=1\), compute the Jacobian and full Newton update. Compare the residual after that update with the result of dropping both coupling terms from the Jacobian.
Worked solution
The residual is \((-1,-1)\) and \(J=\left(\begin{smallmatrix}2&1\\1&2\end{smallmatrix}\right)\). Symmetry gives \(s_x=s_y=1/3\), hence
Both new residuals equal \(1/9\).
Dropping the off-diagonal entries instead gives \(s_x=s_y=1/2\), landing at 1.5 in both coordinates with residual \(0.75\) in each row. The uncoupled derivative overestimates the correction because each unknown changes both balances.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Roundoff in a derivative test
Estimate the derivative of \(F(x)=x^2-2\) at 1.5 using a forward quotient with positive step \(s\). Derive the exact truncation error and suppose arithmetic introduces absolute numerator error at most \(10^{-14}\). Choose \(s\) to minimise the sum of the two error bounds.
Worked solution
Subtracting the function values and dividing by \(s\) gives \(3+s\), so the exact truncation error is \(s\). Numerator noise contributes at most \(10^{-14}/s\). The sum \(s+10^{-14}/s\) is minimised by \(s^2=10^{-14}\), giving \(s=10^{-7}\) and a bound \(2\times10^{-7}\).
A perturbation smaller than this model’s optimum amplifies cancellation. The numerical optimum depends on evaluation scale and arithmetic, so use several step sizes when testing an unfamiliar Jacobian.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Decide when a reused slope is still informative
Solve \(x^2=9\) from \(x_0=4\) using the initial slope for the first two steps. Compare the second result with refreshing the slope at the first iterate. For an arbitrary positive frozen slope \(B\), find the range giving a strict local contraction at the positive root.
Worked solution
The initial slope is 8. The first iterate is
Its residual is \(49/64\). Reuse gives
Refreshing the slope to \(25/4\) gives
At the root the error multiplier is \(1-6/B\). The strict inequality \(|1-6/B|<1\) requires \(B>3\). In particular \(B=8\) gives multiplier \(1/4\): factor reuse converges but does not retain Newton's local quadratic rate.
Explore the related calculation with adjustable inputs. Explore how initial values and the residual slope affect Newton and secant convergence on the quadratic reference problem; retain the stated residual when checking the present hand calculation.
Revisit chapter 4 · Quantify the cost of freezing a Jacobian.
Distinguish root accuracy from temperature sensitivity
For one implicit cooling step take \(T_n=2\) K, \(T_a=1\) K, \(h=1\) s and \(\beta=0.0015\) K⁻³s⁻¹. Differentiate the stage equation with respect to the input temperature, treating \(h,\beta,T_a\) as fixed. Use the tabulated root 1.97851479 K to predict the effect of a 0.001 K increase in \(T_n\). Compare its scale with an algebraic residual near \(10^{-16}\) K.
Work through the solution
Write \(F=x-T_n+h\beta(x^4-T_a^4)\). Implicit differentiation yields
The derivative at the tabulated root is approximately 0.956. A small 0.001 K input increase therefore shifts the physical stage root by about 0.000956 K. A tiny numerical residual verifies the equation for specified inputs, while the derivative measures uncertainty resulting from a change to those inputs.
Chapter 5 · Line searches and trust regions
Diagnose a cycling Newton sequence, compute a merit-function decrease and explain how damping and trust regions change the step while preserving the root.
From first principles
Choose a step using actual reduction in residual
A local Newton model can predict a zero far outside its useful region. To test the correction, use the merit function \(\phi(x)=\|F(x)\|_2^2/2\). Along a candidate direction \(s\), differentiate this scalar at step length zero. For a Newton direction solving \(Js=-F\), the predicted slope is strictly negative whenever \(F\ne0\),
Choose a fraction \(0<c<1\) of that initial decrease and accept a trial length \(\alpha>0\) when the actual residual satisfies
Try full length first and shorten if necessary. For a differentiable merit function and a descent direction, sufficiently short feasible steps pass because the linear term dominates the remainder. This establishes a local acceptance mechanism. Bounds on variables, nondecreasing directions, or stationary points of \(\phi\) with nonzero residual require additional interpretation.
Derivation and applications
Bound the number of reductions in a backtracking line search
A sufficient decrease test can be guaranteed once the step is short enough. Assume a differentiable merit \(\phi\), a nonzero direction \(p\) with \(g^Tp<0\) for \(g=\nabla\phi(x)\), and an \(L\)-Lipschitz gradient on the whole feasible trial segment. The change in merit equals an integral of directional derivative. Replacing the gradient at a displaced point by its initial value introduces a bounded error,
To make the right-hand side no larger than the Armijo requirement \(c\alpha g^Tp\), rearrange the inequality using \(g^Tp<0\) and \(\alpha>0\). This yields a guaranteed acceptance range
Starting at \(\alpha_0\) and reducing by a fixed factor \(0<\rho<1\), the number of reductions before reaching this range is at most
Larger steps can already pass because the curvature bound is only sufficient. This estimate makes the roles of a nearly tangential descent direction and a poor scale for the search direction explicit. It assumes trial points lie inside the domain on which the function and its gradient bound are valid.
Worked example
Predict a line search on an exact quadratic
Use \(\phi(x)=5x^2\), start at \(x=1\), and take \(p=-10\). Here \(L=10,\ g^Tp=-100,\ \|p\|^2=100\). With \(c=0.1\) the safe length is \(0.18\). Starting from 1 and halving reaches \(0.125\) after three reductions. The merit becomes \(5(-0.25)^2=0.3125\), below the required
The previous length \(0.25\) gives merit \(11.25\) and fails.
Second application
Check an acceptance claim under curvature uncertainty
Another model has \(-g^Tp=0.8,\ \|p\|=2,\ L=3,\ c=0.25\). The sufficient length is
An initial \(0.80\) reduced by a factor \(0.4\) produces \(0.32,\ 0.128,\ 0.0512\); the third reduction is guaranteed to pass. Accepting \(0.128\) on the actual merit would also be consistent with the bound.
Start from this chapter. Compare damped and undamped Newton on the same stage equation. Substitute each returned temperature into the residual independently to see whether they reach the same root.
OneSimulation laboratory · Locate the root of an implicit cooling step
A locally excellent algorithm can cycle
Consider \(F(x)=x^3-2x+2\). Starting from zero gives \(F(0)=2,F'(0)=-2\), so Newton proposes \(x_1=1\). At one, \(F(1)=1,F'(1)=1\), and the next iterate returns to zero. The sequence will repeat indefinitely in exact arithmetic. A real root does exist between \(-2\) and \(-1\), where the function changes sign. The trouble lies in the update chosen from this starting point. It does not refute the local convergence result near a simple root.
For coupled equations define the merit function \(\phi(x)=\|F(x)\|_2^2/2\). Its directional derivative along an exact Newton step \(s\) is \(\nabla\phi^Ts=F^TJs=-\|F\|^2\), strictly negative when \(F\ne0\). Thus a sufficiently short step in that direction decreases the squared mismatch. This identity assumes \(Js=-F\) is solved accurately. With a strongly truncated inner iteration, check the actual directional derivative before treating the step as a descent direction.
Compute an accepted step
A backtracking line search starts at \(\alpha=1\) and reduces it until \(\phi(x+\alpha s)\leq\phi(x)+c\alpha\nabla\phi^Ts\) with \(0<c<1\). This sufficient-decrease condition compares actual progress with the local prediction. In the cycling example at \(x=1\) the Newton direction is \(s=-1\), the initial merit is 0.5 and its slope along \(s\) is \(-1\). With \(c=10^{-4}\), the full trial returns to zero and gives \(\phi=2\), which fails. A half-step gives \(F(0.5)=1.125\) and fails too. A quarter-step gives \(F(0.75)=0.921875\), so \(\phi\simeq0.425\), satisfying the condition.
A smaller mismatch at this point does not certify a nearby root. This example has a positive local minimum of \(\phi\) near \(x=\sqrt{2/3}\), where \(F'\) vanishes but \(F\) stays nonzero. From a poor starting point, globalisation may lead near such a stationary point. Check the residual itself, use a bracket when available and try physically motivated alternative starts. A long sequence of tiny accepted steps should prompt inspection of local derivatives or constraints rather than being counted as successful convergence.
Compare a regional model with the real residual
A trust-region method minimises the local model \(m(s)=\|F+Js\|^2/2\) subject to \(\|s\|\leq\Delta\). Its radius states how far the current linearisation is trusted in the chosen variable scales. After a trial, compute the ratio \(\rho=[\phi(x)-\phi(x+s)]/[m(0)-m(s)]\) when predicted reduction is positive. A negative ratio means the true merit increased. A ratio near one indicates accurate local prediction. One can shrink the radius after a poor trial or enlarge it when the model predicts progress well near the boundary.
In the quarter-step above the linear model predicts residual \(1-0.25=0.75\) and merit \(0.28125\), a reduction of 0.21875. The actual reduction is about 0.075, giving \(\rho\approx0.34\). The trial moved in the intended direction but the predicted gain was optimistic. Using such comparisons is especially valuable when model coefficients change sharply with state. On a simple monotone thermal stage, damped and full Newton can converge to the same root. The resulting residual and a comparison at identical time step test this expectation. Compare two nonlinear cooling solves.
Include physical bounds in a step decision
A variable representing a concentration cannot be negative. If a positive current value \(c\) receives a negative proposed correction \(s\), then \(c+\alpha s\geq0\) imposes \(\alpha\leq c/(-s)\). For a concentration of 0.04 and a direction of −0.10 in matching units, only factors up to 0.4 keep this component admissible. Starting a merit-function search at 0.36 leaves a small distance from the boundary. Across many components use the most restrictive bound before evaluating an expensive residual.
Admissibility alone cannot guarantee progress: a physically acceptable state may have a larger balance mismatch than the old one. Conversely, clipping a negative candidate to zero changes the search direction and can alter conservation. A genuinely constrained equilibrium may require a complementarity or inequality formulation rather than repeated clipping. Record which condition limited each step when diagnosing persistent stagnation near a boundary.
Derive the step along a trust-region boundary
For a smooth squared-residual objective, a local quadratic model has change \(m(s)=g^Ts+s^TBs/2\), often with \(B=J^TJ\). A trust region limits this model to \(\|s\|_2\le\Delta\) in scaled coordinates. Suppose first that \(B\) is symmetric positive definite. If the unconstrained minimiser \(-B^{-1}g\) lies inside the ball it solves the constrained problem. Otherwise the minimiser lies on the sphere. The stationarity condition there is \((B+\lambda I)s=-g\), with \(\lambda>0\) chosen so the length equals \(\Delta\).
Diagonalising \(B=Q\operatorname{diag}(\beta_i)Q^T\) turns the length condition into \(\sum_i (q_i^Tg)^2/(\beta_i+\lambda)^2=\Delta^2\). For a nonzero gradient this left-hand side decreases continuously to zero with \(\lambda\), starting at the squared unconstrained-step length. Thus the boundary multiplier exists uniquely. A positive shift damps different curvature directions by different factors. The step is generally not a scalar fraction of the full unconstrained step. If \(B\) has negative eigenvalues, positive semidefiniteness of \(B+\lambda I\) and possible singular boundary cases require additional treatment.
Measure what a restricted model predicted
Let \(B=\operatorname{diag}(1,4)\) and \(g=(-2,-5)^T\). The full minimiser is \((2,1.25)^T\), of norm about 2.36. Set the permitted radius to \(\sqrt2\). At \(\lambda=1\) the shifted equations give
with exactly the required length. The low-curvature component has been reduced to one half of its unconstrained value while the second retains four fifths. That orientation change follows from the different denominators; shortening the original step to the same norm would predict a different model decrease.
The linear term at the accepted candidate is \(-7\). The quadratic term is \((1+4)/2=2.5\), so the predicted decrease is \(7-2.5=4.5\). Suppose the actual objective is this local model plus \(0.6s_1^4\), up to an irrelevant constant. The actual decrease at \((1,1)\) is 3.9 and the ratio of actual to predicted decrease is \(3.9/4.5\approx0.867\). The extra quartic term does not alter the gradient or Hessian at the base point, yet it changes the observed progress over a finite step.
If that coefficient were 6 instead, the actual change would be an increase of 1.5 while the local quadratic still predicts a decrease of 4.5. Shrinking the radius diminishes the neglected term more rapidly than the leading linear improvement. Comparing achieved and predicted reductions supplies information about model accuracy that neither the multiplier nor the trust radius alone provides.
The choice of norm defining the ball also influences the calculation. If one coordinate is measured in millimetres and the other in metres, changing only the unit of the first coordinate alters an unscaled Euclidean ball. Instead specify physically meaningful scales and constrain the length of the dimensionless step. Transform the gradient and curvature consistently with that scaling; otherwise the shifted equations describe a different model than the one used to evaluate the actual decrease.
An equivalent specification is a weighted ellipsoid in the physical variables, with semiaxes equal to admissible changes in each parameter.
Measure how far a Newton model remains predictive
Apply Newton’s method to \(\arctan x=0\) from \(x=2\). The full step is \(-5\arctan(2)\). Evaluate the true merit along that line and compare with the model that predicts zero residual at its end.

Read values from the plot
| Fraction of Newton step | Re-evaluated merit | Linear residual prediction |
|---|---|---|
| 0 | 0.61289 | 0.61289 |
| 0.29 | 0.07064 | 0.30896 |
| 0.575 | 0.37763 | 0.1107 |
| 0.86 | 0.7482 | 0.012013 |
| 1.15 | 0.90538 | 0.01379 |
Change parameters · Measure how far a Newton model remains predictive
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Chapter 6 · Continuation and folds
Track a family of equilibria through parameter changes, identify the failure of ordinary parameter continuation at a fold and build a predictor–corrector step.
From first principles
Use the tangent of a solution curve to cross a fold
A parameter-dependent equation \(F(x,\lambda)=0\) defines a curve of equilibria when the gradient in \((x,\lambda)\) is nonzero. Differentiating along any smooth parametrization by \(s\) shows that its tangent \((\dot x,\dot\lambda)\) must be perpendicular to the gradient,
The second equation fixes the length in chosen, consistently scaled coordinates. Choose the sign to match the preceding direction and predict a new state \(z_p=z_0+h t_0\). The predictor generally misses the curved solution set. To correct it, solve the original equation together with a plane condition fixing its position along the tangent,
Near a regular curve these two rows are independent. At a simple fold the parameter component of the tangent vanishes, so using \(\lambda\) alone to parameterize fails locally. The augmented system can remain nonsingular because the state component is still free to progress along the curve.
Open full-size diagram
Derivation and applications
Predict the size and direction of a continuation correction
A tangent predictor from a known solution is first-order accurate along a smooth branch. Its leading transverse miss can be calculated before running a Newton corrector. Take a scalar equation \(F(z)=0\) for \(z=(x,\lambda)\) in consistently scaled coordinates. At the starting point \(z_0\) assume a nonzero gradient \(g\), a unit tangent \(t\) with \(g^Tt=0\), and sufficiently many bounded derivatives. Write \(H\) for its Hessian. Taylor expansion along the predictor \(z_p=z_0+ht\) yields
The usual corrector plane is perpendicular to \(t\). In two dimensions the permitted correction therefore lies along the initial unit normal \(n=g/\|g\|\). Try \(z=z_p+\delta n\). Since \(\delta=O(h^2)\), the derivative at the initial point gives the leading normal correction,
Thus a local curvature estimate \(K=|t^THt|/\|g\|\) suggests a predictor length for a desired transverse error \(\varepsilon\),
The absolute curvature is invariant when \(F\) is multiplied by a fixed nonzero scalar. The estimate depends on the coordinate metric and becomes unreliable if the gradient is nearly zero or higher derivatives vary substantially over the step. A measured corrector displacement tests the prediction.
Worked example
Predict the normal correction on a circle
On \(F=x^2+\lambda^2-4=0\), start at \((2,0)\) with tangent \((0,1)\) and choose \(h=0.20\). Then \(t^THt=2,\ \|g\|=4\), and the predicted normal displacement is \(-0.0100\). At fixed \(\lambda=0.20\), the exact correction is
Its sign points inward, restoring the radius.
Second application
Choose a step near a parabolic turning point
For \(F=\lambda-3x^2\) at the origin, take \(t=(1,0)\), \(n=(0,1)\). Here \(t^THt=-6,\ \|g\|=1\), so the exact corrector at fixed \(x=h\) is \(+3h^2\) in the parameter. To keep it below \(0.0012\), choose \(h\le0.020\). A proposed \(h=0.05\) would require correction \(0.0075\), over six times the target.
A solution curve contains more than one isolated solve
A physical model often depends on a parameter \(\lambda\), such as heat input, end displacement or applied load. Solving \(F(x,\lambda)=0\) independently at each parameter value discards information about how neighbouring states are related. On a smooth branch where \(F_x\) is invertible, differentiation gives
This linear solve predicts how the state moves under a small parameter change. Re-evaluating the full residual at the prediction and correcting it by Newton accounts for the curvature omitted by the tangent.
For a scalar illustration take \(F=x^2+\lambda-1\). The admissible solution set is a parabola in the \((x,\lambda)\) plane, with branches \(x=\pm\sqrt{1-\lambda}\) for \(\lambda<1\). Its derivative \(dx/d\lambda=-1/(2x)\) grows without bound as \(x\) approaches zero. Starting at \(x=0.5,\lambda=0.75\), a change \(\Delta\lambda=0.1\) predicts \(x=0.4\). The positive exact value is
The predictor is close enough for a local correction here. Increasing the load beyond one would ask for a real equilibrium that this model cannot supply.
Change the parameter used to follow the curve
The curve itself is smooth at \((0,1)\) although \(\lambda\) is a poor local coordinate there. Introduce an arclength-like parameter and a normalised tangent \(t=(t_x,t_\lambda)\) satisfying \(F_x t_x+F_\lambda t_\lambda=0\). At a known point \(z_k=(x_k,\lambda_k)\) predict \(z_p=z_k+\Delta s\,t\). Correct by solving the physical equation together with a hyperplane constraint \(t^T(z-z_p)=0\). This pseudo-arclength condition selects a nearby point on the branch while allowing the load parameter itself to reverse direction.
At the fold of the example \(F_x=0,\ F_\lambda=1\), and the tangent can be \(t=(-1,0)\). The augmented Jacobian has rows \((0,1)\) and \((-1,0)\), with determinant one. A Newton correction in the two unknowns is well posed even though the original scalar Jacobian for fixed \(\lambda\) was singular. The construction depends on a simple fold and the correct tangent. A more complicated branch intersection can require additional information to choose which path to follow.

OneSimulation · Follow an equilibrium through two load reversals
The dimensionless restoring law \(F(x,\lambda)=x^3-x+\lambda\) crosses two folds. At a prescribed load, Newton's scalar displacement update needs \(1/(3x^2-1)\); the denominator vanishes at the turns. In the displacement–load plane the tangent \(t\) remains defined. Starting from \((1.2,-0.528)\), the code orients that tangent toward decreasing displacement, makes a prediction \(p\), and requires the corrected point \(z\) to satisfy
The OneSimulation linear solver computes each two-component Newton correction. At a fold the tangent points entirely in the displacement direction, so the second equation fixes the displacement component locally and the first equation determines the load component. Try halving the step to sample the turns more densely. Load parametrisation visits the same load at up to three equilibria; the path history identifies which one has been followed.
"""Follow both folds of a scalar equilibrium with a two-variable Newton correction."""
import matplotlib.pyplot as plt
import numpy as np
from onesim.numerics.linear.matrices.dense_linear_algebra import solve_dense
step = 0.12 # arclength in dimensionless displacement-load coordinates
point = np.array([1.2, 1.2 - 1.2**3])
path = [point.copy()]
for _ in range(100):
x, load = point
tangent = np.array([-1.0, 3*x*x - 1])
tangent /= np.linalg.norm(tangent)
predicted = point + step * tangent
point = predicted.copy()
for _ in range(10):
x, load = point
residual = np.array([x**3 - x + load, tangent @ (point - predicted)])
if np.linalg.norm(residual, np.inf) < 1e-12:
break
jacobian = np.array([[3*x*x - 1, 1], tangent])
point -= solve_dense(jacobian, residual)
else:
raise RuntimeError("Reduce the continuation step")
path.append(point.copy())
if point[0] < -1.2:
break
x, load = np.array(path).T
fold_x = np.array([-1, 1]) / np.sqrt(3)
assert x[-1] < -1.2 and np.max(np.abs(x**3 - x + load)) < 1e-11
assert np.count_nonzero(np.diff(np.sign(np.diff(load)))) == 2
print("Fold loads from the derivative:", fold_x - fold_x**3)
fig, ax = plt.subplots(figsize=(6.8, 3.8), constrained_layout=True)
ax.plot(load, x, ".-", color="#176879", label="Corrected continuation steps")
ax.scatter(fold_x-fold_x**3, fold_x, color="#a4492b", label="Analytic folds", zorder=3)
ax.set(xlabel="Load parameter (dimensionless)", ylabel="Displacement (dimensionless)")
ax.grid(alpha=0.2)
ax.legend()
fig.savefig("nonlinear-equations.png", dpi=160)

Take one step past a turning point
Start exactly at the fold, choose the negative-\(x\) tangent and take \(\Delta s=0.1\). The predictor gives \((-0.1,1)\). Its physical residual is \(0.01\). The transverse plane now fixes \(x=-0.1\). Correcting the physical balance therefore gives
The parameter has decreased while the curve coordinate has advanced. This simple calculation illustrates why choosing fixed increments of \(\lambda\) alone cannot traverse both sides of the same load maximum.
A solver can report an accurate branch even if a physical system would not settle on that branch. To test stability one needs a dynamical law. For instance, if \(\dot x=1-\lambda-x^2=-F\), then perturbing an equilibrium gives
The positive branch is locally attracting and the negative branch repelling. The algebraic root residual vanishes on both. For a different specified dynamics the interpretation must be rederived. Keep separate records of equilibrium balance, tangent orientation, correction size and dynamical stability when interpreting a continuation diagram.
Check the prediction error against the step length
For the example, predict away from \((0.5,0.75)\) with the slope \(dx/d\lambda=-1\). A change of only 0.05 predicts \(x=0.45\), while the exact positive branch gives \(\sqrt{0.20}=0.447214\), an error about 0.00279. The larger change 0.10 gave error about 0.01270. Near this starting point halving the parameter step reduces the tangent prediction error by roughly a factor of four, consistent with the second-order remainder of a first-order predictor.
Approaching the fold makes that comparison deteriorate because the second derivative with respect to the load becomes unbounded. Monitoring the ratio of correction length to predictor length provides one way to shorten steps before Newton loses the branch. At a successful step, orient the new tangent to have positive dot product with its predecessor in the scaled coordinates. Without that convention, an arbitrary sign change in a computed tangent could send the next predictor back along the path already followed.
Distinguish a fold from a genuine branching point
The scalar equilibrium equation \(F(x,\mu)=x^3-\mu x=0\) describes a symmetry-breaking pitchfork. There is a trivial branch \(x=0\) for every \(\mu\) and two additional real branches \(x=\pm\sqrt\mu\) when \(\mu>0\). Ordinary parameter continuation along the trivial branch encounters no difficulty evaluating the solution on either side of zero. Yet the collection of real equilibria changes there. An algorithm that accurately follows one branch can therefore entirely miss the existence of the other two.
A fold often has \(F_x=0\) while \(F_\mu\ne0\), so the full derivative with respect to state and parameter retains rank one. At the pitchfork origin both derivatives vanish:
Adding one arclength condition to the original scalar equation cannot restore full rank there because the equilibrium row itself is zero. Arclength continuation avoids a poor choice of independent coordinate at a regular fold; it does not automatically select a tangent at an actual branch crossing. Higher-order terms or an independent symmetry condition carry the missing information.
Follow the stable state through a loss of stability
To distinguish algebraic solutions from dynamically attracting equilibria, embed the example in \(x'=\mu x-x^3=-F(x,\mu)\). Linearising near an equilibrium gives perturbation growth rate \(\mu-3x^2\). At \(x=0,\mu=-0.04\), the rate is \(-0.04\) and small perturbations decay. At \(x=0,\mu=+0.04\), it becomes \(+0.04\) and perturbations grow. The additional equilibria are \(x=\pm0.2\), both with linear rate \(0.04-3(0.04)=-0.08\). A static Newton solve initialised at zero on the positive side returns zero residual immediately, even though that solution is now dynamically unstable.
To switch branches deliberately, use the state amplitude as the small parameter. Cancelling the known factor \(x\) on a nontrivial branch gives
At \(x=0.1\) the predicted parameter is 0.01; at \(x=-0.1\) the same parameter gives the mirror branch. This cancellation is valid only because the branch sought has nonzero amplitude. Dividing the original equilibrium equation by \(x\) everywhere would have silently deleted the entire trivial branch.
The potential \(V=x^4/4-\mu x^2/2\) provides an independent physical check. At \(\mu=0.04\), the trivial state has energy zero, whereas either nontrivial state has energy \((0.2)^4/4-0.04(0.2)^2/2=-0.0004\). Its lower energy and positive second derivative agree with the negative linear growth rate. Near a bifurcation, record branch existence, stability and which branch a continuation procedure actually followed as three separately testable facts.
If small external imperfections break the symmetry, replacing the equation by \(x^3-\mu x-\epsilon=0\) eliminates the exact \(x=0\) branch whenever \(\epsilon\ne0\). At \(\mu=0\) the remaining equilibrium then has amplitude \(\epsilon^{1/3}\). A forcing imperfection of \(10^{-6}\) produces displacement 0.01, much larger than a linear response of the same size. This calculation identifies why branch diagrams near an ideal symmetry-breaking point are sensitive to tiny unmodelled loads.
A careful numerical continuation can map the resulting changes in the number of equilibria before interpreting any single sweep from one initial condition.
Locate the fold created by an imperfect pitchfork
An imperfect pitchfork can be analysed by solving the equilibrium and fold conditions together. With \(F=x^3-\mu x-\epsilon\), a fold requires \(F_x=3x^2-\mu=0\), hence \(\mu=3x^2\). Substitution into \(F=0\) gives \(-2x^3-\epsilon=0\), therefore \(x_f=-(\epsilon/2)^{1/3}\) and \(\mu_f=3(\epsilon/2)^{2/3}\) for positive imperfection. This is a nonanalytic dependence on the forcing perturbation. Halving the perturbation multiplies the fold displacement by \(2^{-1/3}\), rather than by one half as a linear sensitivity would predict.
For \(\epsilon=0.002\), the fold occurs at \(x_f=-0.1,\mu_f=0.03\). Indeed \(x^3-0.03x-0.002=(x+0.1)^2(x-0.2)\), showing the merging pair and the separate simple positive equilibrium. At this point \(F_\mu=0.1\ne0\) and \(F_{xx}=-0.6\ne0\), restoring the usual regular-fold conditions away from the perfect pitchfork. At \(\mu=0\) there is only the positive cube root of 0.002. Above 0.03 the negative pair splits into two simple real roots, so the number of equilibria becomes three. This count follows also by inspecting the local maximum at negative \(x\) and local minimum at positive \(x\). An observed delayed change in the number of equilibrium branches can therefore measure an imperfection that a symmetric idealisation omits.
Change parameters · Continuation and folds
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Study the full derivation
Finding another equilibrium after one root is known · Nonlinear systems and iterative methods
Newton iteration repeatedly finds the same structural equilibrium. Derive how deflation changes its basins while preserving other solutions, use a rank-one Jacobian update, and distinguish a list of discovered equilibria from a completeness certificate.
Problem sheet 3 · Safeguards and continuation
Control steps within a scalar bracket, track a turning branch and distinguish equilibrium from stability under a specified evolution law.
Reject an inadmissible tangent
Solve \(\ln x=0\) on \([0.5,4]\), starting Newton’s method at 4. Compute the full trial, then two successively halved trials. Which is the first to reduce \(\ln^2 x/2\)? How could the bracket protect a failed update?
Worked solution
The direction is \(-4\ln4\simeq-5.5452\), so the full trial is negative and the logarithm undefined. At half length the trial is 1.2274, with merit about 0.021 versus 0.961 initially, already a decrease. A quarter-step gives 2.6137, also decreasing merit but less strongly.
Reject an inadmissible trial before evaluating its logarithm. A fallback midpoint of 2.25 is admissible and cuts the sign-changing interval to \([0.5,2.25]\); the interval maintains a root guarantee independent of tangent quality.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Choose the continuation coordinate
For \(F(x,\lambda)=x^2+\lambda-4\), find the two solutions at \(\lambda=3\), their slopes \(dx/d\lambda\), and the turning point. From that point take a pseudo-arclength predictor of length 0.2 in the positive-\(x\) direction and correct to the curve.
Worked solution
At \(\lambda=3\) the roots are \(\pm1\). Their slopes are \(-1/2\) at +1 and \(+1/2\) at −1. The branches meet at \((0,4)\), where these slopes cease to be finite.
The tangent there is \((1,0)\), so the predicted point is \((0.2,4)\). The hyperplane constraint fixes \(x=0.2\), and the physical residual gives \(\lambda=3.96\). Its reduction in \(\lambda\) is compatible with forward arclength progress.
Explore the related calculation with adjustable inputs. Use the equilibrium parabola to inspect sensitivity and the tangent-coordinate continuation step. Translate the state coordinate if the fold is centred at a different value here.
Reverse the dynamics
Use the same \(F\) at \(\lambda=3\), first with \(\dot x=-F\) and then with \(\dot x=F\). Determine which equilibrium is stable in each model and the linearised time constant at its stable root. Can a static root-finding algorithm distinguish these dynamics from its roots alone?
Worked solution
For \(\dot x=-F\) the linearised rate at a root is \(-2x_\star\), so +1 is stable with decay rate 2 and −1 is unstable. Reversing the evolution gives rate \(+2x_\star\), hence −1 becomes stable with the same time constant \(1/2\) in the time units of the equations.
Both static models have the same root set. Rate information from the specified dynamics is necessary to conclude whether a perturbation decays. Numerical convergence of Newton to a root is independent of that physical stability test.
Explore the related calculation with adjustable inputs. Use the equilibrium parabola to inspect sensitivity and the tangent-coordinate continuation step. Translate the state coordinate if the fold is centred at a different value here.
Chapter 7 · Polynomial roots and coefficient sensitivity
Evaluate a polynomial and its derivative in one sweep, then estimate how far a coefficient error can move a simple root.
From first principles
Derive the change in a simple root from coefficient errors
Let \(p(x)=\sum_{j=0}^n a_j x^j\) have a simple real or complex root \(r\), meaning \(p'(r)\ne0\). Change the coefficients by small amounts \(\delta a_j\), and suppose the root changes continuously to \(r+\delta r\). Keeping first-order terms in the perturbed root equation gives
For a factored polynomial the derivative at a simple root has a direct interpretation,
Nearby roots can make this derivative small and the inferred root sensitive to modest coefficient uncertainty. The relation is a local estimate, with coefficient sizes and variable units affecting what counts as a small perturbation. At an exactly repeated root the derivative vanishes and the first-order expression cannot be used.
Derivation and applications
Measure a computed polynomial root against its coefficient budget
A raw polynomial residual can be changed by multiplying every coefficient by the same constant. A more informative diagnostic asks how much the specified coefficients must change to make the reported root exact. Consider a polynomial \(p(x)=\sum_{j=0}^na_jx^j\), a trial real root \(z\), and admissible coefficient changes \(|\delta a_j|\le\eta w_j\), with nonnegative weights \(w_j\) chosen from measurement tolerances. Requiring \(z\) to solve the perturbed equation gives
For real data and real trial root, each term can be aligned in sign against the residual. If the denominator is positive, scaling those aligned perturbations simultaneously attains equality. The smallest admissible coefficient multiplier is therefore
A zero weight freezes the corresponding coefficient; taking \(w_j=|a_j|\) tests componentwise relative backward error. To compare this diagnostic with a forward root error, linearize about the trial value provided \(p'(z)\ne0\) and higher terms are small,
A small coefficient backward error and large root displacement can coexist near a multiple root. Conversely, an accurately approximated location can appear to have a large raw residual when all coefficients carry a large common scale. This sign construction must be reconsidered if a complex trial root is tested using only real coefficient perturbations.
Worked example
Compute a scale-invariant certificate for a trial root
For \(p(x)=x^2-3x+2\), take \(z=1.01\) and \(w_j=|a_j|\). The residual is \(-0.0099\); the denominator is
The backward error is \(0.00164\), despite the \(0.010\) location error relative to the root at one. Multiplying the polynomial and all its weights by 1000 leaves the ratio unchanged.
Second application
Test which coefficient is actually uncertain
For a different polynomial \(p(x)=x^2-4\), suppose only the constant term can be adjusted, with tolerance \(0.020\). The trial \(z=2.01\) gives \(p(z)=0.0401\). Its required tolerance multiplier is \(0.0401/0.020=2.005\), so it falls outside the specified data envelope. Indeed the constant would have to move from \(-4\) to \(-4.0401\), which directly checks the diagnostic.
A root belongs to a set of coefficients
Write \(p(x)=a_nx^n+\cdots+a_0\) and suppose a simple real root \(r\) satisfies \(p'(r)\ne0\). Perturb the coefficients and write the displaced root as \(r+\delta r\). Keeping first-order terms in the equation gives
Consequently the effect of a given coefficient error depends on both the slope at the root and the size of the corresponding power. An evaluation routine can be backward accurate and still return an uncertain root when the input coefficients are insufficiently precise.
For \(p=(x-1)(x-1.01)=x^2-2.01x+1.01\), the derivative at 1 is \(-0.01\). Increasing the constant coefficient by \(10^{-6}\) moves this root upward by approximately \(10^{-4}\). The exact perturbation is easier to see by completing the square:
The new lower root is \(1.005-\sqrt{0.000024}\approx1.00010102\). The first-order estimate captures the direction and scale. A coefficient change of \(0.000025\) merges the roots; a larger upward change removes both real roots.
Carry derivative information through Horner evaluation
Collect the polynomial as a sequence of nested multiply-add operations starting with \(b=a_n\). Appending the next coefficient replaces \(b\) by \(xb+a_j\). Differentiating that operation shows that a derivative accumulator \(d\) must be replaced by \(xd+b\), where \(b\) is its old value. Starting \(d=0\) and updating it before updating \(b\) yields \(p(x)\) and \(p'(x)\) without forming high powers. For \(x^3-3x+1\) at \(x=2\), the successive values of \(b\) are \(1,2,1,3\) and the derivative accumulator ends at 9. A Newton step gives \(2-3/9=5/3\).
Operation count alone says little about cancellation: near a root, large terms can subtract to produce a tiny value. A scale for the accumulated terms is \(s(x)=\sum|a_j||x|^j\), also computable by a Horner sweep. Reporting \(|p(x)|/s(x)\) when the denominator is nonzero measures how small a relative componentwise coefficient change could explain that residual. Dividing by the slope provides an approximate forward correction for a simple isolated root.
The cost of removing a root
Dividing the polynomial by \(x-\hat r\) after locating one root reduces subsequent work. Synthetic division leaves a remainder \(p(\hat r)\). Discarding it changes the equations for every remaining root. In the close-pair example, using \(\hat r=1.001\) produces quotient \(x-1.009\) and remainder \(-0.000009\). The remaining estimate shifts by the same 0.001 magnitude. Recheck candidate roots against the original polynomial; where coefficients represent uncertain measurements, a range of compatible roots can communicate more information than many printed digits.
Choose a formula by the size of the root
For \(x^2-10^8x+1=0\), the usual formula for the small root subtracts two numbers close to \(10^8\). Rounding in their last digits can dominate the small difference. Compute the large root instead by adding the positive square root and dividing by two. The product of the two roots is one, so the small root follows as its reciprocal, approximately \(10^{-8}\). This change removes a source of arithmetic cancellation. Whether the underlying coefficients determine the desired root accurately can then be assessed separately using the derivative-based sensitivity formula.
Count real roots before iterating on their locations
A sign change between two endpoints certifies an odd number of crossings for a polynomial when all roots in the interval are simple. It does not show whether the number is one or three. A Sturm sequence begins with the polynomial \(p_0\) and its derivative \(p_1\), then repeatedly sets \(p_{j+1}\) to the negative remainder from dividing \(p_{j-1}\) by \(p_j\), stopping at a constant for a square-free polynomial. For a real test value \(x\), count sign changes in the sequence of evaluated values, skipping zero entries. The decrease in this count between two nonroot endpoints equals the number of distinct roots between them.
The signs can change count only when some sequence member crosses zero. For an intermediate member, the remainder relation at its zero makes its two neighbours opposite in sign; the sign-change count across that triple is one on both sides. At a simple zero of the original polynomial, the next member is its nonzero derivative. Immediately to the left the polynomial has opposite sign to its derivative, and immediately to the right it has the same sign. The count therefore decreases by exactly one. These observations explain why the negative remainder sign and the assumption on multiple roots matter.
Isolate three roots of a cubic without choosing Newton starts
Take \(p=x^3-3x+1\) and \(p'=3x^2-3\). Dividing the cubic by the derivative leaves remainder \(-2x+1\), so use \(p_2=2x-1\). The remainder of \(p'\) on division by \(p_2\) equals its value at \(x=1/2\), namely \(-9/4\), producing final positive constant \(9/4\). At \(x=-2\) the signs are \((-,+,-,+)\), giving three variations. At \(x=2\) all entries are positive and the count is zero. The cubic therefore has exactly three roots in \((-2,2)\), a more informative conclusion than the change of sign of \(p\) alone.
At \(x=-1\), the sequence is positive, zero, negative, positive; ignoring the zero gives two variations. At zero its signs are \((+,-,-,+)\), also two. At \(x=1\) the signs are negative, zero, positive, positive, giving one variation. It follows that \((-2,-1)\), \((0,1)\) and \((1,2)\) each contain a single root, whereas \((-1,0)\) contains none. Bisection or safeguarded Newton can now refine each isolating interval without ambiguity about missing another real root.
For a polynomial represented by rounded measured coefficients, this count addresses the specific polynomial actually supplied. Near a repeated root, small coefficient changes can alter the number of real roots. Exact rational arithmetic or certified sign enclosures may be needed if sequence values are close to zero; evaluating a delicate remainder sequence with ordinary rounding cannot by itself certify the sign variations of the intended polynomial.
As a check on isolation, the candidate intervals account for all three roots allowed by the degree. Further sign-preserving splits in the empty interval can never uncover a real root there. This accounting reduces the risk of reporting the same attractive Newton root twice while missing a separate crossing.
Compare a simple and a repeated root under coefficient error
Start with a polynomial whose target root is at one. In both examples subtract the same small positive constant \(\delta\); select the perturbed root above one. Use a rationalised expression for the simple-root displacement to avoid subtracting close floating-point numbers.

Read values from the plot
| Magnitude of constant-coefficient perturbation | Double root, (x−1)² = δ | Simple root, (x−1)(x+1) = δ |
|---|---|---|
| 1e−9 | 3.1623e−5 | 5e−10 |
| 1e−7 | 0.00031623 | 5e−8 |
| 1e−5 | 0.0031623 | 5e−6 |
| 0.001 | 0.031623 | 0.00049988 |
| 0.1 | 0.31623 | 0.048809 |
Change parameters · Compare a simple and a repeated root under coefficient error
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Study the full derivation
Count enclosed zeros with a contour before locating them · Nonlinear systems and iterative methods
A complex residual may have several nearby zeros whose Newton basins are hard to distinguish. Use the argument principle to count them, contour moments to estimate their locations and an independent perturbation test to certify a root cluster.
Chapter 8 · Root enclosures with interval Newton
Combine interval bounds and a single function evaluation to exclude roots or isolate one with a verifiable enclosure.
From first principles
Extract a root enclosure from the mean value theorem
Suppose a differentiable scalar \(f\) has a root \(r\) in a current interval \(X\), and choose a midpoint or other point \(m\in X\). The mean value theorem relates \(f(m)\) to the derivative at an unknown intermediate point. If an interval \(D\) contains every derivative on \(X\) and excludes zero, then
Dividing by the entire derivative interval accounts for all possible intermediate slopes. Intersect with the original interval to retain both facts about the root,
An empty intersection proves there was no root in \(X\). A nonempty intersection alone does not establish existence; a verified sign bracket supplies a separate existence proof. Outward-rounded evaluations of the function and derivative bounds are necessary for a numerical certificate. If \(D\) contains zero, ordinary interval division cannot justify this simple enclosure.
Derivation and applications
Include function-evaluation uncertainty in an interval Newton step
A derivative enclosure is insufficient for a reliable root bound when the value at the midpoint is itself uncertain. Suppose every root under consideration lies in a real interval \(X\), and \(f'\) stays between two verified positive bounds \(0<d_-\le d_+\) throughout \(X\). At \(m\in X\) the numerical or measured value supplies only \(f(m)\in[u,v]\). For any root \(r\) in the interval the mean value theorem now gives
If \(0\le u\le v\), all ratios are nonnegative. The smallest ratio uses the smallest numerator and largest denominator; the largest uses the largest numerator and smallest denominator. Consequently
If \(u<0<v\), both extremes instead use the smallest denominator. The new candidate interval becomes
These enclosures retain any root in \(X\); existence still needs independent evidence such as verified opposite signs at the ends. A sign-uncertain midpoint can prevent further narrowing once evaluation error dominates. Tightening only the derivative interval need not improve the result materially in that regime. For machine-certified endpoints, rounded arithmetic must widen each interval as needed.
Worked example
Enclose a square root with a rounded residual
For \(f(x)=x^2-2\) on \([1.4,1.5]\), use \(m=1.45\), verified derivative interval \([2.8,3.0]\), and a coarse residual enclosure \([0.102,0.103]\). Then \(X_{\rm new}=[1.45-0.103/2.8,\,1.45-0.102/3.0]\), which is contained in the outward-rounded interval \([1.41321,1.41600]\). The endpoint signs of the original interval establish existence, and the positive derivative makes the root unique.
Second application
Recognize the resolution floor of a sensor
A separate monotone balance has derivative in \([4,5]\). At \(m=3\), its instrument reads zero within \(\pm0.020\). The sign-uncertain formula gives \(r\in[2.995,3.005]\) for any root in the working bracket. To certify a half-width \(0.001\) using the same lower derivative bound, the residual measurement must be resolved to \(\pm0.004\) or better unless additional location information is available.
From a point step to an enclosure
Let \(f\) have a continuous derivative throughout a closed interval \(I\). Choose \(m\in I\) and compute an interval \(D\) containing every derivative value on \(I\). If \(0\notin D\), any root \(r\in I\) satisfies \(0=f(m)+f'(\xi)(r-m)\) by the mean value theorem. Therefore \(r\in N=m-f(m)/D\). Intersecting \(N\) with \(I\) retains every possible root. An empty intersection certifies that the original interval contained none. Since the derivative has a fixed sign, there can be at most one.
Existence needs an additional argument. Opposite endpoint signs suffice by continuity. Alternatively if \(N\) lies strictly inside \(I\), its extremal corrections force a sign change or a zero at \(m\): for an increasing function and \(f(m)>0\), moving left by \(f(m)/\min D\) decreases the function by at least \(f(m)\). That point lies in \(I\). The other signs follow by reversing the interval or taking \(-f\). This argument explains why proper containment has stronger meaning than partial overlap.
Enclose a square root
For \(f=x^2-2\) on \([1,2]\), derivatives lie in \([2,4]\). The midpoint gives \(f(1.5)=0.25\), so \(N=[1.5-0.25/2,1.5-0.25/4]=[1.375,1.4375]\). Its width is one sixteenth of the starting width. Ordinary Newton at 1.5 would give \(1.416\overline6\); an accurate single estimate carries a different type of evidence from an enclosure with guaranteed endpoints.
Choose \(m=1.40625\) in the new interval. Now \(f(m)=-0.0224609375\) and \(D=[2.75,2.875]\). The next interval lies between \(1.40625+0.0224609375/2.875\) and \(1.40625+0.0224609375/2.75\), approximately \([1.414062,1.414418]\) with endpoints rounded outward. For narrower intervals the variation in \(1/f'\) shrinks proportionally to width when \(f'\) is Lipschitz and bounded away from zero. Because \(f(m)\) is itself proportional to width near the root, the new width often decreases quadratically.
Keep the certificate valid
Each arithmetic operation needs outward rounding when performed in floating point. Rounding inward can exclude a root even when the algebra is exact. If a derivative interval crosses zero, ordinary interval division cannot give a single bounded correction. Subdivide and test again, or use an independent enclosure argument. For \(x^2\) on \([-1,1]\), repeated subdivision approaching zero encounters a true double root where the derivative vanishes. The usual simple-root contraction argument does not apply there. A sign-change test also misses this root because the function just touches the axis.
Use a stronger derivative enclosure when possible
For \(f(x)=x+x^3\) on \([-1,1]\), the derivative is \(1+3x^2\). Multiplying two independent copies of the interval \([-1,1]\) gives the loose product \([-1,1]\), leading to the derivative enclosure \([-2,4]\). Treating the expression as an actual square instead gives \([1,4]\), excluding zero. The latter bound allows the interval Newton step at the midpoint to collapse directly onto the root zero. Both interval results enclose every derivative, but keeping algebraic dependence between two identical factors greatly improves the certificate.
Extend enclosure to a system using a preconditioned map
For a differentiable vector function \(F\), choose an approximate inverse Jacobian \(C\), a box \(X\) and a centre \(m\) inside it. Roots of \(F\) are fixed points of \(G(x)=x-CF(x)\), and the converse holds when \(C\) is nonsingular. The integral mean-value identity expresses \(G(x)\) as \(m-CF(m)\) plus an averaged derivative \([I-CJ]\) acting on \(x-m\). If every true Jacobian on the box is enclosed in an interval matrix, interval arithmetic produces an outer enclosure for the complete image \(G(X)\). This is the basis of a Krawczyk-type inclusion test.
A simple sufficient certificate is to bound the induced infinity norm of \(I-CJ(x)\) by \(q<1\) throughout the box and show that \(G(X)\subseteq X\). The closed box is complete, so the contraction theorem then gives a unique root in it. In a cube of radius \(\rho\) around \(m\), it suffices that \(\|CF(m)\|_\infty+q\rho\le\rho\). If this test fails, no conclusion follows: the box may be too large, \(C\) may be a poor inverse, or the interval enclosures may have lost correlation between entries.
Certify a coupled nonlinear equilibrium with one matrix bound
Let \(F_1=x+0.1y^2-1,\ F_2=y+0.1x^2-1\). Use centre \(m=(0.90,0.90)^T\), cube radius 0.05 and \(C=I\). Each central residual is
The derivative of \(G(x,y)=(1-0.1y^2,1-0.1x^2)\) has zero diagonal and off-diagonal entries \(-0.2y,-0.2x\). On the cube both coordinate magnitudes are at most 0.95, so every absolute row sum is at most 0.19. The total displacement bound is
This verifies existence and uniqueness within the box without assuming that the answer has equal coordinates.
The first map evaluation gives \((0.919,0.919)\). A tighter direct image uses the monotonic decrease of \(1-0.1s^2\) for positive \(s\): both coordinates land in \([1-0.1(0.95)^2,1-0.1(0.85)^2]=[0.90975,0.92775]\). Uniqueness together with symmetry under swapping coordinates forces the root in this box to satisfy \(x=y=s\). The scalar equation \(s+0.1s^2=1\) then gives
which lies within the certified interval.
The other scalar root \(-5-\sqrt{35}\) lies far outside the box. The local certificate excludes no roots elsewhere and must not be reported as global uniqueness. In floating-point certification, round every bound outward, particularly evaluations that nearly touch a face. A convenient approximate Newton iterate can suggest the centre, while the independent box computation supplies the actual existence claim.
Consider expanding the initial certificate all the way to the cube \([-6,6]^2\). The corresponding row-sum bound would be 1.2, violating the simple contraction criterion, and the scalar symmetry reduction exhibits two roots in that cube. Thus in this enlarged domain failure of the uniqueness test correctly reflects an actual multiplicity problem. On a moderately larger domain the very same bound might merely be too conservative. Either situation calls for subdivision or sharper derivative information, rather than interpreting a failed sufficient test as evidence of nonexistence.
Subdividing preserves the distinction because the certificate can be applied independently on each smaller closed box.
Enclose a root using a derivative interval
Start with \(I=[1.5-h,1.5+h]\) containing the positive root of \(x^2-2\). By the mean value theorem the root lies in \(1.5-0.25/[3-2h,3+2h]\). Take care when dividing by a positive interval and subtracting it.

Read values from the plot
| Initial half-width about 1.5 | Interval Newton lower endpoint | Exact √2 | Interval Newton upper endpoint |
|---|---|---|---|
| 0.09 | 1.4113 | 1.4142 | 1.4214 |
| 0.2175 | 1.4025 | 1.4142 | 1.4272 |
| 0.345 | 1.3918 | 1.4142 | 1.4322 |
| 0.4725 | 1.3783 | 1.4142 | 1.4366 |
| 0.6 | 1.3611 | 1.4142 | 1.4405 |
Change parameters · Enclose a root using a derivative interval
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Problem sheet 4 · Root sensitivity and certificates
Quantify the influence of coefficients and use derivative intervals to make verifiable statements about roots.
A multiple root splits
Take \(p=(x-3)^2\). Add a constant perturbation \(\delta\) and determine all real roots for \(\delta=-0.0004,0,+0.0004\). Explain why the usual derivative-based sensitivity formula fails.
Worked solution
Solving \((x-3)^2=-\delta\) gives \(2.98\) and \(3.02\) for the negative perturbation, a double root 3 for zero, and no real roots for positive perturbation.
The derivative \(2(x-3)\) vanishes at 3, so dividing by this derivative is undefined. The displacement 0.02 is proportional to the square root of the coefficient error. It need not be small relative to the coefficient error itself.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Evaluate before deflating
For \(p=x^3-6x^2+11x-6\), use Horner evaluation at 2.1 to obtain \(p\), \(p'\), and the synthetic quotient upon division by \(x-2.1\). Check that the quotient and remainder reconstruct the original value at zero.
Worked solution
The coefficient sweep gives \(1,-3.9,2.81,-0.099\). The derivative sweep uses the old coefficients and gives \(0,1,-1.8,-0.97\), so \(p'(2.1)=-0.97\).
The quotient is \(x^2-3.9x+2.81\), with remainder \(-0.099\). At zero this gives \((-2.1)(2.81)-0.099=-6\). Treating the remainder as zero would change the constant term of the reconstructed polynomial.
Try this calculation. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Contract or reject
Apply interval Newton at the midpoint to \(f(x)=x^2-3\) on \([1.5,2]\). Then repeat on \([2,2.2]\). Compute both interval corrections and interpret their intersections.
Worked solution
In the first interval \(m=1.75\), \(f=1/16\), and \(D=[3,4]\). Subtracting the quotient gives \([1.75-1/48,1.75-1/64]\), approximately \([1.72916,1.73438]\) outward. Opposite endpoint signs and a positive derivative give exactly one root.
In the second interval \(m=2.1\), \(f=1.41\) and \(D=[4,4.4]\). The enclosure before intersection is \([1.7475,1.77955]\) rounded outward, entirely below 2. Its intersection is empty, excluding a root in the starting interval.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Chapter 9 · Secant information for systems
Derive Broyden's rank-one Jacobian update and decide whether the direction it learned is sufficient for the next step.
From first principles
Update a Jacobian using what one step measured
Suppose a system has residual map \(F\) and the current Jacobian approximation is \(B\). Moving by a nonzero displacement \(s\) yields an observed residual change \(y=F(x+s)-F(x)\). A local linear map consistent with this observation must satisfy
Look for the smallest adjustment \(D=B_{\rm new}-B\) in Frobenius norm. For each row the minimum-length vector with prescribed dot product against \(s\) is parallel to \(s\). Thus
Multiplying by \(s\) checks that the observation is reproduced exactly. For every vector \(v\) perpendicular to \(s\), \(Dv=0\), so the action in such directions is preserved. The resulting rank-one update is
One secant identifies only one directional response. Curvature and noise both affect \(y\), making a tiny or poorly resolved step a weak basis for updating an entire Jacobian model.
Derivation and applications
Make a secant update respect physical coordinate scales
The smallest change in the entries of a Jacobian depends on the units used for each input variable. To construct a scale-aware update, choose a positive definite state metric \(W\), so that squared step length is \(s^TWs\). Write scaled coordinates \(z=W^{1/2}x\), leaving the output units fixed. If \(B\) approximates the derivative with respect to physical \(x\), the corresponding scaled derivative and step are
Apply the ordinary smallest-Frobenius-change secant update in the scaled coordinates. Conversion back to \(x\) multiplies the resulting matrix on the right by \(W^{1/2}\). Simplifying gives
The secant equation holds for every positive definite metric. The action preserved outside the measured direction is now determined by weighted orthogonality,
This construction assumes the selected scales describe relevant changes in each variable and that the step is observed accurately. It is invariant under a common multiplication of \(W\) by a positive scalar. Different relative scales legitimately produce different unmeasured directional predictions, since a single step cannot identify those predictions from data alone.
Worked example
Compare scaled updates for an imbalanced step
Take one output, \(B=(0,0)\), step \(s=(1,10)^T\) and observed change \(y=2\). An unscaled update yields \((2,20)/101\). If typical variable scales are 1 and 10, choose \(W=\operatorname{diag}(1,0.01)\). Then \(s^TWs=2\), giving \(B_{\rm new}=(1,0.1)\). Both estimates give dot product 2 on the observed step. Their predictions on \((1,0)\) differ by a factor of 50.5.
Second application
Check invariance after a unit conversion
Suppose \(s=(2,1)^T,\ W=I,\ B=0,\ y=5\). The new row is \((2,1)\). Express the second step component in units one hundred times smaller:
The scaled update is \((2,0.01)\), which gives the same output change \(4+1=5\). A future physical unit displacement along the second coordinate also gives the same response under either representation.
What one trajectory identifies
After a step \(s=x_{k+1}-x_k\), two measured residuals provide \(y=F(x_{k+1})-F(x_k)\). Integrating the Jacobian along the connecting segment yields
Thus \(y\) measures the action of an averaged Jacobian on just one direction. Rebuilding an unrestricted \(n\times n\) Jacobian from these \(n\) numbers is underdetermined. Impose the secant equation \(B_{\rm new}s=y\) and prefer the smallest possible change to the current approximate Jacobian \(B\) in Frobenius norm.
Set \(w=y-Bs\). Each row of the correction must have specified dot product with \(s\). The shortest such row is a multiple of \(s^T\); any added component orthogonal to \(s\) increases its squared length. Solving the scalar normalisation in each row gives
The new matrix is exact on \(s\) for the observed change and leaves every vector perpendicular to \(s\) unchanged. An earlier secant equation can be disturbed if its direction has a component along the latest step. This update approximates the Jacobian; updating an inverse directly requires its own formula and conditions.
Observe two independent directions
Let \(F(x)=Ax-b\), \(A=\left(\begin{smallmatrix}2&1\\1&3\end{smallmatrix}\right)\) and \(B_0=I\). A displacement \(s_1=(1,0)^T\) gives
The first correction changes column one, giving \(B_1=\left(\begin{smallmatrix}2&0\\1&1\end{smallmatrix}\right)\). An independent orthogonal displacement \(s_2=(0,1)^T\) gives \(y_2=(1,3)^T\) and recovers the second column exactly. After these two measurements the whole linear operator is known. Such orthogonal probe steps illustrate identifiability; an actual solver selects directions from its approximate Newton equations, so its steps need not be orthogonal.
Instead repeat the first step scaled by two. The predicted and observed residual changes now agree on that direction and the update vanishes, even though \(B_1\) is still wrong on \(e_2\). Small secant corrections by themselves therefore do not demonstrate that all directions of the linearisation are reliable.
When to request a new Jacobian
Given \(B_k\), solve \(B_ks=-F(x_k)\), test the step and update with the displacement actually accepted. Reusing the proposed full displacement after a line search violates the secant equation for the measurements taken. If function data contain errors of size \(\epsilon\), then dividing a change in their difference by a tiny step can corrupt the learned derivative by order \(\epsilon/\|s\|\). Compare achieved reduction with the predicted reduction, monitor the size of the residual itself and occasionally recompute a Jacobian if the model becomes unreliable. These diagnostics matter most when evaluating the underlying residual is substantially cheaper than assembling its derivatives.
Judge a secant across a bend
For the scalar residual \(f=x^2-1\), moving from one to two supplies secant slope three, the average of endpoint slopes two and four. Reusing it near two underestimates the current slope by one. Over a step from 1.9 to two the secant slope is instead 3.9. This simple example isolates two types of Jacobian discrepancy: even perfectly accurate data constrain only the sampled direction, and nonlinear variation makes that directional measurement an average over a finite segment. Shorter accepted steps reduce the latter discrepancy until residual evaluation noise becomes important.
Update an inverse without rebuilding a factorisation
Suppose an invertible Jacobian approximation \(B\) has inverse \(H\). A secant update of the form \(B_+=B+uv^T\) has inverse \(H_+=H-Huv^TH/(1+v^THu)\) provided the scalar denominator is nonzero. Multiply this candidate by \(B+uv^T\) to verify the formula: the two added rank-one terms from the individual products are cancelled by the cross term after factoring the common denominator. If the denominator vanishes, \(B_+Hu=(1+v^THu)u=0\) and the updated matrix is singular whenever \(u\ne0\).
For Broyden's Jacobian update \(u=y-Bs,\ v=s/(s^Ts)\), the denominator becomes \(s^THy/(s^Ts)\). Substitution yields
This satisfies the inverse secant condition \(H_+y=s\). It is specifically the inverse of the minimal-change Jacobian update. Directly minimising the Frobenius change in the inverse subject to this condition gives a different formula in general, because minimum changes in a matrix and its inverse are not equivalent objectives.
Distinguish harmless secant data from a singular update
Start with \(B=H=I\), take \(s=(1,0)^T\) and observe \(y=(2,1)^T\). The new Jacobian replaces its first column with \(y\) and leaves its second unchanged, giving \(B_+=\left(\begin{smallmatrix}2&0\\1&1\end{smallmatrix}\right)\). Here \(s^THy=2\). The inverse update adds \((s-y)s^T/2\) to the identity, producing \(H_+=\left(\begin{smallmatrix}1/2&0\\-1/2&1\end{smallmatrix}\right)\). Multiplication confirms both \(H_+B_+=I\) and \(H_+y=s\). Applying it to a new residual \((0,1)^T\) leaves that residual unchanged before the sign change for the Newton correction.
Now observe \(y=(0,1)^T\) for the same step. The updated Jacobian has identical columns \((0,1)^T\) and determinant zero. This need not mean the true Jacobian is singular. For example the perfectly invertible exchange matrix with columns \((0,1)^T\) and \((1,0)^T\) gives exactly that observation. The problem is that the unmeasured old second column has become incompatible with the newly learned first one. One directional observation cannot determine which of those explanations is correct.
If the observed first component were a small \(\epsilon\) rather than exactly zero, the inverse update would amplify certain residuals by order \(1/|\epsilon|\). Monitoring the update denominator relative to the norms of \(s\) and \(Hy\), and verifying the residual reduction after the step, can detect this failure mechanism. Rebuilding independent derivative information is more informative than applying repeated almost-singular rank-one corrections derived from essentially the same trajectory.
One diagnostic is to probe the unmeasured direction directly before committing to a new inverse. In the exchange-matrix example choosing an independent displacement \(s_2=e_2\) yields measured change \(e_1\), while the singular provisional matrix predicts \(e_2\). The disagreement localises the missing derivative information in a particular column. Returning to the original linear equations then gives an invertible Jacobian with determinant minus one. A diagonal perturbation of the singular provisional matrix would also make a solve possible, but it would not reveal which physical direction the model couples to the second coordinate. Additional measurements and algebraic regularisation address different uncertainties in the step.
In a larger system, probe selection can focus on directions where the model repeatedly gives inaccurate residual predictions.
Change parameters · Explore the worked calculation
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Study the full derivation
Accelerating fixed points with differences of residuals · Nonlinear systems and iterative methods
A slowly convergent physical iteration contains information in the direction of successive errors. Use a scalar extrapolation and a small residual-minimisation problem to exploit that information, then test the extrapolated state against the original equation.
Chapter 10 · Solving Newton equations inexactly
Allocate work between the inner linear iteration and outer nonlinear iteration, and estimate the accuracy needed from a Jacobian action.
From first principles
Track the residual left by an approximate Newton solve
A large nonlinear system may make an exact Newton correction too expensive. Suppose the computed step \(s_k\) solves its linearized equation only approximately. Define the linear defect \(d_k=J(x_k)s_k+F(x_k)\) and require its norm to be a fraction \(\eta_k\) of the starting imbalance,
If the Jacobian is \(L\)-Lipschitz along the trial segment, integrating its change along the step bounds the nonlinear remainder. Substituting the observed defect into the Taylor expansion gives
The first term is controllable by the inner solver; the second is inherent in using a local linear model. Solving the inner equation much more accurately than the nonlinear remainder demands can waste effort. Close to a regular root, progressively smaller forcing fractions permit faster outer convergence when derivative products and residual evaluations are also accurate enough.
Derivation and applications
Derive a subtraction-free directional derivative for analytic residuals
A matrix-free Newton iteration needs products \(J(x)v\). A complex perturbation can obtain such a product without subtracting two nearly equal real residuals. Assume each component of \(F\) is real for real arguments and has an analytic extension along \(x+zv\) near \(z=0\). The implementation must propagate complex arithmetic through the same analytic formulas. Expanding a scalar component in the direction \(v\) gives
Real coefficients make even powers real and odd powers imaginary. Extracting the imaginary part and dividing by \(h\) therefore produces a second-order directional approximation for sufficiently smooth analytic data,
The unperturbed real value never appears in a cancellation-prone subtraction. If a product approximation \(\widetilde Jv\) is used within an inexact Newton solve, the true linear defect still includes its directional error. For the proposed step \(s\),
A small reported inner residual can conceal inaccurate Jacobian actions. An operation that discards imaginary parts, takes an absolute value, or branches differently under complex inputs violates the argument. Extreme steps can also underflow or interact with inaccurate library computations, so agreement across several steps is a useful check.
Worked example
Check the truncation error on a cubic
For \(F(x)=x^3,\ x=2,\ v=1,\ h=0.1\), the true action is \(3x^2=12\). The imaginary part of \((2+0.1i)^3\) is \(1.2-0.001=1.199\), giving \(11.99\) after division. Halving \(h\) gives \(11.9975\), quartering the error exactly because all higher derivatives vanish.
Second application
Expose a nonanalytic implementation
Suppose a real residual is implemented as \(F(x)=|x|\). At \(x=2\), its real derivative is one. A direct complex call at \(2+ih\) returns the real modulus \(\sqrt{4+h^2}\); its imaginary quotient is zero for every \(h\). For a proposed correction \(s=-0.1\), the Jacobian action is thus wrong by \(0.1\), far above an inner defect budget of \(0.001\). Shrinking the complex perturbation cannot repair the implementation mismatch.
The linear defect survives into the next residual
For a differentiable system \(F(x)=0\), an exact Newton step cancels the first two terms in the Taylor expansion \(F(x+s)=F(x)+J(x)s+R(s)\). If the Jacobian is Lipschitz continuous with constant \(L\) on the segment, integrating its variation gives
For a computed step define the linear defect \(d=F(x)+J(x)s\). An inner iterative solver can stop once \(\|d\|\leq\eta_k\|F(x)\|\). Its dimensionless forcing factor \(\eta_k\) controls how much of the old residual may survive the linear solve.
Near a simple root assume \(\|J^{-1}\|\le M\) and full steps. Then \(\|s\|\le M(1+\eta_k)\|F(x)\|\), because \(Js=-F+d\). Substitution gives
A forcing factor bounded below one permits local linear convergence. A factor tending to zero gives superlinear convergence, and \(\eta_k=O(\|F(x)\|)\) restores a quadratic local bound when units and scaling have been fixed. Solving early linear systems to near machine precision may waste work because model curvature dominates the outer error.
Observe the uncancelled term
For \(f(x)=x^2-2\), start at \(x=1.5\), where \(f=0.25\) and \(J=3\). The exact step is \(-1/12\); its new residual equals \(s^2=1/144\). If the computed step is \(-0.075\), the defect is \(0.25-0.225=0.025\), a forcing factor of 0.1. The actual residual at 1.425 is \(0.030625=0.025+0.005625\). Most of this residual now comes from the inner solve. Halving the step simply for caution would increase the linear defect again; a line search and an inner tolerance address different questions.
Apply a Jacobian without storing it
A Krylov solver can request a directional action through \(Jv\approx [F(x+hv)-F(x)]/h\). With normalised \(v\), a smooth residual and absolute evaluation uncertainty \(\epsilon\), the error behaves like \(C_1 h+C_2\epsilon/h\). Minimising that model gives a scale proportional to \(\sqrt\epsilon\), with units and scales supplied by \(x\), \(v\) and \(F\). Automatic directional differentiation can avoid this differencing error when the residual implementation permits it.
An inner iteration using approximate products may report a small residual for its own approximate linear model. Verify a candidate full step by evaluating the actual nonlinear function, and compare the measured reduction with the forcing prediction. Once errors in evaluating \(F\) exceed the requested outer tolerance, neither decreasing the forcing factor nor making difference steps smaller can supply the claimed accuracy.
Produce a Jacobian action by forward differentiation
A matrix-free Newton solve asks for \(J(x)v\). Finite differences subtract two complete residual evaluations. Forward-mode automatic differentiation instead propagates a directional derivative alongside each intermediate value. Represent an intermediate by \(a+\dot a\varepsilon\), with \(\varepsilon^2=0\). Addition combines the two components separately. Multiplication gives \(ab+(a\dot b+\dot a b)\varepsilon\). A smooth scalar operation \(\phi\) gives \(\phi(a)+\phi'(a)\dot a\varepsilon\). Applying these rules to the operations of the original residual program is just repeated use of the chain rule.
Seed each independent input with its component of \(v\). The final values give \(F(x)\). The accompanying derivative components give \(J(x)v\) in the same sweep. There is no differencing increment to select. Errors in ordinary floating-point arithmetic and the accuracy of the underlying residual program still matter. A branch switch or an absolute value at zero can leave the mathematical derivative undefined. Differentiating the particular executed branch cannot supply the missing derivative. For a full dense Jacobian the method generally requires a separate direction for each independent column.
For example use the shared intermediate \(s=x+y\) in \(F=(s e^y-1,s^2+x-4)^T\). At \((2,0)\) propagate direction \((1,-2)\). The pairs for \(x,y\) are \((2,1)\) and \((0,-2)\). \(s\) becomes \((2,-1)\), and \(e^y\) becomes \((1,-2)\). The first output is therefore \((1,-5)\), the second \((2,-3)\). Thus \(F=(1,2)^T\) and the Krylov product is \((-5,-3)^T\). As a separate check the analytic Jacobian at this point has rows \((1,3)\) and \((5,4)\), whose dot products with the seed give the same two numbers.
Practise on sheet 5 · Differentiate a reciprocal with a shared input. Further reading · Massachusetts Institute of Technology · 18.S096 Matrix Calculus for Machine Learning and Beyond · Chapter 8, Forward and Reverse-Mode Automatic Differentiation, §8.1.3 Dual numbers.
Scale the forcing ratio for coupled balances
Consider two model balances expressed in newtons and millimetres. A raw Euclidean norm compares numerical values in these unrelated units. Changing the length unit alone can then make an inner solve appear more or less successful. Introduce a diagonal row scaling \(W\) based on meaningful force and length scales, and test \(\|W(F+Js)\|\le\eta\|WF\|\). With characteristic magnitudes 1000 N and 0.1 mm, physical defects of 1 N and 0.001 mm become dimensionless defects 0.001 and 0.01. The second equation is now the larger unmet balance, even though its dimensional number is smaller.
Budget a matrix-free central derivative separately
When the linearised equation is solved through matrix-vector actions, the inner solver works with estimates of \(Jv\). For a unit search direction \(v\), set \(\psi(t)=F(x+tv)\). The centred difference \([\psi(h)-\psi(-h)]/(2h)\) cancels even Taylor terms and has truncation error bounded by \(M h^2/6\) if the third directional derivative has norm at most \(M\) on the segment. If each residual evaluation carries absolute error bounded by \(\epsilon\), subtraction and division can contribute up to \(\epsilon/h\). This is a worst-case model; paired evaluations with strongly correlated errors can behave differently.
Minimising \(M h^2/6+\epsilon/h\) gives \(h=(3\epsilon/M)^{1/3}\) for positive \(M\). This balance is specific to the centred, second-order formula and requires evaluating the residual twice for each direction. A derivative already available by an analytic action or automatic differentiation has a different accuracy and cost model. Moreover \(M\) depends on both the operating state and the direction; a single unscaled absolute step is rarely well calibrated for a system mixing quantities with strongly different units.
Compare the derivative error with the requested inner accuracy
For \(f(x)=x^3-2\) at \(x=1\), the true derivative is three and the exact centred estimate at step \(h\) is \(3+h^2\), so \(M=6\). Let each function evaluation have absolute uncertainty at most \(2\times10^{-9}\). The worst-case derivative error is bounded by \(h^2+2\times10^{-9}/h\), minimised at \(h=0.001\). The truncation contribution is then \(10^{-6}\) and the evaluation contribution is \(2\times10^{-6}\), giving a combined bound of \(3\times10^{-6}\). Reducing the step to \(10^{-5}\) makes the evaluation contribution \(2\times10^{-4}\), about sixty-seven times the previously balanced total error.
The exact Newton correction at this state is \(s=1/3\). If the inner solver uses the approximate scalar derivative \(3+e\), it can solve its own equation exactly by taking \(s=1/(3+e)\). The true linear defect is then
For the balanced derivative bound this can be about \(10^{-6}\) in size. An inner residual display near machine zero therefore need not establish a true forcing ratio of \(10^{-8}\). The derivative action, rather than the Krylov stopping tolerance, has become the limiting approximation.
A practical way to expose this discrepancy is to repeat a few directional actions over a geometric sequence of \(h\) values, looking first for the expected quadratic truncation trend and then for deterioration. Such comparisons estimate sensitivity to evaluation and discretisation errors; they are not a rigorous lower bound on what all directions achieve. Recompute the actual nonlinear residual after an accepted step to discover whether the reduced model accuracy still suffices for useful outer progress.
If the finite-difference increment represents a physical parameter change that crosses a material switch, the required third derivative need not exist on the segment. A tidy numerical plateau across several step sizes can then obscure a change of branch. Verify that both directional evaluations use the same smooth model region before interpreting the calculated optimum increment.
Change parameters · Explore the worked calculation
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Problem sheet 5 · What an approximate Jacobian knows
Construct a minimal secant update, diagnose the loss of an earlier secant equation, and budget an inexact Newton step.
A diagonal measurement direction
Given \(B=I\), \(s=(1,1)^T\), \(y=(3,1)^T\), compute Broyden's updated matrix. Verify the new secant equation and its action on \((1,-1)^T\).
Worked solution
The discrepancy is \((2,0)^T\) and \(s^Ts=2\). The correction is \(\left(\begin{smallmatrix}1&1\\0&0\end{smallmatrix}\right)\), giving \(B_{\rm new}=\left(\begin{smallmatrix}2&1\\0&1\end{smallmatrix}\right)\).
Multiplication by \(s\) yields \((3,1)^T\). Multiplication by \((1,-1)^T\) yields \((1,-1)^T\), unchanged because that vector is perpendicular to the observed step.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
A new measurement can disturb an old one
Suppose \(B=\operatorname{diag}(2,1)\) already predicts the action of \(A=\operatorname{diag}(2,3)\) on \(e_1\). Take \(s=(1,1)^T\), compute the updated matrix, and check both secant directions. Which subsequent probe would measure the second column directly?
Worked solution
The new measured change is \((2,3)^T\) while \(Bs=(2,1)^T\), so add \(\left(\begin{smallmatrix}0&0\\1&1\end{smallmatrix}\right)\). The new matrix is \(\left(\begin{smallmatrix}2&0\\1&2\end{smallmatrix}\right)\).
Its action on \((1,1)^T\) is exact but its action on \(e_1\) is now \((2,1)^T\) rather than \((2,0)^T\). Taking \(s=e_2\) would directly observe \(Ae_2=(0,3)^T\), independently of the first column.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Budget an inner defect
For \(f=x^2-4\) at \(x=2.1\), an inner solver returns \(s=-0.095\). Compute its linear defect, forcing ratio and true new residual. If the target forcing ratio were 0.02, would this step meet the target?
Worked solution
\(f=0.41\), \(f'=4.2\), so the defect is \(0.41-4.2(0.095)=0.011\) and the ratio is \(0.011/0.41\approx0.02683\).
At \(x+s=2.005\), the residual is \(0.020025=0.011+0.095^2\). The permitted linear defect would be \(0.0082\), so this step misses the inner tolerance despite substantially reducing the outer residual.
Explore the related calculation with adjustable inputs. Explore how initial values and the residual slope affect Newton and secant convergence on the quadratic reference problem; retain the stated residual when checking the present hand calculation.
Differentiate a reciprocal with a shared input
Let \(s=1+xy\) and \(F=(s,1/s+x)^T\). Evaluate both the residual and its Jacobian action at \((2,1)\) in direction \((-1,2)\) using dual arithmetic. Then propagate only the seed \((0,1)\). State what must be checked before applying the same rules to a program that replaces \(s\) by \(|s|\).
Worked solution
For the first seed the product \(xy\) has derivative \((-1)1+2(2)=3\), so \(s=(3,3)\) in value–derivative notation. The reciprocal has pair \((1/3,-3/9)\). Adding \(x\) gives
The second seed yields \(\dot s=2\) and second output derivative \(-2/9\). This supplies exactly the second Jacobian column. At the stated positive \(s\), the absolute-value operation has derivative one. At \(s=0\) the absolute value has a kink and the reciprocal is undefined, so no ordinary Jacobian action of this modified residual exists there.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Revisit chapter 10 · Produce a Jacobian action by forward differentiation.
Chapter 11 · Gauss–Newton and residual curvature
Derive Gauss–Newton from a local residual model and locate when omitted curvature or insufficient information changes the step.
From first principles
Derive Gauss–Newton from a local model of measured residuals
Let \(r(x)\) contain the differences between model predictions and measured data, expressed in comparable units or whitened by their known uncertainties. With more measurements than unknowns, exact agreement may be impossible. Minimize \(\phi(x)=\|r(x)\|^2/2\). A first-order local model of each differentiable residual produces a linear least-squares problem for a step \(s\),
At the minimum the predicted residual is orthogonal to every column of \(J\), yielding the Gauss–Newton equations
If \(J\) has independent columns, the local model has a unique minimizer. In computation a QR or singular-value solve can be preferable to forming \(J^TJ\). Residual functions with strong curvature may make a full model step inaccurate, particularly when the best fit still has large residuals. Comparing actual and predicted decrease tests the local approximation.
Derivation and applications
Predict local Gauss–Newton convergence when the best residual is nonzero
For a nonlinear least-squares problem a stationary point can retain a mismatch with the observations. That mismatch multiplies residual curvature in the exact Hessian and can control the iteration speed. To expose the effect, take one scalar parameter \(x\), residuals \(r_i(x)\) with two continuous derivatives, and objective \(\phi=\tfrac12\sum_i r_i^2\). Differentiate twice to separate two contributions,
Gauss–Newton replaces the actual curvature by the always nonnegative sensitivity term \(H\). Assume \(x_*\) has \(g(x_*)=0\) and \(H(x_*)>0\). Differentiate the update map \(G(x)=x-g(x)/H(x)\). At the stationary point the term involving \(H'\) cancels exactly because \(g=0\), giving
The local error thus behaves as
If all residuals vanish, the linear error term disappears. A strict local minimum of the true objective need not attract the full Gauss–Newton iteration: positive total curvature \(H+S\) alone does not enforce \(|S/H|<1\). Damping changes the local factor by multiplying the modeled correction by a fraction.
Worked example
Predict oscillation near a weakly curved mismatch
Take \(r_1=x,\ r_2=1+0.2x^2\). At \(x_*=0\), \(H=1\), \(S=0.4\), giving local factor \(-0.4\). Starting at \(x=0.10\), \(g=0.14008\), \(H=1.0016\), and the full update lands at \(-0.03986\), close to the linear prediction \(-0.040\). The fitted residual of one in the second channel controls the alternating approach.
Second application
Stabilize a minimum that repels full steps
For \(r_1=x,\ r_2=1+x^2\), the origin is a strict minimum since \(\phi''(0)=3\). The full-step factor there is \(-2\), so small errors grow. A half-step changes the factor to \(1-0.5(3/1)=-0.5\), restoring local contraction. The residual value at the optimum is identical in both examples; its curvature determines the different behaviour.
More equations than unknowns
Repeated measurements generally leave a residual even at the best parameters. For \(r(x)\in\mathbb R^m\), minimise \(\Phi(x)=\|r(x)\|^2/2\). Differentiating gives
At a stationary point the residual is perpendicular to every first-order change accessible by varying the parameters. It may remain large if the model cannot reproduce the observations. Different physical units require weights or a clear rescaling before squaring coordinates; otherwise a change of units silently changes what solution is optimal.
Approximate \(r(x+s)\) by \(r+Js\) and minimise its squared norm. The least-squares condition is
In practice a QR or singular-value factorisation of \(J\) avoids squaring its condition number. The exact Hessian is \(J^TJ+\sum_i r_i\nabla^2r_i\). Thus the neglected term vanishes at a zero-residual solution, but can matter for strongly curved residuals with a poor fit. A descent direction follows with full column rank whenever the gradient is nonzero: multiplying the normal equations by \(s^T\) gives
Fit two incompatible observations
A parameter \(x\) predicts \(x\) for one sensor and \(x^2\) for another. Suppose their dimensionless observations are 1 and 2. Then \(r=(x-1,x^2-2)^T\). At \(x=1\) the residual is \((0,-1)^T\) and \(J=(1,2)^T\). The linear model chooses \(s=2/5=0.4\), moving to 1.4. The objective drops from 0.5 to \((0.4^2+0.04^2)/2=0.0808\). An exact fit is impossible because \(x=1\) would require the other observation to be one.
At the original point the exact second derivative is \(5-2=3\), so a full scalar Newton step on the objective would be \(2/3\), quite different from the Gauss–Newton step. At 1.4 the gradient is
Another Gauss–Newton step is
The iteration reverses direction as the two sensor discrepancies begin to balance. Monitoring only the second sensor would favour a different parameter.
Regularise the step model
Minimising \(\|r+Js\|^2+\lambda\|s\|^2\) gives
A positive \(\lambda\) controls overly large steps along weakly observed directions. With \(\lambda=5\) at the original point the step becomes 0.2 and the true objective at 1.2 is 0.1768. This is a smaller first improvement but may be more reliable elsewhere. Compare the actual decrease with that predicted by the local model to adjust damping. This temporary penalty on the step differs physically from assuming in advance that the final parameter itself must be small.
Changing one sensor's reliability changes the fit
Suppose the squared residual of the second sensor receives weight one quarter because its standard deviation is twice that of the first. In the worked example at \(x=1\), the scalar normal-equation numerator becomes \(0+(1/4)\,2(-1)=-0.5\); its denominator becomes
The step is now 0.25. The model has moved less far from the exactly matched first sensor because the second sensor's discrepancy now carries less statistical weight. Repeated observations with correlated errors would require a full covariance model to interpret this weighting as a statistical fit.
Derive a bounded-influence residual fit
Ordinary least squares makes a single residual's contribution to the gradient proportional to its magnitude. If rare gross errors are plausible, choose a loss that is quadratic for small discrepancies and linear for large ones. For the Huber loss with transition \(\delta>0\), use \(\rho(r)=r^2/2\) for \(|r|\le\delta\) and \(\delta |r|-\delta^2/2\) otherwise. Matching value and derivative at both transition points ensures a continuously differentiable convex objective in a location parameter. Its score is \(\psi(r)=\max(-\delta,\min(r,\delta))\).
For differentiable model residuals \(r_i(x)\) the stationarity equation becomes
Set \(w_i=\psi(r_i)/r_i\) for nonzero residuals and one at zero. The score is now a weighted residual and solving a succession of weighted least-squares problems supplies an iteratively reweighted method. The weights must be recomputed from each current fit. Treating them as externally measured inverse variances would misinterpret their statistical role. Convexity of \(\rho\) in \(r\) does not by itself guarantee convexity with respect to nonlinear parameters.
Trace the effect of a contaminated reading
Four sensors estimate the same scalar location and report 0, 1, 2 and 20 in common standardised units. Least squares fits their mean \(23/4=5.75\). Use \(\delta=1\) instead, with residuals \(x-b_i\). In the interval \([1,2]\) the first sensor contributes score \(+1\) and the last contributes \(-1\). The two central readings contribute \(x-1\) and \(x-2\). The sum is \(2x-3\), which vanishes at 1.5. Convexity makes this a global minimum. Increasing the last reading to 200 leaves its score at minus one throughout the same interval and does not change the fitted location.
At \(x=1.5\) the four weights are \(2/3,1,1,1/18.5\). A weighted-average check confirms stationarity more transparently through the signed weighted residuals: \(+1,+0.5,-0.5,-1\) sum to zero. The final gross discrepancy is still 18.5 units. A robust fit limits how much that observation can move the fitted value; it does not explain why the instrument returned such a reading. Record it for investigation rather than replacing it silently by a reconstructed value.
For a physical model with differently scaled sensors, first divide discrepancies by appropriate instrument uncertainty scales or choose distinct physically defensible transition values. A single threshold measured in raw units can suppress every reading from one instrument merely because its unit is larger. Conversely an overly large threshold reduces to ordinary least squares over the whole observed residual range. Compare fits under plausible thresholds and investigate whether the prediction of interest changes, especially when a group of related sensors shares the same fault.
A gross error in an input coordinate is a further distinction. A calibration point at an extreme input can have large leverage through its Jacobian row even after its residual score has been capped. Thus the bounded score controls sensitivity to residual amplitude, while the geometry of the design still controls how much that bounded discrepancy can rotate or translate the final fit.
Change parameters · Explore the worked calculation
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Chapter 12 · Inequalities and active constraints
Translate one-sided equilibrium into complementarity equations, identify an active set and verify both force and feasibility.
From first principles
Express one-sided contact as a complementarity condition
Consider a point constrained to have gap \(g\ge0\) above a frictionless rigid stop. A compressive reaction \(p\ge0\) can prevent penetration, but a separated stop exerts no force. These requirements give the scalar conditions
They allow either an open gap with zero force or closed contact with a nonnegative force. To connect this with optimization, suppose the physical coordinate is the gap itself and the unconstrained stored energy is differentiable and convex. At a constrained minimum on \(g\ge0\), every feasible first-order change has nonnegative energy change. Thus the equilibrium derivative obeys
In the interior one may move in both directions, forcing zero derivative. At the boundary only increases in gap are feasible, allowing positive derivative. The balance equation for a specific spring or load supplies the remaining relationship needed to determine the gap and force.
Background · Complementarity
Both quantities are nonnegative and at least one vanishes. Active-set changes can make a smooth Newton model inappropriate across the switch.
Derivation and applications
Quantify the gap introduced by smoothing a contact condition
Algebraic regularization can replace the sharp switch between an open and a closed contact with a differentiable approximation. First scale the gap and reaction into dimensionless variables \(g,p\), using stated positive reference scales. One exact residual is \(\sqrt{g^2+p^2}-g-p\): setting it to zero implies \(g+p\ge0\), and squaring gives \(gp=0\), which together force nonnegativity. Introduce a smoothing parameter \(\mu>0\),
At a zero, \(g+p>0\), and squaring gives \(gp=\mu\). Thus both quantities are positive even where the physical contact would be exactly open or closed. For a one-degree-of-freedom linear balance \(p=k(g-g_0)\) with positive scaled stiffness \(k\) and unloaded gap \(g_0\), solve the positive quadratic root:
For an exactly grazing load \(g_0=0\), the smoothing affects gap and force on square-root scales,
Far from this switching point the smaller of the two quantities decays linearly with \(\mu\). A small residual of the smoothed equation only proves that the regularized balance has been solved. The value of \(\mu\) and the physical reference scales determine the discrepancy from exact contact.
Worked example
Measure parasitic force across an open gap
Let \(k=4,\ g_0=0.50,\ \mu=0.010\). The exact unsmoothed balance is
The smoothed solution gives
with \(p_\mu=0.01980\). Multiplication gives \(g_\mu p_\mu=0.0100\), an independent check on the source of this residual force.
Second application
Choose smoothing at a grazing contact
With \(k=9\) and dimensionless admissible gap error \(0.002\), a grazing contact requires \(\sqrt{\mu/9}\le0.002\). Thus \(\mu\le3.60\times10^{-5}\). At this upper value the induced reaction is \(0.0180\). If the admissible reaction is only \(0.009\), the stricter requirement is
A stop can push in only one direction
A constrained coordinate \(u\) must remain nonnegative and has an elastic energy \(E(u)=ku^2/2-fu\), \(k>0\). Minimising a differentiable energy on a half-line gives an interior stationary point when \(u>0\). At the endpoint zero, only nonnegative variations are possible, so the one-sided derivative must be nonnegative. Introduce the reaction \(w=ku-f\). These conditions read \(u\ge0,\ w\ge0,\ uw=0\). They express that at least one of gap and reaction vanishes. A similar rule applies componentwise to a vector of gaps coupled through a stiffness matrix.
The scalar solution is
Increasing \(f\) through zero changes the slope of the load–displacement graph. The solution stays continuous while its derivative jumps. Near that change an unconstrained differentiable root solver can produce a negative gap or an inadmissible attractive reaction unless its equations include the inequalities.
Couple two potential contact points
Let \(K=\left(\begin{smallmatrix}2&-1\\-1&2\end{smallmatrix}\right)\), \(f=(-1,1)^T\), \(w=Ku-f\) and \(u_i\ge0\). The unconstrained equilibrium gives \(u=K^{-1}f=(-1/3,1/3)^T\), violating the first gap. Test the set with \(u_1=0\), \(w_2=0\). The second equation becomes \(2u_2-1=0\), hence \(u_2=1/2\). Recover the first reaction \(w_1=-1/2+1=1/2\). Every gap and reaction is now nonnegative and every product vanishes. Positive definiteness of \(K\) makes the quadratic energy strictly convex, so a feasible stationary state satisfying these inequalities is its unique minimum.
For a changed load \(f=(-0.4,1)^T\), the same assumed active set yields \(w_1=-0.1\), which is inadmissible. Release the first coordinate and solve \(Ku=f\). Using \(K^{-1}=\left(\begin{smallmatrix}2&1\\1&2\end{smallmatrix}\right)/3\) gives \(u=(1/15,8/15)^T\), positive in both coordinates, with zero reactions. A small change of loading has switched the equations that determine the state.
A residual for switching equations
After compatible nondimensionalisation, \(\min(u_i,w_i)=0\) is equivalent to the three componentwise complementarity conditions. Where \(u_i<w_i\), linearising the minimum selects the gap equation; where \(w_i<u_i\), it selects the equilibrium equation. At equality the derivative is not unique, which explains the need for a switching rule or a nonsmooth Newton formulation. A product alone is insufficient: a negative gap and zero reaction give a zero product. Report the largest feasibility violation and a complementarity residual together. At the scalar switching load \(f=0\), both gap and reaction vanish and the active designation is ambiguous even though the state itself is unique.
Read the reaction as the price of a constraint
Return to a single gap with stiffness 2 and load −4. Its minimum over \(u\ge0\) occurs at zero with reaction 4. Now move the lower stop to \(u\ge d\) for a small positive \(d\). The constrained minimum becomes \(E(d)=d^2+4d\), whose derivative at zero is 4, precisely the original reaction. A small imposed displacement of the active stop requires work to first order. For a positive load producing a strictly open gap, the same small stop shift would initially have no effect and the reaction would be zero. These energy changes provide an independent check on the reaction sign.
Derive a discrete obstacle problem from virtual work
Consider a membrane represented by three interior displacements with fixed zero displacements at its ends. In scaled units the elastic energy is one half the sum of squared neighbouring differences, including the terms at both supports. Its stiffness matrix has diagonal two and neighbouring entries minus one. An obstacle at height \(g_j\) requires
Minimising \(E(u)=u^TKu/2-f^Tu\) over this convex feasible set gives a simple test involving every feasible variation: \((Ku-f)^T(v-u)\ge0\) for every feasible \(v\).
To see necessity, move a small fraction of the distance from \(u\) toward \(v\) and differentiate the energy at zero step. For sufficiency, the exact energy difference equals that linear term plus \((v-u)^TK(v-u)/2\), which is nonnegative and strictly positive for a nonzero displacement because both endpoints are fixed. At an interior free node both signs of variation are allowed, so its reaction vanishes. At an active obstacle only upward variations are feasible, so the signed reaction is nonnegative. These properties give complementarity between the gap \(u-g\) and the reaction \(Ku-f\).
Determine which part of an obstacle actually supplies force
Let \(g=(0,1,0)^T\), \(f=0\). Setting all displacements equal to the obstacle would give
with negative endpoint reactions at the first and third interior nodes. Those two active guesses are inadmissible. Keep only the middle node in contact and solve free-node equilibrium: \(2u_1-u_2=0\) and \(2u_3-u_2=0\). With \(u_2=1\) this yields \(u=(0.5,1,0.5)^T\), whose reactions are \((0,1,0)^T\). The end gaps are both positive and the central gap is zero, satisfying the complete optimality test.
The energy is half the sum of four squared slopes \(0.5,0.5,-0.5,-0.5\), hence 0.5. The candidate that hugs the entire obstacle has slopes \(0,1,-1,0\) and energy one. Lifting the two free nodes lets the membrane distribute curvature more economically while remaining above the obstacle. Independently the sum of the support reactions balances the unit central contact force, since each outer spring slope has magnitude 0.5 in these scaled units.
Apply an additional positive force \(f_2=t\) at the centre while keeping the obstacle fixed. The contact-state reaction becomes \(1-t\). Up to \(t=1\) the position stays fixed and the contact load decreases. For \(t>1\) the contact can no longer sustain a negative reaction; solving the unconstrained equations gives \(u=(t/2,t,t/2)^T\), now above every obstacle node. This piecewise response exhibits an observable change of slope in displacement at the contact transition. Reusing the old active set without checking the sign of its reaction would incorrectly predict an unchanging displacement for arbitrarily large lifting forces.
A force test and a gap test remain necessary even when the computed energy looks sensible. For example \(u=(0.4,1,0.4)^T\) is feasible and has energy only 0.52, close to the optimal 0.5. Yet its outer reactions are each −0.2 at strictly open gaps. The complementarity equations identify the reducible energy error even without knowing the exact energy minimum.
Locate the switch between free motion and contact
A unit-stiffness spring has free displacement equal to applied force but a rigid stop enforces \(x\le1\). With contact force \(r\ge0\) the force balance is \(x+r=f\) and complementarity gives \(r(1-x)=0\). Examine each active set.

Read values from the plot
| Applied force (normalised) | Displacement | Reaction |
|---|---|---|
| −2 | −2 | 0 |
| −0.25 | −0.25 | 0 |
| 1.5 | 1 | 0.5 |
| 3.25 | 1 | 2.25 |
| 5 | 1 | 4 |
Change parameters · Locate the switch between free motion and contact
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Problem sheet 6 · Misfit and one-sided equilibrium
Distinguish a stationary residual fit from an exact root and identify which unilateral constraints carry load.
Fit incompatible sensors
Two dimensionless residuals are
Compute the exact least-squares state, both residuals and their dot product with the Jacobian. How many undamped Gauss–Newton steps suffice from zero?
Worked solution
The gradient is \((x-2)+2(2x-3)=5x-8\), giving \(x=1.6\). The residual is \((-0.4,0.2)^T\) and the dot product with \((1,2)^T\) is zero.
The residual is affine, so its linear model is exact everywhere. One step from zero produces 1.6 even though neither individual observation is exactly satisfied.
Try this calculation. Change one observation’s uncertainty and recompute the weighted projection. More than one fitted coefficient requires the additional basis columns specified in this exercise.
A stationary point with a poor model
For the scalar residual \(r=x^2-1\), evaluate the residual, gradient and curvature of \(\Phi=r^2/2\) at zero. Analyse the undamped Gauss–Newton linear least-squares subproblem there, and compare it with a trial step to \(x=0.1\).
Worked solution
At zero \(r=-1\), \(J=0\) and \(Jr=0\). Exact curvature \(J^2+rr''=-2\) identifies a strict local maximum.
The model \(r+Js=-1\) has the same size for every step, so cannot select a descent direction. Directly testing \(x=0.1\) gives \(\Phi=0.99^2/2=0.49005\), below 0.5. A small gradient alone cannot certify a minimum.
Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.
Locate the switching load
Use \(K=\left(\begin{smallmatrix}3&-1\\-1&2\end{smallmatrix}\right)\), \(f=(t,2)^T\), \(u,w\ge0\), \(w=Ku-f\), \(u_iw_i=0\). Assume the first gap is closed. Determine the range of \(t\) for which that assumption holds and solve the case \(t=0\).
Worked solution
With \(u_1=0\), the open second gap has \(2u_2=2\), so \(u_2=1\). The first reaction is \(-1-t\), nonnegative precisely for \(t\le-1\). At the threshold the closed coordinate has zero reaction.
At \(t=0\) release the first gap. Solving \(3u_1-u_2=0\), \(-u_1+2u_2=2\) gives \((0.4,1.2)^T\) with both reactions zero. The positive gaps verify the new active set.
Explore the related calculation with adjustable inputs. Inspect the active-set switch in the scalar contact example. The two-coordinate exercise still requires checking both inequalities with its stated stiffness matrix.
Locate and follow the two equilibria of a fold
Consider equilibria of the dimensionless evolution u′ = λ − u². For λ = 0.04 find both roots, classify their stability, and estimate the movement of the positive root when λ increases by 0.002. Then find out why stepping in λ fails near zero and construct a continuation step through the fold.
Worked solution
The equilibria are u = ±0.2. A small perturbation obeys δu′ ≈ −2u δu, so +0.2 attracts while −0.2 repels. Both are perfectly valid zeros of the steady residual. A solver’s ability to converge to either root has no direct implication for dynamical stability.
Differentiating u²−λ = 0 gives du/dλ = 1/(2u). At the positive root the predicted change is +0.005. The exact change is √0.042 − 0.2 ≈ 0.00494. At the negative root the sign reverses. As the fold approaches, sensitivity diverges even though the equilibrium curve itself is the smooth parabola λ = u².
At (u,λ) = (0,0) choose the tangent along increasing u. An arclength predictor of length 0.05 gives (0.05,0). Keep the correction normal to that tangent by imposing u = 0.05 together with the residual. The corrected point is (0.05,0.0025). The two-equation Jacobian remains invertible there and at the fold. A parameter sweep fixing λ below zero would have no real point to correct to.
Explore the related calculation with adjustable inputs. Use the equilibrium parabola to inspect sensitivity and the tangent-coordinate continuation step. Translate the state coordinate if the fold is centred at a different value here.
Chapter 13 · Why a flat zero slows Newton's method
Factor a residual near a multiple root, recover the missing factor in a Newton step and distinguish a small residual from a small location error.
Expand around the actual root
Write \(f(x)=(x-r)^m g(x)\), with \(g\) smooth and \(g(r)\ne0\). Denote the current error by \(e=x-r\). Differentiation gives
Away from the root the quotient stays finite even when both function and derivative become very small. Substitution into Newton's update gives
If \(m=1\), the first-order error cancels. If \(m>1\), a fixed fraction survives. Multiplying the correction by the known multiplicity gives \(e_+=e^2g'/(mg+eg')\), restoring local quadratic convergence. A wrong value of \(m\) can send steps across the root or make them diverge.
A contact measurement
Near tangency a gap can behave like \(f=(x-2)^2\) in dimensionless coordinates. Starting from 3 produces 2.5, 2.25 and 2.125. The gap residual falls by a factor of four per step. The location error only halves. A stopping rule \(|f|<10^{-8}\) certifies merely \(|x-2|<10^{-4}\) in this exact model. The multiplicity-corrected step reaches 2 immediately.
Now take \(f=e^2(1+e)\) at \(e=0.1\). The residual and derivative are 0.011 and 0.23. An ordinary correction leaves error 0.05217. Twice the correction leaves 0.00435. The analytic denominator explains why this second update is no longer exact when \(g\) varies.
Compare errors over twelve iterations
Use \(f=e^m(1+e)\) with positive starting error. Follow the ordinary and multiplicity-corrected ratios without forming underflowing powers. The logarithmic display stops at a floor of \(10^{-15}\). Check the slope of the ordinary iteration after the first few steps.
Tutorial on error certificates
A zero of \(f=e^4\) has residual \(10^{-12}\). How many decimal places of location accuracy follow from this observation alone?
Worked solution
The magnitude of the location error is \(10^{-3}\). Four powers have compressed the residual. Any inference based on a nonzero lower bound for \(|f'|\) fails across this root.
Why might a sign-changing bracket never isolate a double root?
Worked solution
The leading sign is the sign of \(g(r)\) on both sides. A sampler can step across the root without a sign change. Information about stationary points or a separate lower-bound argument is needed.
Read the university treatment
Compare the error analysis at a simple root with the extra multiplicity factor derived here. Driscoll and Braun · Solving nonlinear equations
Study the full derivation
Count enclosed zeros with a contour before locating them · Nonlinear systems and iterative methods
A complex residual may have several nearby zeros whose Newton basins are hard to distinguish. Use the argument principle to count them, contour moments to estimate their locations and an independent perturbation test to certify a root cluster.
Chapter 14 · Eliminating a fixed point's leading geometric error
Recover a limit from three consecutive iterates, derive Steffensen's update and find the cancellation that makes an apparently faster step unreliable.
Three readings of an unknown limit
Suppose \(x_n=r+cq^n\) with unknown \(r,c,q\). Consecutive differences are \(c(q-1)q^n\) and \(c(q-1)q^{n+1}\). Their ratio estimates \(q\). Substituting that ratio into the sum of the geometric tail gives Aitken's delta-squared estimate
For an exactly geometric sequence the denominator is \(cq^n(q-1)^2\) and the cancellation is exact. For a smooth fixed-point map \(g\) with \(|g'(r)|<1\), the leading error is locally geometric, with a quadratic remainder. Replacing \(x_n,x_{n+1},x_{n+2}\) by \(x,g(x),g(g(x))\), then restarting at the estimate, gives Steffensen's iteration. Each outer step costs two map evaluations.
Two computed limits
For \(g(x)=1+0.8(x-1)\) and \(x=0\), the three numbers are 0, 0.2 and 0.36. The denominator is \(-0.04\). The accelerated value is
A slowly contracting map can supply a very accurate extrapolation when the data are exact.
To solve \(x=\cos x\), begin at 0.5. The next two map evaluations are approximately 0.87758 and 0.63901. The accelerated value is about 0.73139. Its fixed-point residual is much smaller than the initial \(\cos(0.5)-0.5\), but plugging the result back into the original equation is essential: the geometric model is now only local.
Compare by number of map evaluations
Use the smooth map \(g(1+e)=1+qe+0.05e^2\) close to its fixed point. Plain substitution gets one update per function call. The accelerated curve receives two calls per update. Read the horizontal axis before deciding which method made better use of the budget.
Tutorial on stability of the transformation
For an exact linear map with \(q=0.999\) and error one, what order of magnitude is the second difference?
Worked solution
Its magnitude is \((1-q)^2=10^{-6}\), while the three original readings may be of order one. A measurement perturbation comparable to this denominator can completely change the extrapolation.
What should an implementation do at an exact fixed point where all three readings agree?
Worked solution
Return that fixed point after checking the residual. The delta-squared expression is then \(0/0\). Away from a certified fixed point, a small denominator warrants retaining a verified plain step or a different local model.
Study the full derivation
Accelerating fixed points with differences of residuals · Nonlinear systems and iterative methods
A slowly convergent physical iteration contains information in the direction of successive errors. Use a scalar extrapolation and a small residual-minimisation problem to exploit that information, then test the extrapolated state against the original equation.
Chapter 15 · Deciding how far to trust a linearised residual
Derive an acceptance test from predicted versus actual decrease and see how it rescues a Newton direction that crosses the root by a large distance.
Choosing a step from a local model
For a scalar residual \(f\), finding a zero also minimises \(\phi=f^2/2\) if a zero is attainable. Near \(x\), approximate \(f(x+s)\) by \(f(x)+f'(x)s\), yielding a quadratic model \(m(s)=(f+f's)^2/2\). Minimise this model subject to \(|s|\le\Delta\). In one dimension this clips the ordinary Newton step to the interval; when \(f'=0\), the model contains no preferred direction.
Measure both predicted and actual decrease. Provided the predicted decrease is positive, define
A ratio near one supports the local model. A negative ratio means that a predicted gain produced an actual loss. Shrink the radius and repeat from the same point. A successful boundary step can justify enlarging the next radius. These decisions require an extra residual evaluation and do not require a globally accurate Taylor approximation.
Background · Trust radius
The local model is minimised on this region. Agreement between predicted and achieved reduction guides the next radius.
Two proposals for the same equation
For \(f(x)=x^2-2\) at \(x=0.2\), \(f=-1.96\), \(f'=0.4\). The full Newton proposal \(s=4.9\) lands at \(5.1\), where the residual is 24.01. The linear model predicted zero. The merit function rises catastrophically.
With radius one, \(s=1\) gives \(x=1.2\) and \(f=-0.56\). Predicted merit decrease is
Actual decrease is
The ratio exceeds one because the curvature accelerated the improvement. A large ratio is possible and has a direct interpretation.
Look along the step before accepting it
Compare the true merit function and the local model along positive steps from a starting value below the root. Move the trust radius and read the ratio for the constrained minimiser. Locate a region in which predicted and observed changes have opposite signs.
Tutorial on choosing a merit function
Start at zero for the same equation. Can reducing the radius find a direction from this particular model?
Worked solution
Here \(f'=0\) while \(f=-2\). The linearised residual is constant, hence every step predicts zero decrease. The ratio is undefined. A curvature model, perturbation, or another starting point is needed.
Is a small gradient of \(f^2/2\) sufficient to certify a root?
Worked solution
Its gradient is \(ff'\). It can vanish either at a root or at a stationary residual. Report the original residual and test feasibility to distinguish these outcomes.
Read the university treatment
Follow the nonlinear least-squares section to compare damping a proposed step with solving a constrained local subproblem. Driscoll and Braun · Nonlinear equations
Chapter 16 · A physically positive root across six decades
Reparametrise the unknown and rescale the residual in a nonlinear resistance model. Follow what each choice changes in a Newton step.
Start from a positive constitutive quantity
An ideal thermistor calibration can be written \(R/R_*=e^z\). More generally a sensor fit may require a positive amplitude \(x\) satisfying its logarithmic reading \(\log x=d\). A Newton correction on \(f(x)=\log x-d\) gives
Even with a unique perfectly regular root \(e^d\), this formula can propose a negative amplitude when the initial residual exceeds one. Evaluating the next logarithm would then be impossible.
Choose \(z=\log x\) instead. The equation in the new variable is \(z=d\) and one step yields the answer. For an arbitrary residual \(f(x)\), chain differentiation gives
Newton moves \(z\) by \(-f/(xf')\), so the update in \(x\) is multiplicative:
Near a simple root, expanding the exponential gives the ordinary first-order correction; the difference is quadratic in the relative step. A logarithmic coordinate enforces positivity at every finite iterate. It cannot restore information missing from the measurement.
Measure failure and sensitivity separately
At \(d=0\), \(x_0=10\) gives \(x_1=10(1-\log 10)\approx-13.03\) with additive Newton. Log coordinates give \(x_1=1\). Start instead at 0.1. Additive Newton gives about 0.3303 and remains admissible. Positivity depends on the proposal relative to its scale.
If \(d=\log(1000)\) with measurement uncertainty 0.01, the parameter is about 1000 with relative uncertainty 1%. The direct sensitivity follows by differentiating the equation: \(dx/dd=x\). The same 0.01 measurement error near \(x=0.001\) means an absolute error near \(10^{-5}\), again about 1%. Changing variables improves interpretation of a relative uncertainty, without changing the information in the observation.
Inspect a Newton proposal without losing its invalid values
The ordinate shows the next candidate divided by the exact positive root. The horizontal axis is the starting ratio. The additive curve crosses zero at \(e\); the logarithmic update reaches the root from every displayed start. Move the marker to read the actual candidates for a chosen target scale.
Tutorial on relative residuals
A model supplies \(F(x)=e^{0.1x}\) and a positive observation \(y\). How do residuals \(F-y\) and \(\log F-\log y\) weight small changes near a fit?
Worked solution
Near \(F=y\),
A squared log residual weights errors approximately by relative error. Choosing it implies a different observation-noise model when fitting several readings.
If the true parameter can be exactly zero, what does the logarithmic coordinate miss?
Worked solution
The zero boundary is at \(z=-\infty\). A finite transformed iterate cannot represent it. One must allow a boundary solution explicitly when the physics admits it.
Chapter 17 · Finding a turning point without using the load as a coordinate
Use tangent geometry to continue across a fold, and distinguish branch sensitivity from an ill-posed choice of variable in an equilibrium computation.
Two equilibria share one control value
Use the scaled normal form \(F(x,p)=x^2+p=0\). The equilibrium curve is \(p=-x^2\). At \(p=-0.01\) two displacements, \(x=\pm0.1\), give the same load. Direct continuation in \(p\) uses \(dx/dp=-F_p/F_x=-1/(2x)\). The derivative diverges at the fold. Plotting \(p\) against \(x\), however, produces a smooth curve there.
Background · Backward error
Specify how perturbations in data or equations are measured. A tiny perturbation making the computed value exact can coexist with a large solution error near a fold.
Add a geometric condition
At a known point \(y_0=(x_0,p_0)\), let \(t\) be a unit tangent perpendicular to \((2x_0,1)\). A predictor \(y_*=y_0+\Delta s\,t\) lies on the tangent. Correct it by solving \(F(x,p)=0\) together with \(t\cdot(y-y_*)=0\), which confines corrections to a line normal to the old tangent. At the fold the Jacobian of this pair is
With the tangent aligned with the displacement axis, \(t_x\) is nonzero. The pair remains locally invertible where load control alone fails. This is a change in the computation's coordinate, not removal of the physical multiple equilibria at a fixed load.
A step that crosses the maximum
Start at \(x_0=-0.1,p_0=-0.01\) with increasing \(x\), so \(t=(1,0.2)/\sqrt{1.04}\). A step of length 0.2 predicts \(x_*\simeq0.0961,p_*\simeq0.0292\), which is off the curve and has positive load. The correction line satisfies
Substitute \(p=-x^2\) to obtain \(x-0.2x^2\simeq0.1020\). The nearby root is about 0.1041 and the corrected load about −0.0108. Both endpoints have negative load despite crossing the maximum.
Test the predictor before trusting it
Choose the starting displacement and step length. Plot the tangent segment, the original curve and the selected nearby intersection of the correction line with the curve. A large step makes the tangent less faithful. The correction must stay on the intended local branch.
Tutorial on the experimental meaning
At \(p=-0.01\), a pressure measurement has uncertainty 0.001. Estimate its local displacement uncertainty and compare it near \(p=-0.0001\).
Worked solution
At \(|x|=0.1\), \(|dx/dp|=5\) and the linear estimate is 0.005. At \(|x|=0.01\), the formal factor is 50. The same pressure error now exceeds the distance to the fold, so the local linear approximation itself loses validity.
If the continuation algorithm traces both sides smoothly, are both equilibria dynamically stable?
Worked solution
A static residual gives equilibrium locations. Stability requires the linearisation of a specified evolution law or a second variation of the appropriate energy. Smooth numerical traversal gives no such certificate.
Study the full derivation
Finding another equilibrium after one root is known · Nonlinear systems and iterative methods
Newton iteration repeatedly finds the same structural equilibrium. Derive how deflation changes its basins while preserving other solutions, use a rank-one Jacobian update, and distinguish a list of discovered equilibria from a completeness certificate.
Chapter 18 · Newton's method for an unknown covariance square root
A pair of independent unit-variance signals must be transformed to a prescribed covariance ellipse. One can solve a scalar square-root equation along each principal axis. A calibration that starts in a different frame exposes the genuinely matrix-valued derivative. Derive it, solve for its correction, and determine which residual will detect a wrong update.
Translate a covariance requirement into an equation
Suppose \(z\) is a zero-mean random vector with identity covariance. Let a deterministic device produce \(y=Xz\). Multiplying out \(yy^T\) and averaging gives
A target covariance \(A\) is symmetric and positive semidefinite by construction. Restrict the exercise to positive definite targets. They correspond to genuine variation in every direction and allow us to discuss an invertible square root. The notebook uses two dimensionless readout channels, so mixing their coordinates has a defined physical meaning.
If the sole purpose were generating random samples, any factor satisfying \(XX^T=A\) would do. Indeed, replacing \(X\) by \(XQ\) for an orthogonal \(Q\) leaves this output covariance alone. We make an extra modelling decision: the calibration transform should be symmetric and positive. This picks a distinguished factor that stretches along principal axes and introduces no orthogonal rotation. The equation becomes \(X^2=A\). A Cholesky factor produces the correct covariance too, but squaring that generally triangular factor is a different calculation.
To see existence, diagonalise \(A=Q\Lambda Q^T\). The matrix \(S=Q\sqrt{\Lambda}Q^T\) squares to \(A\). For uniqueness on the positive branch, a putative root commutes with its own square and consequently preserves each eigenspace of \(A\). Within an eigenspace of eigenvalue \(a>0\), a symmetric positive root has only positive eigenvalues whose squares equal \(a\). It must act there as \(\sqrt a\) times the identity. Repeated eigenvalues leave the choice of basis in that subspace free while the positive root itself stays fixed.
Differentiate before choosing a linear solver
For scalar data, expanding \((x+h)^2=x^2+2xh+h^2\) supplies Newton's familiar correction. For matrices write every factor in its original order. The cross terms are \(XH\) and \(HX\). They coincide only under a commutation condition. The first variation is therefore a linear map on a whole matrix, not multiplication by a single derivative matrix on the left.
Set the linearised residual to zero. The correction \(H\) solves the Sylvester equation \(XH+HX=A-X^2\). If \(X\) and the right-hand side are symmetric, the transpose of any solution satisfies the same equation. Existence and uniqueness on the positive branch therefore guarantee a symmetric correction. This argument is a practical implementation check: an update with substantial antisymmetric part could not have been obtained by solving this particular Newton equation accurately.
Diagonalise the current iterate \(X=U\,\mathrm{diag}(d_i)U^T\). Write a tilde for the representation in the \(U\) basis. The \(ij\) entry of \(XH+HX\) becomes \((d_i+d_j)\widetilde H_{ij}\). We can solve entry by entry and transform back. All denominators are positive if \(X\) is positive. The minimum denominator is \(2d_{\min}\); as the smallest stretch approaches zero, a fixed residual can request a large correction in a weakly varying direction. This sensitivity also appears when estimating a covariance from data near a rank loss.
A tilted measurement that defeats the scalar update
Choose the axes of the current iterate for a hand calculation and take \(X=\operatorname{diag}(2,1)\). Suppose the target covariance measured in these axes is \(A=\bigl(\begin{smallmatrix}5&1\\1&2\end{smallmatrix}\bigr)\). It is positive because its determinant is nine and its first diagonal entry is positive. Then \(R=A-X^2\) has all four entries equal to one. The diagonal corrections are \(1/4\) and \(1/2\). Both off-diagonal corrections equal \(1/3\), so the update rotates the stretching axes as well as changing their magnitudes.
What if one used \(2XH=R\)? The two off-diagonal entries of that candidate would be \(1/4\) and \(1/2\) instead. It fails even the requirement that the correction be symmetric. Its upper off-diagonal Sylvester residual is
A code that checks only whether \(2XH-R\) vanishes would report success on exactly the wrong derivative. A well-chosen verification problem needs noncommuting matrices. If both the initial and target matrices are diagonal in the same basis, the extra terms disappear from this test.
With the correct correction, substitution into the expanded formula gives \(F(X+H)=H^2\) in exact arithmetic. This provides a surprisingly inexpensive check: solve one linear system, form the new nonlinear residual, and compare it with the square of the correction. For the hand example the first diagonal entry of \(H^2\) equals
The initial value of \(F_{11}\) was \(-1\). There is no reason every residual component should decrease at every remote initial condition, but this one-step identity holds regardless of the starting error.
Which errors does quadratic convergence describe?
Near the desired root, the inverse Sylvester map is bounded if the smallest eigenvalue of the iterate stays away from zero. In Frobenius norm the correction obeys \(\|H\|_F\le\|R\|_F/(2d_{\min})\). Together with submultiplicativity and \(F(X+H)=H^2\), this yields a bound on the next residual proportional to the square of the preceding one. The proportionality constant depends on the current scale. This explains the near-doubling of correct digits late in the calculation and also why such a rule cannot be assumed for an arbitrary ill-conditioned target from the first step.
For this particular problem even preservation of the positive branch can be understood. Rearrange the equation for \(Y=X+H\) to give
The right side is positive. In an eigenbasis of positive \(X\), the inverse operator admits the integral representation \(Y=\int_0^\infty e^{-tX}(A+X^2)e^{-tX}\,dt\). Differentiate the integrand and integrate over the half line to verify the equation; the exponential vanishes at infinity. Each integrand is positive definite for finite \(t\). Thus an exact step from positive \(X\) yields positive \(Y\). This is specific to the equation and branch presently being solved.
Open full-size diagramUse a residual, a branch check and an independent solver
Run the notebook with target eigenvalues nine and one and a starting tilt of 35 degrees. The desired standard-deviation stretches are three and one. The plotted circle has radius one in input coordinates; the output contour has those semiaxes only for the target factor. A unit-radius contour in two dimensions is not a statement that 68 per cent of samples are enclosed. That probability requires a specified distribution and dimension. Read the ellipse here as a drawing of the linear transformation.
Set the initial angle to zero and repeat the comparison between the full and scalar-style derivatives. They now agree because \(X\) and \(A\) share eigenvectors. Next switch back to the tilted start and increase the target anisotropy. Observe the size of the first correction and the number of accepted steps. At the final iterate compare its square with the target and check its smallest eigenvalue. A negative definite square root could have residual zero as well. The sign constraint is therefore informative even for a solver that seems to have converged perfectly.
The optional OneSimulation calculation in the notebook takes an independent route through the derivative. Stacking the columns of \(H\) converts the Sylvester map into \(I\otimes X+X^T\otimes I\). A dense linear solve of the resulting four-by-four system should reproduce the rotated entrywise correction. Stacking rows while building the column-stacking operator would generally be a mistake. Large matrices would make the explicit Kronecker matrix expensive; the small example is valuable because it lets us compare two independently constructed maps directly.
Predict the effect of a small covariance error
The same derivative describes uncertainty in the result. If a measured target changes by a small symmetric matrix \(E\) and the root changes from \(S\) to \(S+\Delta\), expand the defining equation to obtain
Errors in the target's small-eigenvalue direction have a comparatively large effect on the fitted stretch there. For target eigenvalues nine and one, a diagonal covariance error of 0.06 produces first-order stretch errors of 0.01 or 0.03, depending on its direction. The relative errors differ by an additional factor of three because the original stretches are three and one.
An off-diagonal perturbation has a different interpretation. In the target eigenbasis its leading root entry is divided by the sum of the two stretches, here four. It changes the orientation of the ellipse at first order while leaving the axis lengths unchanged at that order for distinct eigenvalues. The distinction explains how visually similar residual norms can imply rather different changes to a calibrated instrument. It also shows what to record when comparing two repeat measurements: the directions of their errors should accompany the overall covariance norm.
Tutorial on branches, scaling and derivatives
1. Take \(A=\operatorname{diag}(4,9)\). Give two distinct symmetric roots and identify which one the stated calibration selects.
Work through the solution
Both \(\operatorname{diag}(2,3)\) and \(\operatorname{diag}(-2,3)\) square to \(A\). Only the first is positive definite. The residual cannot distinguish them; a test of the eigenvalues or a positive-branch construction is needed.
2. At \(X=\operatorname{diag}(3,0.2)\), compare corrections produced by equal residual entries of magnitude 0.01 on each diagonal.
Work through the solution
The first diagonal correction has magnitude \(0.01/6\simeq0.00167\). The second has magnitude \(0.01/0.4=0.025\). Thus identical absolute covariance errors require corrections differing by a factor of fifteen in the two stretch directions.
3. In the tilted hand example, what is the predicted first off-diagonal entry of the updated nonlinear residual? How would one use it to distinguish a failed linear solve from an ordinary Newton truncation?
Work through the solution
The correct \(H^2_{12}\) equals
With an inexact solve, \(F(X+H)-H^2=F(X)+XH+HX\) equals the residual of the linearised equation. Its norm tests solver accuracy separately from the nonlinear term intentionally left after a Newton step.
Further reading · Nicholas Higham, Newton's method for the matrix square root
Change parameters · Newton's method for an unknown covariance square root
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Problem sheet 7 · Project · Locate contact and calibrate a misleading residual
Two surfaces touch tangentially. A height sensor measures gap rather than signed distance. Decide what rootfinding, residual checks and a second sensor can each certify.
Recover the collision of two mathematical roots
Near the contact, model the gap as \(g(x,p)=(x-1)^2-p\), with all variables scaled by their reference units. Sketch its zeros for \(p\) above and below zero. For \(p=0.01\) begin with \([0.95,1.2]\) and test whether a sign-changing bracket isolates a root.
Work through the solution
Real roots are \(1\pm\sqrt p\) for positive \(p\), a double root at one for \(p=0\), and none for negative \(p\). At 0.95 the residual is \(-0.0075\), while at 1.2 it is 0.03. The bracket contains only the upper root at 1.1. A wider interval with both endpoints outside the two roots can have equal endpoint signs even when it contains both.
Explore the related calculation with adjustable inputs. Use the equilibrium parabola to inspect sensitivity and the tangent-coordinate continuation step. Translate the state coordinate if the fold is centred at a different value here.
Calibrate a stopping tolerance
With \(p=0\) begin at 1.2. Take three ordinary Newton steps and one multiplicity-corrected step. A calibrated sensor reading places the nonnegative gap in \([0,10^{-6}]\). What location interval follows from that bound? Compare the slopes in the multiple-root experiment.
Work through the solution
The successive locations are 1.1, 1.05 and 1.025. Multiplying the first Newton correction by two lands exactly on 1 for this pure square. A gap of \(10^{-6}\) is compatible with a displacement of magnitude \(10^{-3}\). Supplying more digits in the root does not improve that data-based bound.
Audit an algorithm that always reports convergence
At \(p=-0.001\) a least-squares routine stops at \(x=1\) and reports zero gradient. Find the residual and explain the report. Use the trust-region model to distinguish a decreasing merit function from a good final fit.
Work through the solution
The residual is 0.001, and the merit gradient \(gg'\) vanishes because \(g'=0\). This is the best fit of this model to the infeasible contact target. The positive minimum is 1,000 times the \(10^{-6}\) gap tolerance used in the preceding test. Report a nonzero closest separation and the uncertainty rather than a located contact.
Choose an additional measurement
You may measure one signed local slope \(g_x\) with uncertainty 0.002, or repeat the same absolute gap measurement. Which option resolves the side of a nearby contact? Express the position uncertainty before combining measurements.
Work through the solution
\(g_x=2(x-1)\) changes sign through contact. Its stated uncertainty yields an uncertainty of 0.001 in the inferred \(x\). An interval for the signed slope that excludes zero resolves which side of contact the instrument occupies. If the measured magnitude is at most 0.002, both signs still fit within the uncertainty. Repeated absolute gaps can improve precision in distance magnitude while retaining the symmetry between left and right solutions.
Explore the related calculation with adjustable inputs. Use the equilibrium parabola to inspect sensitivity and the tangent-coordinate continuation step. Translate the state coordinate if the fold is centred at a different value here.
Problem sheet 8 · Find a periodic orbit when the starting point has no preferred phase
A nonlinear oscillator returns to its starting point after one period. Writing that fact as a root equation leaves a neutral direction and several unrelated solutions. A solvable amplitude oscillator lets you construct, stabilise and independently check a shooting method.
Count the unknowns in a periodic return
Consider the autonomous planar oscillator \(\dot x=(\mu-r^2)x-\omega y,\ \dot y=(\mu-r^2)y+\omega x,\ r^2=x^2+y^2\), with \(\omega>0\). The example uses scaled amplitudes and seconds. Let \(\Phi_T(u)\) denote the state after integrating for time \(T\) from \(u=(x,y)\). A shooting residual is
Determine what could go wrong if a three-component unknown \((x,y,T)\) is handed to a root solver with only these two residuals.
Recover the orbit and identify spurious roots
Use polar variables away from the origin to predict which residual zeros correspond to a single nontrivial revolution.
Work through the solution
Taking \(x\dot x+y\dot y\) gives
The angular numerator \(x\dot y-y\dot x=\omega r^2\) gives
For \(\mu>0\), \(r_*=\sqrt\mu\) is stationary and the period is
Every phase on the circle gives the same periodic orbit, so there is one redundant physical direction. Furthermore \(T=0\) gives zero residual for every point; the origin gives zero residual for every \(T\); and each integer multiple of \(T_*\) solves the return condition on the nonzero circle. A physically informative solve needs an initial estimate in the basin of the desired one-turn branch, positive period and a section choosing a phase. A tiny residual alone discriminates none of these cases.
Explore the related calculation with adjustable inputs. Change the parameters in the experiment on this same project page and compare its output with this part of the derivation.
Differentiate through a complete return
Border the Newton equations with a transverse section
Take \(g(u)=y=0\) with \(x>0\). Derive a Newton matrix including period as an unknown. Why would fixing \(x=\sqrt\mu\) be a bad phase condition at this same starting point?
Work through the solution
Let \(M=D_u\Phi_T(u)\) be the fundamental matrix propagated along the trajectory. Its columns solve \(\dot M=Df(\Phi_t(u))M,\ M(0)=I\). The derivative with respect to final time is the vector field evaluated at the end of the integration. Thus the linearised return and section equations are
At a nontrivial periodic point the vector \(f(u)\) is an eigenvector of \(M\) with eigenvalue one, because starting a little later along the same orbit merely shifts the final point along it. This explains the singularity of \(M-I\) before bordering. At \(u=(\sqrt\mu,0)\) the tangent points along positive \(y\), so
A section fixing \(x=\sqrt\mu\) is tangent to the circle there; its gradient annihilates \(f\). The new row then fails to remove phase degeneracy to first order even though it seems geometrically to locate the rightmost point.
Explore the related calculation with adjustable inputs. Change the parameters in the experiment on this same project page and compare its output with this part of the derivation.
Check stability and conditioning with an exact return map
Compute the transverse multiplier without an eigensolver
Put \(q=1/r^2\) and solve its scalar initial-value problem for \(r_0>0,\mu>0\). Use the result to check one period of numerical propagation for \(\mu=0.1,\ \omega=2\pi\).
Work through the solution
Differentiating gives \(\dot q=2-2\mu q\), hence \(q(T)=1/\mu+(q_0-1/\mu)e^{-2\mu T}\). The return radius on the positive axis after \(T_*\) is therefore
At the fixed radius \(P'(r_*)=e^{-2\mu T_*}\). This also follows by linearising \(\dot r=\mu r-r^3\), whose derivative is \(-2\mu\) at \(r_*\). In the numerical case \(T_*=1.00\) s, \(r_*=0.31623\) and the transverse multiplier is \(0.81873\). The radial shooting residual has slope \(-0.18127\). A radial residual error of \(10^{-5}\) corresponds locally to a radius error of about \(5.52\times10^{-5}\). Near onset, the multiplier approaches unity and the phase condition alone cannot cure the true loss of transverse conditioning. For \(\mu\le0\) the positive finite-amplitude cycle ceases to exist, even though the origin remains an exact residual zero.
Explore the related calculation with adjustable inputs. Change the parameters in the experiment on this same project page and compare its output with this part of the derivation.
Separate time-integration error from the nonlinear residual
The experiment plots the signed one-revolution radial residual for many initial radii. One curve propagates the vector oscillator using classical fourth-order Runge–Kutta (RK4) in Cartesian coordinates. The other uses the analytical radial return. A sign change gives a candidate amplitude. The phase drift at that approximate root, reported separately, catches angular error that comparing final and initial radii alone would miss. Predict how both diagnostics should change when the time steps per turn double.
Choose a convergence test that excludes an equilibrium and a multiple turn
Describe a validation at \(\mu=0.1\) and design a check for a solver that accidentally reports \(T\simeq2\) seconds instead of one.
Work through the solution
Begin on a positive transverse section with radius near 0.316 and period near one second. Impose a positive radius floor only when selecting the intended branch, and check the integrated speed or path length to exclude a stationary solution. Resolve the radial residual with several integration meshes, testing that both return radius and phase error converge. A Newton iteration can drive the residual associated with a coarse integrator nearly to zero while its orbit is still inaccurate. Make integration error appreciably smaller than the desired orbit error after amplification by the near-singular transverse slope.
To check multiplicity, unwrap the trajectory angle or count positive-direction section crossings over the proposed orbit. The desired orbit accumulates \(2\pi\) and returns once; a two-turn solve accumulates \(4\pi\) and its nontrivial multiplier is \(e^{-4\mu T_*}=0.67032\) in this example. Stability can still appear physically sensible for a two-turn return. Counting turns or measuring a shorter repeated return tests something the residual and stability sign cannot. For systems without an analytic polar reduction, an event-defined Poincaré map and independently propagated variational equations provide the corresponding diagnostics.
Explore the related calculation with adjustable inputs. Change the parameters in the experiment on this same project page and compare its output with this part of the derivation.
Further reading
Notebook practice · Newton's method for an unknown covariance square root
Nonlinear systems and iterative methods
Begin with a residual and ask which solution is accessible. Study how curvature, scaling and conditioning affect a computed root.
- Choosing a derivative step in a nonlinear solve
A smaller finite-difference step eventually makes Newton iterations worse. Derive truncation and evaluation errors, compare a complex perturbation and a directional derivative, and test which numerical derivative is meaningful for the actual residual implementation.
- Accelerating fixed points with differences of residuals
A slowly convergent physical iteration contains information in the direction of successive errors. Use a scalar extrapolation and a small residual-minimisation problem to exploit that information, then test the extrapolated state against the original equation.
- Finding another equilibrium after one root is known
Newton iteration repeatedly finds the same structural equilibrium. Derive how deflation changes its basins while preserving other solutions, use a rank-one Jacobian update, and distinguish a list of discovered equilibria from a completeness certificate.
- Count enclosed zeros with a contour before locating them
A complex residual may have several nearby zeros whose Newton basins are hard to distinguish. Use the argument principle to count them, contour moments to estimate their locations and an independent perturbation test to certify a root cluster.
- Where does a complex Newton step take its starting point?
A single cubic has three equally simple roots. Derive the iteration, colour starting values by destination and use a separate convergence history to distinguish a bad first step from slow local convergence.
- Certifying a Newton step before the root is known
A small correction is meaningful only together with a curvature estimate. Construct a ball that contains a solution and use a frozen linear solve to make damping decisions independent of equation units.
- Which correction does an experiment identify?
Separate parameter combinations visible in a nonlinear fit, pass a regular fold by continuation and decide when to refine a boundary-value mesh before trusting its Newton residual.
Nonlinear systems and iterative methods · 1. Choosing a derivative step in a nonlinear solve
A smaller finite-difference step eventually makes Newton iterations worse. Derive truncation and evaluation errors, compare a complex perturbation and a directional derivative, and test which numerical derivative is meaningful for the actual residual implementation.
Derive competing contributions to error
Suppose \(f\) is smooth and you need its slope at \(x\) to form a Newton correction. A forward difference \(D_h=[f(x+h)-f(x)]/h\) has Taylor expansion \(f'(x)+hf''(x)/2+O(h^2)\). A centred difference \([f(x+h)-f(x-h)]/(2h)\) instead cancels the even terms, leaving \(f'(x)+h^2 f'''(x)/6+O(h^4)\). Both limits are exact in real arithmetic as \(h\to0\). The program, however, returns approximate residual values, and a subtraction of nearby values can lose significant digits. If each absolute evaluation error is at most \(\delta\), the derivative error from those perturbations is at most \(2\delta/h\) for forward difference and \(\delta/h\) for the centred one.
Thus an illustrative forward error bound has shape \(a h+b/h\); minimisation gives
The centred bound \(a h^2+b/h\) has minimiser \(h_*=(b/(2a))^{1/3}\). Floating-point roundoff acting on \(O(1)\) residual values often gives the familiar square-root and cube-root machine-precision scales, but the physical units of \(x\), the scale of the derivative and noise from the residual solver must be included. A nonlinear function evaluated by an iterative PDE solve can have a much larger \(\delta\) than roundoff. Repeating the inner solve with tighter tolerance can shift the optimal step considerably.
For \(f(x)=e^x\) at zero, the forward leading error is \(h/2\), centred error \(h^2/6\). If \(\delta=10^{-10}\) as an absolute per-value uncertainty, a forward worst-case bound gives optimal \(h=2\times10^{-5}\), while the centred model gives
The centred step can be much larger yet retain lower truncation error. This is a scale estimate using worst-case errors, not a guarantee about the phase or stochastic correlation of actual errors. If queries share common random numbers or a warm-started solver, errors can partly cancel or acquire a systematic derivative bias.
Obtain the slope from an imaginary perturbation
For a real-valued function with an analytic complex extension near the real argument, expand \(f(x+ih)=f(x)+ihf'(x)-h^2f''(x)/2-ih^3f'''(x)/6+\cdots\). Taking its imaginary part and dividing by \(h\) gives second-order accuracy with no explicit subtraction of two nearly equal real numbers. For \(e^x\) at zero, the result is \(\sin h/h\). At very small representable \(h\) the imaginary signal is itself proportional to \(h\) and may still be carried accurately by analytic elementary operations. This advantage disappears if the computation discards imaginary parts, uses nonanalytic absolute values, branches on the perturbation, or applies a black-box routine using complex arithmetic for unrelated purposes. Automatic differentiation supplies another route through differentiable implemented operations, but it too needs the program's mathematical definition to match the derivative being requested.
Audit a Jacobian action before assembling a matrix
For \(F:\mathbb R^n\to\mathbb R^m\), pick direction \(v\) and examine \(R(h)=\|F(x+hv)-F(x)-hJv\|\). If a proposed Jacobian action is correct and \(F\) is twice differentiable, \(R(h)\) initially scales like \(h^2\). A wrong first derivative generally produces a leading \(O(h)\) term. The test checks orientation, units, signs and chain rules without constructing a dense finite-difference matrix. Test several directions and scales; a wrong matrix can annihilate the one chosen direction. At very small \(h\) a roundoff or inner-solver floor eventually hides both ideal slopes. When working with constraints use perturbations remaining inside the physical domain or give derivatives in a local feasible parametrisation.
Find the useful step before a Newton update
The experiment evaluates the forward, centred and complex-step slopes of a smooth elementary residual in floating-point arithmetic. It plots absolute errors on logarithmic scales and compares them with the exact derivative. Move the evaluation point and note that occasional accidental zeros are rounded at the plotting floor. Their exact location is not a robust guarantee for a different residual. Compare the range of steps with a reproducible error trend before interpreting one apparently perfect result.
Change the evaluation before changing the step
For the exponential the forward numerator has an exact factorisation \(e^{x+h}-e^x=e^x(e^h-1)\). A numerical library's expm1(h) evaluates the last factor accurately even for very small \(h\), using a local series or a reduced-argument algorithm. Form the quotient as \(e^x\,\mathrm{expm1}(h)/h\). Its mathematical truncation error is still \(e^xh/2+O(h^2)\). Its rounding behaviour differs because the two terms near \(e^x\) are never computed separately. At \(x=1\) and \(h=10^{-18}\), adding \(h\) to a binary64 value of one rounds back to one. The direct forward quotient then returns zero. The factored evaluation gives the derivative \(e\) to working precision.
This experiment diagnoses the source of an error curve. If the algebraic form is inaccessible, a finite-difference checker sees black-box function values and cannot apply the factorisation. If the entire residual is available, stable elementary functions can change the derivative accuracy of a Newton step without changing its formal order.
Tutorial · design tests for smoothness and implementation errors
Diagnose a forward-difference Newton iteration
For \(f(x)=x^2-2\) at \(x=1.4\), obtain the exact dependence of a forward derivative estimate on \(h\). Compare one Newton step using \(h=0.1\) with the exact Jacobian.
Work through the solution
The difference quotient is
The residual is \(-0.04\). The exact step gives
using 0.1 gives \(1.413793\). Centred differences evaluate this polynomial's derivative exactly in real arithmetic for every nonzero \(h\), but roundoff can spoil very small steps. The discrepancy at large \(h\) is a calculable systematic truncation, so merely tightening the outer Newton stopping tolerance cannot remove it.
Catch a direction missed by one test
A proposed Jacobian differs from the correct one by \(E=\left(\begin{smallmatrix}1&-1\\0&0\end{smallmatrix}\right)\). Compare tests along \((1,1)\) and \((1,0)\) and show which observed slope would be misleading.
Work through the solution
The first direction lies in the nullspace of \(E\), so its Taylor remainder can show the expected \(h^2\) slope despite an incorrect Jacobian. The second has \(Ev=(1,0)\), producing an \(O(h)\) defect. Random directions augment a set of unit- or physics-informed probes, particularly when an error affects a single column or constraint block. One successful slope does not establish correctness of an entire matrix.
Determine whether complex step applies to a norm
A residual returns \(f(x)=|x|\) using a complex modulus routine. At \(x=1\), what does a complex-step call produce? Is this evidence that the real function has zero derivative there?
Work through the solution
The routine computes \(|1+ih|=\sqrt{1+h^2}\), purely real, so the reported complex-step slope is zero. The real derivative at \(x=1\) equals one. The implementation used a nonanalytic map of a complex variable. At a known positive branch the analytic local extension \(f(z)=z\) gives the correct derivative, while the real function at the kink \(x=0\) has no classical derivative. Check both the real regularity and what complex arithmetic actually executes before applying this technique.
Further reading
Nonlinear systems and iterative methods · 2. Accelerating fixed points with differences of residuals
A slowly convergent physical iteration contains information in the direction of successive errors. Use a scalar extrapolation and a small residual-minimisation problem to exploit that information, then test the extrapolated state against the original equation.
Eliminate an unknown leading error without knowing the root
Suppose a sequence obeys \(x_j=x_*+c q^j\) for an unknown limit and mode multiplier \(q\ne1\). Subtract successive terms to find
Eliminating \(q,c\) yields the Aitken extrapolation \(\hat x_j=x_j-(x_{j+1}-x_j)^2/(x_{j+2}-2x_{j+1}+x_j)\). For a single exact geometric error it returns the limit after observing three values, even if the multiplier is negative and the iterates oscillate. If the denominator is near zero relative to numerical uncertainty, the extrapolation can amplify noise. A nearly constant first difference may indicate almost linear drift rather than a trustworthy asymptotic geometric error.
For \(g(x)=0.95x+0.10\), ordinary iteration from zero gives \(0,0.10,0.195\); the fixed point is 2. The second difference is \(-0.005\) and the formula gives exactly 2. If the last reported value is rounded to 0.196, the denominator changes to \(-0.004\), giving an extrapolated 2.50. Substituting this candidate into the original residual \(g(x)-x\) gives \(-0.025\): it is a worse fixed point than 2 but still has a modest residual because the fixed point itself is weakly conditioned. Always evaluate the actual residual and estimate its relation to state error if a meaningful physical tolerance is required.
Choose affine weights that minimise residual history
For a vector fixed-point map \(g\), let \(f_i=g(x_i)-x_i\). Seek a combination of recent residuals with small norm while preserving a fixed point under averaging. Anderson mixing chooses coefficients \(\alpha_i\) minimising \(\|\sum_i\alpha_i f_i\|\) subject to \(\sum_i\alpha_i=1\), then evaluates a candidate \(x_{\rm new}=\sum_i\alpha_i g(x_i)\) in a basic undamped formulation. The affine constraint allows negative coefficients, which is precisely what makes acceleration beyond ordinary averaging possible. For one-dimensional affine maps the combination can eliminate a single mode exactly.
For two residual vectors write their affine combination as \(f_1+\beta(f_0-f_1)\). Its least-squares optimum is \(\beta=-f_1^T(f_0-f_1)/\|f_0-f_1\|^2\) if the denominator is nonzero. With several vectors a small QR or SVD solve in terms of differences is preferable to building normal equations when differences are nearly collinear. Choose component units or a weighted norm consistent with the physical equation. Otherwise a residual expressed in large numerical units can dominate the fit and accelerate one variable while neglecting another important constraint.
For a strictly affine map \(g(x)=Gx+c\),
The predicted residual at the affine combination of old states is exactly the linear combination. The candidate formed by applying \(g\) to it has residual \(G\sum\alpha_i f_i\). For nonlinear \(g\) neither equality need hold globally. An Anderson residual minimisation is a local extrapolation hypothesis, not a proof that the next nonlinear state decreases residual or stays feasible. Evaluating \(f(x_{\rm new})\), accepting a damped mixture when appropriate, and dropping near-dependent history are practical ways to test that hypothesis.
Background · What happens when two residual histories almost coincide?
Take two residuals from nearly consecutive states and minimise the norm of \(r_1+\alpha(r_2-r_1)\). Write \(d=r_2-r_1\). Differentiating the squared norm with respect to \(\alpha\) gives
The denominator vanishes for duplicate residuals. A tiny denominator can also demand enormous positive and negative weights that cancel in the modelled residual. For scalar residuals 1 and 0.999 those weights are about \(-999\) and \(1000\). Extrapolating the nonlinear states this far relies on local behaviour far outside the sampled interval. One practical response is to discard a nearly redundant column, then evaluate the true residual of the proposed state. A small residual of the affine model alone provides no acceptance test.
Separate fast and slow modes in a two-component relaxation
Use \(g(x,y)=(0.9x+0.1,0.2y+0.8)\), whose fixed point is \((1,1)\). Start at \((0,0)\), then \(x_1=(0.1,0.8)\). Residuals are \(f_0=(0.1,0.8)\) and \(f_1=(0.09,0.16)\); their difference is \((0.01,0.64)\). The two-history coefficient above is about \(-0.252\). The predicted residual of the affine state is approximately \((0.0875,-0.0010)\), largely eliminating the fast second component while leaving the slower first. Three appropriately independent histories can eliminate two geometrically distinct error directions for this affine example if their residual vectors affinely span zero in exact arithmetic. Near-equal decay factors can make that calculation badly conditioned. A finite memory window trades acceleration against conditioning, storage and the cost of residual evaluation.
Follow a two-mode residual through a real mixing step
Set the slow multiplier to 0.90 and the second to 0.20. The first two ordinary states coincide in both runs because the accelerated iteration has no history at the start. Thereafter the calculator solves the two-vector minimisation at each iteration, forms the proposed mixed state and evaluates its actual residual. The second component initially dominates the residual norm even though it is the more rapidly damped mode. Notice how the mixed and plain curves separate as the slow component becomes limiting. The plotted logarithmic residual measures convergence to the stated map; the physical state error in mode j is its residual divided by the magnitude of one minus that mode multiplier.
Move the two multipliers close together so the map becomes nearly a scalar relaxation, then choose a negative second multiplier so its errors alternate. Explain why affine mixing can nearly remove a single geometric mode, while nearly dependent histories make weights sensitive to evaluation noise. The implementation falls back to the ordinary map if the difference norm is already at the roundoff threshold. Very small residuals are marked at a finite plotting floor. Compare curves before that floor rather than fitting a convergence rate to the flat portion.
Tutorial · identify good and bad extrapolation data
Check an alternating scalar series
Three iterates are 1.50, 0.75 and 1.125. Infer the geometric multiplier and limit. How should the next value be checked?
Work through the solution
The differences are \(-0.75\) and \(+0.375\), so \(q=-0.5\). The Aitken prediction is
If the geometric assumption persists, the next raw iterate would be \(1-0.0625=0.9375\). Comparing both the new observed iterate and the actual residual at 1 tests the single-mode hypothesis. Three arbitrary numbers alone can always fit such a geometric extrapolation when the denominator is nonzero.
Show the connection to a secant root step
Use two scalar residuals \(f_i=g(x_i)-x_i\). Derive the affine combination of \(x_0,x_1\) whose predicted residual is zero and compare with a secant step for \(f=0\).
Work through the solution
Solve \(\alpha f_0+(1-\alpha)f_1=0\) to get
The mixed state is \(x_1-f_1(x_1-x_0)/(f_1-f_0)\), the ordinary secant prediction. The combination of \(g(x_i)\) is the same state because the weighted residual vanishes. For nearly equal residuals the denominator can be tiny, generating a large extrapolation. A bounded step or fallback to the base fixed-point map may be necessary if the candidate leaves the valid state domain.
Select a restart from nearly identical residual columns
Two stored vectors have residuals \((1,0)\) and \((1,10^{-9})\), measured with absolute component errors \(10^{-7}\). Can their difference support a reliable two-history fit?
Work through the solution
The direction being used for the second independent sample is smaller than the evaluation uncertainty by two orders of magnitude. Its orientation and length can be dominated by numerical error, so a large coefficient in a least-squares solve carries little physical information. Drop the redundant direction or use a rank-revealing solve scaled to the expected residual error. Evaluate any retained candidate on the original model. A tiny predicted mixed residual from cancelling inaccurate large coefficients has no independent evidential value.
Further reading
Nonlinear systems and iterative methods · 3. Finding another equilibrium after one root is known
Newton iteration repeatedly finds the same structural equilibrium. Derive how deflation changes its basins while preserving other solutions, use a rank-one Jacobian update, and distinguish a list of discovered equilibria from a completeness certificate.
Prevent a known simple zero from attracting another iteration
Suppose a differentiable \(F:\mathbb R^n\to\mathbb R^n\) has a known zero \(r\), with nonsingular Jacobian \(J(r)\). Near \(r\), \(F(r+h)=J(r)h+O(\|h\|^2)\), so its norm is bounded below by a positive constant times \(\|h\|\) in a sufficiently small neighbourhood. Multiplying by a nonvanishing scalar multiplier away from \(r\) preserves all other zeros. Taking \(M(x)=\|x-r\|^{-p}+\alpha\), \(\alpha>0\), yields deflated residual \(G(x)=M(x)F(x)\) on \(x\ne r\). Its norm behaves at least as a constant times \(\|x-r\|^{1-p}\) near the simple root. For \(p=1\) it need not have a directional limit but cannot approach zero there; for \(p>1\) it diverges. The scalar shift \(\alpha\) prevents the multiplier from vanishing at large distances.
If the root has multiplicity \(m\) in a scalar problem, \(|F|\) can vanish like distance to the power \(m\). An exponent \(p<m\) can leave the deflated norm tending to zero, invalidating the reasoning for simple roots. In systems with singular Jacobians different directions can have different leading powers or a whole manifold of solutions can pass through \(r\). One should identify symmetries and solve a properly constrained problem before treating every coordinate representation of a continuum of roots as a new equilibrium. Deflation changes a nonlinear solver's route; it does not make a singular physical problem isolated by decree.
Reuse a Newton correction with a rank-one change
Differentiate the scalar product to obtain
When \(J_F\) is invertible, let \(d=-J_F^{-1}F\) be the ordinary Newton correction. Look for a deflated step \(s=\beta d\). Applying \(J_G\) gives \(\beta[-MF+F(\nabla M)^Td]\). Equating this to \(-MF\) yields
This is a convenient exact relation for a scalar deflation multiplier away from a vanishing denominator. The Jacobian of the modified problem can become singular at points where the original Newton step is perfectly well-defined. A denominator near zero can create an enormous proposed state change. A line search or trust region should verify the candidate against the chosen objective and the physically admissible variables. Once a different candidate root is located, evaluate the original \(F\), its Jacobian conditioning and any invariant constraints independently.
See the change of basin in an analytical scalar model
Take \(F(x)=x(x-1)(x+2)\) with roots \(0,1,-2\), and let \(r=0\) have already been found. On the positive half-line choose \(M=1/x\) for a transparent algebraic comparison, giving \(G=(x-1)(x+2)\). This unshifted local example works on this domain; a global implementation often uses the positive shifted norm expression instead. From \(x=0.2\),
Original Newton gives approximately \(-0.0378\), entering the basin of the known zero. Deflated Newton has \(G=-1.76,\ G'=1.4\) and gives approximately \(1.4571\), entering a region directed toward the other positive root. Neither update used knowledge of the other roots to choose that direction.
For a polynomial with known exact factor, explicit algebraic division may be available. A numerical residual from a mechanics or fluid solver need not be a polynomial and generally offers no such division. Numerical deflation uses the known state and a norm to remove its attraction while continuing to evaluate the same physical governing equations. Use physical scaling in that norm. The distance between two states measured in metres and kelvins is arbitrary until component scales are chosen; an apparently huge separation in the deflation metric can represent tiny physical changes. If roots are known only approximately, multiplying a near-singular factor around a slightly wrong centre can leave the true nearby root or create severe numerical conditioning. Refine and verify each original root before including it in a list of deflation centres.
Change the Newton basin by dividing out a known root
Here the original residual is the cubic in the worked example. Its known zero at the origin is algebraically divided out, leaving a quadratic on the full line. This exact-factor experiment isolates the change in Newton geometry without introducing a singular numerical evaluation of an inverse distance. For both residuals, the calculator starts at the same chosen positive point and applies the same damping factor. At the default 0.20 the first ordinary step goes slightly negative and approaches zero; the deflated step passes one and converges back to it. The readout verifies the second candidate in the original cubic.
Try a smaller damping factor and compare the number of iterations needed before the two candidate sequences settle. Damping moderates each proposed correction but does not restore the removed root of the quadratic. A finite iteration count with heavy damping may end with a visible original residual; a current candidate is not an exact equilibrium merely because its curve has begun to flatten. This illustration relies on an exact polynomial factor, while deflation around a numerically inferred state requires an explicit centre tolerance and original-model verification.
Tutorial · separate discovery, verification and completeness
Work through a simple shifted multiplier
For \(F=x(x-1)\), \(x>0\), use \(M=1+1/x\) to deflate zero. Find the new residual, its value as \(x\to0^+\), and the deflated Newton step from \(x=0.5\).
Work through the solution
Here \(G=(x+1)(x-1)=x^2-1\), tending to \(-1\) at the excluded zero. From \(x=0.5\), \(G=-0.75,\ G'=1\), giving \(x_{\rm next}=1.25\). The original derivative \(2x-1\) vanishes exactly at the starting point even though the deflated derivative does not. The shortcut requiring \(J_F^{-1}\) is unavailable there; directly differentiating and solving for \(G\) remains valid. This example shows why a formula derived for nonsingular \(J_F\) should not become a universal implementation assumption.
Choose a multiplier for a double root
For \(F(x)=(x-1)^2(x+1)\) deflate \(r=1\) with \(M=|x-1|^{-p}+1\). Compare \(p=1\) and \(p=2\). What limits a near-root termination test?
Work through the solution
Near \(1\), \(|F|\sim2|x-1|^2\). With \(p=1\), \(|G|\sim2|x-1|\) still tends to zero; with \(p=2\), it tends to two. A test accepting just a small deflated residual can therefore return very close to the old double root when using the inappropriate exponent. A small original residual also occurs over a relatively wide neighbourhood of a multiple root. Report a root-separation test and independent bounds or refinement where multiplicity affects the required state tolerance.
Construct a genuine completeness argument in one dimension
Several initial guesses and deflations recover the three roots of \(x^3+x^2-2x\). What additional reasoning certifies that the list is complete, and what can be reported if only a black-box smooth system is available?
Work through the solution
The polynomial is nonzero of degree three, so it has at most three distinct complex roots. Substitution verifies three distinct real ones and proves completeness in this case. Multiple Newton solves by themselves would not establish that count. For a smooth black-box scalar problem over a compact interval one can partition it, enclose the function and its derivative, exclude root-free pieces and isolate all retained candidates when the bounds allow. In a higher-dimensional problem a list found by starts and deflation should be reported as verified discovered roots unless an independent argument covers the entire specified domain.
Further reading
Nonlinear systems and iterative methods · 4. Count enclosed zeros with a contour before locating them
A complex residual may have several nearby zeros whose Newton basins are hard to distinguish. Use the argument principle to count them, contour moments to estimate their locations and an independent perturbation test to certify a root cluster.
Turn winding of a residual into a root count
Let \(f\) be analytic inside and on a positively oriented simple closed contour \(\Gamma\), with no zeros on it. Suppose \(z_j\) is an enclosed zero of multiplicity \(m_j\). Locally \(f(z)=(z-z_j)^{m_j}g(z)\) with \(g(z_j)\ne0\), so \(f'/f=m_j/(z-z_j)+g'/g\). Cauchy's residue theorem gives
A meromorphic \(f\) instead gives number of zeros minus poles, counted with multiplicity. On the image curve \(f(\Gamma)\) the same integral equals its change of complex argument divided by \(2\pi\). This provides an alternative if only complex function evaluations are available. Both versions require that the contour avoid zeros and poles. Moving the contour through one changes its integer count discontinuously; a point extremely close to the boundary demands finer sampling or a different contour.
For a circle \(z=c+Re^{i\theta}\), periodic trapezoidal quadrature evaluates the integral as the mean of \((z-c)f'(z)/f(z)\). The smoothness and distance to nearby singularities govern convergence. Simply rounding the result to the nearest integer can disguise severe undersampling. Compare independent contour radii and doubled angular grids, inspect the minimum \(|f|\) on the boundary, and examine unwrapped phase increments. A grid with only endpoint samples of a rapidly rotating image can miss entire turns even when successive complex values look nearly identical. An upper bound on phase speed or adaptive interval enclosure is needed for a rigorous count from discrete samples.
Locate small groups after counting them
Multiply the integrand by \(z^k\). Its residues become \(m_j z_j^k\), giving power sums \(s_k=(2\pi i)^{-1}\oint z^k f'/f\,dz\). For exactly one simple enclosed root, \(s_1\) is its location. For two simple roots \(z_1,z_2\), obtain their sum \(s_1\), and their product \((s_1^2-s_2)/2\) from the identity \((z_1+z_2)^2=z_1^2+z_2^2+2z_1z_2\). Solve the resulting quadratic for initial guesses, then polish on the original residual and recheck the contour count. For large clusters reconstructing a high-degree polynomial from power sums can be ill-conditioned; recursively subdivide or use a contour method designed for stable extraction.
Take \(f(z)=(z-0.2)(z+0.4)(z-2)\) on the unit circle. Its count is two; its moments are
The reconstructed product is \((0.04-0.20)/2=-0.08\), giving \(z^2+0.2z-0.08=0\) and roots \(0.2,-0.4\). The exterior factor changes the residual values and Newton basins but contributes no interior pole of \(f'/f\), hence no moment. A contour enclosing all three instead changes the power sums. Severe cancellation can occur when several large root powers sum to a small number. Shift and scale coordinates about the contour centre before evaluating high-order moments.
Use a boundary inequality to protect a count under perturbation
If an analytically tractable \(g\) and target \(f=g+h\) satisfy \(|h(z)|<|g(z)|\) on \(\Gamma\), then the continuous homotopy \(g+th,\ 0\le t\le1\), has no boundary zero. Its winding number around zero cannot change continuously between distinct integers, so \(f\) and \(g\) enclose the same number of zeros. This is Rouché's theorem, useful when a perturbation is small on the boundary even if it strongly splits individual roots inside. The strict bound must cover the entire curve. Observations at a handful of sample points without a bound between them are numerical evidence, not a theorem.
For \(f(z)=(z-1)^2+\epsilon z,\ |\epsilon|=0.001\), use a circle of radius 0.1 about one. Its unperturbed modulus is 0.01 and the perturbation has magnitude at most 0.0011. Both zeros stay inside this circle. Their individual shifts can be of order \(\sqrt{|\epsilon|}\) because the reference zero is double. A small coefficient perturbation can therefore leave a reliably countable cluster while making its individual members comparatively sensitive. This distinction between a cluster as a whole and a single ill-conditioned root is important when a model residual depends on uncertain fitted coefficients.
Count one movable complex zero by discrete contour integration
The experiment integrates the logarithmic derivative of a polynomial with one zero strictly inside the unit circle. Its exact count is therefore one everywhere in the slider range. The real and imaginary parts of the quadrature estimate are plotted separately against the number of uniformly spaced angular samples. At radius 0.9 on the positive real axis, eight samples give about 1.756; rounding the real part would report two zeros. Moving the root farther from the contour makes convergence faster without changing the true count.
Rotate the root slightly while keeping its radius fixed. The absolute distance from the contour is unchanged, but its phase relative to the sampling nodes changes. A nonzero imaginary estimate and oscillatory errors may appear even though the exact winding number is real. The finite-grid formula for a root at complex a is one divided by one minus a raised to the number of samples. Use it to predict locations of large errors before reading the graph. An apparent agreement for one particular sample count can be accidental; compare successive refinements and the complex error.
Tutorial · audit a contour computation
Calculate the exact aliasing of a one-root count
For \(f(z)=z-a\) on the unit circle with \(|a|<1\), use \(M\) equally spaced points. Derive the trapezoidal estimate of \(N\) and evaluate it for real \(a=0.9,M=8\).
Work through the solution
At each point \(zf'/f=1/(1-a/z)=\sum_{k\ge0}a^kz^{-k}\). Averaging roots of unity cancels all terms except powers divisible by \(M\), giving \(N_M=1/(1-a^M)\). At \(M=8\) it is about 1.756, which would round to the wrong integer two. Increasing to \(M=64\) gives about 1.00118. This explicit example illustrates why apparent smoothness of the original analytic function does not ensure adequate sampling of its logarithmic derivative.
Recover a repeated root from moments
A contour yields \(N=2,s_1=1.2,s_2=0.72\) to high numerical accuracy. Infer the candidate roots and explain the sensitivity to a small error in \(s_2\).
Work through the solution
The product is \((1.44-0.72)/2=0.36\); the polynomial \(z^2-1.2z+0.36\) has double root 0.6. A change \(\delta\) in \(s_2\) changes the product by \(-\delta/2\), giving inferred splitting \(\pm\sqrt{\delta/2}\) relative to 0.6. Tiny moment noise can therefore mimic two distinct roots. Verify a multiplicity claim against derivative information on the original function and clarify whether distinct roots can actually be resolved.
Explain a zero net winding that hides a zero
A rational residual has a simple zero at 0.1 and a simple pole at -0.2 inside the unit circle. What would the count report and how could one recover the desired zero count?
Work through the solution
The logarithmic derivative has residues plus one and minus one, so net winding is zero even though a zero exists. If the pole and its order are known, add the pole count to the measured winding or multiply by a known denominator that removes it and then check the resulting analytic function. A near pole–zero cancellation can be difficult to resolve numerically. Treating a rational or discretely singular residual as a globally analytic polynomial would make the count's interpretation incorrect.
Further reading
Nonlinear systems and iterative methods · 5. Where does a complex Newton step take its starting point?
A single cubic has three equally simple roots. Derive the iteration, colour starting values by destination and use a separate convergence history to distinguish a bad first step from slow local convergence.
Continue the tangent step into the complex plane
A holomorphic function has a complex linear approximation \(f(z+s)\approx f(z)+f'(z)s\). Requiring this approximation to vanish gives \(s=-f(z)/f'(z)\) wherever the derivative is nonzero. For \(f(z)=z^3-1\), the resulting map is
The second term is a pole at zero. Starting at a small positive number sends the next iterate far to the right, after which large iterates return approximately by multiplication by 2/3. At a root \(r\), write \(z=r+e\) and substitute \(r^3=1\). Exact cancellation of the linear error gives
Sufficiently near \(r\), the new error is about \(e^2/r\). This argument predicts the speed after entry into a local neighbourhood. It has no information about which root a distant initial point will reach.
Let \(s=\exp(2\pi i/3)\). Since \(s^3=1\), symmetry gives
The entire sequence, including its root, rotates with the start. Conjugate starting points likewise produce conjugate histories because the coefficients are real. These are two independent checks for numerical basin maps. We classify a pixel only once its residual falls below a declared tolerance. A starting pole and a trajectory that exhausts its iteration allowance can both appear unclassified. Increasing the allowance separates these cases for many pixels.
Follow a detour before quadratic convergence
From \(z_0=1/2\) the first iterate is \(1/3+4/3=5/3\). The next is \(10/9+3/25=277/225\approx1.23111\). The error initially rises from 0.5 to 0.667. By contrast, starting at 0.1 gives \(z_1=33.4\). The subsequent near-geometric return explains the long shoulder in the second figure. Both starts ultimately approach the real root.
Move the orange sample by writing a complex number such as \(-0.5+0.85i\) in Python as -0.5+0.85j. The sample mark and the residual trace follow the same new starting point. The intricate boundaries in the image are computed from independent point trajectories. Refining the grid examines finer samples of those boundaries; the speed on the residual graph belongs to one particular start.
Open full-size diagram
Open full-size diagramExercise · obtain two basin colours for free
Suppose \(0.75+0.10i\) reaches the real root in five updates. What are the destinations and update counts after multiplying the start by either non-real cube root of one?
Work through the solution
Write the original iterates as \(z_k\). By induction \(N^k(sz_0)=sz_k\) and \(N^k(s^2z_0)=s^2z_k\). The destinations are \(s\) and \(s^2\). Since \((sz_k)^3-1=z_k^3-1\), every residual and hence the first crossing of the same threshold is unchanged. Differences in a finely sampled plot may arise because the rotated point falls between pixels.
Exercise · quantify the final two digits
For a real iterate \(z=1.01\), estimate the next error by the quadratic approximation and calculate its exact value using the error formula.
Work through the solution
The leading term gives \(0.01^2=10^{-4}\). The exact error is \(10^{-4}(3.02)/(3\times1.01^2)\approx9.8683\times10^{-5}\). The difference is of the next order in the initial error. The small residual after this update is about three times the error because \(f'(1)=3\).
Change parameters · Explore this notebook model
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Nonlinear systems and iterative methods · 6. Certifying a Newton step before the root is known
A small correction is meaningful only together with a curvature estimate. Construct a ball that contains a solution and use a frozen linear solve to make damping decisions independent of equation units.
Bound all future corrections from initial data
Let \(F\) be differentiable on a convex neighbourhood, \(J_0=F'(x_0)\) invertible, and fix an induced norm. Suppose \(\|J_0^{-1}F(x_0)\|\le b\) and \(\|J_0^{-1}(F'(x)-F'(y))\|\le L\|x-y\|\). These estimates must hold on the entire proposed ball. Define the scalar majorant \(g(t)=b-t+Lt^2/2\). If \(2Lb<1\), its smaller zero is \(r=2b/(1+\sqrt{1-2Lb})\). Require the closed ball of that radius to lie in the domain.
Set \(t_0=0\) and apply scalar Newton to \(g\). Since \(g\) is decreasing and convex on \([0,r]\), the iterates increase to \(r\). At a point no farther than \(t\) from \(x_0\), the Neumann series for \(J_0^{-1}F'(x)=I+E\), \(\|E\|\le Lt<1\), bounds \(\|F'(x)^{-1}J_0\|\le 1/(1-Lt)\). If \(s\) is an exact Newton correction, the constant and linear terms cancel. Integrating the Jacobian variation along that step gives
At the scalar Newton points exactly the same formula holds with equality for \(g(t_{j+1})=L(t_{j+1}-t_j)^2/2\). Induction now gives \(\|x_{j+1}-x_j\|\le t_{j+1}-t_j\). The vector sequence is Cauchy and stays in the ball, its limit is a root and \(\|x_*-x_j\|\le r-t_j\). Two roots in that ball would be joined by an averaged Jacobian differing from the identity, after scaling, by at most \(Lr<1\). It is invertible, so the roots coincide.
Use the linearised correction as the measuring stick
Premultiply the equations by any fixed nonsingular matrix \(S\). The Newton correction and the majorant data stay the same since \((SJ_0)^{-1}S=J_0^{-1}\). The Euclidean norm of the raw residual generally changes. For a trial factor \(\lambda\), form \(s=-J^{-1}F(x)\) and \(\bar s=-J^{-1}F(x+\lambda s)\) with the same factorisation. Linear prediction gives \(\bar s=(1-\lambda)s+e\), where local curvature bounded in the current scaled norm implies \(\|e\|\le L_x\lambda^2\|s\|^2/2\). Backtrack until \(\|e\|\le \lambda\|s\|/2\). Then \(\|\bar s\|\le(1-\lambda/2)\|s\|\). For smooth regular points sufficiently small steps pass. Rebuild the Jacobian after acceptance. Global convergence requires additional bounds keeping iterates within a regular level set.
For \(F=(x_1^2-2,x_2^2-1)\) start at \((1.5,0.9)\) in the maximum norm. Here \(b=0.19/1.8\) and \(L=\max(1/1.5,1/0.9)\). Both follow directly from the diagonal Jacobian. With \(2Lb<1\) the positive quadrant contains the certified ball.
OneSimulation experiment · Test the radius after a change of units
Replace a starting coordinate by a smaller positive value. Recheck the certificate before iterating.
Download the executable notebook · Python source
Adjust the experiment in the browser. Change the two starting coordinates for \(F=(x_1^2-2,x_2^2-1)\). The plot recomputes the iterates, the maximum-norm correction \(\beta\), the preconditioned derivative bound \(L=\max(1/x_{1,0},1/x_{2,0})\), and the guaranteed radius whenever \(\beta L\le1/2\). Move beyond the certified region and observe that failure of this sufficient test does not establish divergence. Rescale the first equation by up to six orders of magnitude: its Jacobian must receive the same scale. The browser uses the explicit diagonal solve; the notebook performs the corresponding OneSimulation dense solve.
"""Test a Newton certificate without knowing the solution in advance."""
import matplotlib.pyplot as plt
import numpy as np
from onesim.numerics.linear.matrices.dense_linear_algebra import solve_dense
start = np.array([1.5, 0.9])
target = np.array([2.0, 1.0])
beta = np.linalg.norm((start**2 - target) / (2 * start), np.inf)
lipschitz = max(1 / start)
radius = 2 * beta / (1 + np.sqrt(1 - 2 * beta * lipschitz))
print(f"beta={beta:.6f}, L={lipschitz:.6f}, certified radius={radius:.6f}")
fig, ax = plt.subplots(figsize=(7, 4), layout="constrained")
for label, scale in [("Original equations", [1., 1.]), ("Rescaled equations", [1e4, 0.01])]:
x = start.copy()
distances = [0.0]
for _ in range(5):
residual = np.asarray(scale) * (x*x - target)
jacobian = np.diag(2 * np.asarray(scale) * x)
x -= solve_dense(jacobian, residual)
distances.append(np.linalg.norm(x-start, np.inf))
assert max(distances) <= radius and np.allclose(x**2, target)
ax.plot(distances, "o-" if scale[0] == 1 else "x--", label=label)
ax.axhline(radius, color="black", ls=":", label="Guaranteed radius")
ax.set(xlabel="Newton iteration", ylabel="Distance from initial point (maximum norm)")
ax.legend()
fig.savefig("numerics-certified-newton.png", dpi=170)
Output from the reference run
beta=0.105556, L=1.111111, certified radius=0.112599

Tutorial on certification and damping
Compute the first majorant step and use it as a bound
Work through the solution
Scalar Newton at zero gives \(t_1=b\). The vector correction has size \(b\). After that move the distance to the root is at most \(r-b\), which can be evaluated without substituting a known root.
Change the starting point to a nearly singular configuration
Work through the solution
For \((1.5,0.1)\), the second correction is \(0.99/0.2=4.95\) and \(L=10\). The majorant gives no conclusion. For that coordinate a full step reaches \(5.05\), whereas halving the step decreases its size. The failure of the sufficient inequality leaves open whether an actual iteration converges.
Nonlinear systems and iterative methods · 7. Which correction does an experiment identify?
Separate parameter combinations visible in a nonlinear fit, pass a regular fold by continuation and decide when to refine a boundary-value mesh before trusting its Newton residual.
Solve only for directions constrained by data
Given covariance \(C>0\), whiten the residual \(r=C^{-1/2}(f(x)-d)\) and its Jacobian \(J\). Gauss–Newton minimises \(\|r+Js\|^2/2\). Write \(J=U\Sigma V^T\). Components orthogonal to its range cannot be changed to first order. Each reliably measured direction obeys \(v_i^Ts=-u_i^Tr/\sigma_i\). A direction in the nullspace is free. Setting its correction to zero selects the minimum Euclidean norm in the chosen parameter units.
If the forward derivative carries error \(e_J\), singular values below \(\|e_J\|\) cannot be distinguished reliably from zero. Also compare predicted changes to measurement noise over physically allowed parameter displacements. Damping with a penalty gives factors \(\sigma_i/(\sigma_i^2+\lambda^2)\) and is continuous in the singular values. A penalty adds assumptions about scales.
Take two equal-noise readings whose model rows depend only on \(a+b\), with sensitivities \((1,1),(2,2)\). At \(a=b=0\) readings \((3,6)\) demand \(a+b=3\). Minimum norm assigns \(a=b=1.5\). Changing parameter units can change that individual assignment while retaining the identifiable sum. A new observation of \(a-b\) adds an independent singular direction.
Exchange a failing parameter for a curve coordinate
Let \(F(u,p)=0\) be \(n\) equations in \(n+1\) unknowns and suppose \([F_u,F_p]\) has row rank \(n\). Its nullspace supplies a unit tangent \(t\) oriented with the preceding tangent. Predict \(z_p=z_k+h t\). The corrector solves \(F(z)=0,\ t^T(z-z_p)=0\). At \(z_k\) the augmented derivative is invertible since its nullspace would lie both along \(t\) and perpendicular to it. This remains true locally for sufficiently small prediction steps, including a simple fold with singular \(F_u\).
For a boundary-value application consider \(u''+\lambda e^u=0,\ u(0)=u(1)=0\). A centred grid gives \(F_i=(u_{i-1}-2u_i+u_{i+1})/\Delta x^2+\lambda e^{u_i}\). The augmented rows have tridiagonal state derivative with diagonal \(-2/\Delta x^2+\lambda e^{u_i}\) and parameter column \(e^{u_i}\). Use grid-weighted state inner products for tangents so refinement does not change the meaning of arclength. Halve \(h\) and repeat the prediction if corrector displacements are too large relative to \(h\). If halving reduces the displacement by about four, the quadratic predictor defect is a geometrical effect.
How can a perfectly converged branch still predict a wrong maximum load?
Newton controls the residual of the chosen grid only. Correct the same branch point on a grid of half the spacing, matching arclength or a monotonic observed amplitude rather than load at the fold. In the regular second-order regime divide the fine–coarse output difference by three to estimate the fine-grid error. Refine the grid when this exceeds the output tolerance. Tighten the augmented linear and nonlinear solves enough that their estimated effect on that output is smaller.

Tutorial on a fold with an exact reference
Find a mesh-independent check for the boundary-value branch
Work through the solution
Set \(u(x)=2\log[\cosh(a/2)/\cosh(a(x-1/2))]\). Then \(u''=-2a^2\operatorname{sech}^2(a(x-1/2))\) and \(e^u=\cosh^2(a/2)\operatorname{sech}^2(a(x-1/2))\). Hence \(\lambda=2a^2/\cosh^2(a/2)\) and the end values vanish. This parametric curve can test either side of the turning point.
Locate the fold and choose a comparison observable
Work through the solution
Differentiating \(\log\lambda\) gives \(2/a-\tanh(a/2)\). Solve \(a\tanh(a/2)=2\), yielding \(a\) near 2.40 and \(\lambda\) near 3.51. The midpoint temperature \(2\log\cosh(a/2)\) is strictly increasing for positive \(a\), making it a well-defined matching observable across meshes.
Deuflhard · Gauss–Newton and continuation
Change parameters · Which correction does an experiment identify?
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Open this calculation with adjustable inputs
Download the executed OneSimulation notebook · Python source
The notebook reproduces the reference case and exposes the mesh or geometry parameters. Its saved output below comes from the actual OneSimulation solver.
"""Follow both Bratu branches using OneSimulation augmented Newton solves."""
import argparse
import matplotlib.pyplot as plt
import numpy as np
from onesim.numerics.linear.matrices.dense_linear_algebra import solve_dense
def branch(parameter=2.4, intervals=16):
if parameter <= 0 or intervals < 4 or intervals % 2:
raise ValueError("Use a positive branch parameter and an even interval count >= 4")
x = np.linspace(0, 1, intervals+1)
exact = 2*np.log(np.cosh(parameter/2)/np.cosh(parameter*(x-.5)))
reference = 2*parameter**2/np.cosh(parameter/2)**2
state, load = exact[1:-1].copy(), reference
h = 1/intervals
for iteration in range(15):
full = np.r_[0., state, 0.]
residual = np.r_[(full[:-2]-2*state+full[2:])/h**2 + load*np.exp(state),
state[intervals//2-1]-exact[intervals//2]]
if np.linalg.norm(residual) < 1e-10:
break
jacobian = np.zeros((intervals, intervals))
jacobian[:-1, :-1] = (np.diag(-2/h**2 + load*np.exp(state))
+ np.diag(np.ones(intervals-2)/h**2, 1)
+ np.diag(np.ones(intervals-2)/h**2, -1))
jacobian[:-1, -1] = np.exp(state)
jacobian[-1, intervals//2-1] = 1
correction = solve_dense(jacobian, -residual)
state += correction[:-1]
load += correction[-1]
assert np.linalg.norm(residual) < 1e-8
return x, np.r_[0., state, 0.], load, reference, np.linalg.norm(residual)
def experiment(parameter=2.4, intervals=16):
x, state, load, reference, residual = branch(parameter, intervals)
print(f"Analytical load: {reference:.9f}; discrete load: {load:.9f}")
print(f"Augmented Newton residual: {residual:.3e}")
refined = branch(parameter, 2*intervals)
assert abs(refined[2]-reference) < abs(load-reference)
print(f"Load error after doubling the mesh: {abs(refined[2]-reference):.3e}")
fig = plt.figure(figsize=(10, 4.6), layout="constrained")
view = fig.add_subplot(121, projection="3d")
xx, aa = np.meshgrid(np.linspace(0, 1, 45), np.linspace(.3, 5, 45))
lam = 2*aa**2/np.cosh(aa/2)**2
field = 2*np.log(np.cosh(aa/2)/np.cosh(aa*(xx-.5)))
view.plot_surface(xx, lam, field, color="#9dc6b9", alpha=.7, linewidth=0)
view.plot(x, np.full_like(x, load), state, color="#ad491d", lw=2.5)
view.set(xlabel="x", ylabel="Load lambda", zlabel="Temperature u", title="Folded family of 1D solutions")
ax = fig.add_subplot(122)
ax.plot(x, 2*np.log(np.cosh(parameter/2)/np.cosh(parameter*(x-.5))), label="Analytical same-midpoint profile")
ax.plot(x, state, "o--", ms=3, label="Augmented OneSimulation solve")
ax.set(xlabel="x", ylabel="Temperature u")
ax.legend(fontsize=8)
fig.savefig("complete-numerics-bratu.png", dpi=170)
return load, residual
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--parameter", type=float, default=2.4)
parser.add_argument("--intervals", type=int, default=16)
args, _ = parser.parse_known_args()
experiment(args.parameter, args.intervals)
plt.show()
Analytical load: 3.513830356; discrete load: 3.506676842 Augmented Newton residual: 5.459e-13 Load error after doubling the mesh: 1.786e-03

Equilibria, branches and stability
Turn a physical stationarity condition into a nonlinear equation. Trace the solutions through loss of stability and decide which roots survive a perturbation.
- Bifurcation of a rotating hoop
- Why two coexisting phases share a tangent
- Mean-field ordering, response and the critical point
- When does a polar crystal change its preferred state?
- When a suspended capacitor loses its stable equilibrium
- Finite-size criticality and the evidence for a phase transition
- Phase nucleation, metastability and waiting-time statistics
Nonlinear inference and implicit equations
Investigate what a residual and a local derivative measure in inverse fitting, discretised boundary equations and an implicitly advanced stiff mode.
- Nonlinear fitting and local models
- Predictions, parameter profiles and nonlinear uncertainty
- When a single uncertainty interval hides two explanations
- Absolute stability and stiffness
- Shooting for two-point boundary values
- Differential–algebraic equations and consistency
- Why a boundary value problem can be easier than its shooting equation
- Anisotropic and nonlinear dielectrics from local measurements to global fields
- From mobile ions to screening lengths and differential double-layer capacitance
- Measure inertia and gravity with two suspension axes
Applied study
Bracket a root and decide when a Newton step is reliable.
Why solve an equation inside a time step?
A thermal mass cools by radiation. Its temperature obeys \(\dot T=-\beta(T^4-T_a^4)\). For \(T>T_a\) the cooling rate decreases as the body cools. Backward Euler samples this rate at the end of the step. Calling the unknown end temperature \(x\), write the discrete energy balance as a root problem
Assume a positive time step \(h\), coefficient \(\beta>0\), and \(T_n>T_a>0\). The physical interval is \([T_a,T_n]\). Since \(F(T_a)=T_a-T_n<0\), \(F(T_n)>0\), and \(F\) is continuous, a root exists. Its derivative \(1+4h\beta x^3\) is positive throughout this interval, so the root is unique. These facts suggest an algorithm even before choosing a starting guess.
Trade guaranteed progress for local speed
Bisection evaluates \(F\) at the midpoint and keeps the half containing a sign change. Each iteration halves the interval width. The midpoint error is at most half the remaining width, even when derivatives are unavailable.
Newton’s method draws the tangent at \(x_j\), \(F(x_j)+F'(x_j)(x-x_j)\), and takes its zero \(x_{j+1}=x_j-F(x_j)/F'(x_j)\). Near a simple root \(r\), Taylor expansion about \(x_j\) gives
If the derivative stays away from zero and the second derivative is bounded, this explains local quadratic convergence. Farther from the root, a practical safeguard is to replace a tangent step that leaves the bracket with bisection.
Residual and temperature error have a particularly simple relation here. For an approximation \(x\) in the physical bracket, the mean value theorem gives
An absolute residual of \(10^{-6}\) K certifies a root error no greater than \(10^{-6}\) K for this scaled equation.
Follow two tangent steps
Set \(T_n=2\) K, \(T_a=1\) K, \(h=1\) s and \(\beta=0.0015\) K⁻³s⁻¹. This deliberately scaled thermal example keeps the arithmetic visible. Starting at \(x_0=2\), the residual is \(0.0015(16-1)=0.0225\) K and the slope is
The first update gives \(x_1=1.97853053\) K and \(F(x_1)\simeq1.65\times10^{-5}\) K.
Re-evaluating the slope at \(x_1\) gives \(x_2=1.97851479\) K, with residual about \(8.7\times10^{-12}\) K before rounding the iterate for display. This is the root for one backward Euler step. It still differs from the continuous-time temperature at one second because the rate varied during that second.
Problem class
Budget the bisections
Start from \([1,2]\) K. After how many bracket halvings is the midpoint guaranteed to be within \(10^{-5}\) K of the root without evaluating a derivative?
Show the calculation
After \(n\) halvings, the width is \(2^{-n}\) K. Midpoint error is bounded by \(2^{-(n+1)}\) K. Thus
Fifteen halvings still allow an error greater than the target.
Test a fixed-point iteration
Consider \(g(x)=2-h\beta(x^4-1)\). For \(h=1\) s and \(h=25\) s, does the maximum slope magnitude on \([1,2]\) certify contraction? What can a failed bound tell you?
Show the calculation
The maximum \(|g'|\) is \(4h\beta\,2^3=0.048h\) with \(h\) in seconds. Both maps take the bracket into itself: at one second the image is \([1.9775,2]\), at 25 seconds it is \([1.4375,2]\). At one second the maximum slope is 0.048, which certifies convergence from anywhere in the bracket. At 25 seconds the maximum is 1.2. The global contraction test is then inconclusive. Local convergence depends on the slope near the root.
OneSimulation laboratory
Locate the root of an implicit cooling step
Compare recorded OneSimulation runs on this page. To test your own inputs, download the Python model and run the model in an activated OneSimulation environment.
The downloadable model takes one backward Euler step with \(C=2\) J/K, \(A=0.3\) m², emissivity 0.5 and a test radiation constant of 0.02 W/(m²·K⁴), giving \(\beta=0.0015\) K⁻³s⁻¹. Its output substitutes the returned temperature into the residual independently. Predict which edit changes the root. Download the Python experiment · OneSimulation implicit cooling comparison.
python nonlinear-equations.py
python nonlinear-equations.py --step 0.05
python nonlinear-equations.py --solver damped
| Step, solver | Temperature (K) | |F| (K) |
|---|---|---|
| 1 s, Newton | 1.9785147906 | 5.6 × 10⁻¹⁷ |
| 0.05 s, Newton | 1.9988776913 | 3.7 × 10⁻¹⁷ |
| 1 s, damped Newton | 1.9785147906 | 5.6 × 10⁻¹⁷ |

A different step changes both the equation and the observation time. A converged line-search Newton method on the original step recovers the same physical root. To measure time discretisation error, compare solutions on successively finer grids at a common final time.
Change parameters · Change the laboratory inputs
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Problem sheet 2 · Distinguish root accuracy from temperature sensitivity
Notation and assumptions
Read each defining equation with its assumptions and units, then follow the link to the argument that gives the equation its meaning.
Backward error
Specify how perturbations in data or equations are measured. A tiny perturbation making the computed value exact can coexist with a large solution error near a fold.
Derivation · Finding a turning point without using the load as a coordinate
Bracket
Continuity is needed to infer a zero between endpoints. A root of even multiplicity may exist without a sign change.
Complementarity
Both quantities are nonnegative and at least one vanishes. Active-set changes can make a smooth Newton model inappropriate across the switch.
Contraction
The map must also keep the chosen complete region invariant to obtain the standard fixed-point guarantee.
Newton correction
The correction solves a local linear model. Quadratic local convergence needs a suitable nonsingular derivative and a sufficiently close starting point.
Trust radius
The local model is minimised on this region. Agreement between predicted and achieved reduction guides the next radius.
Derivation · Deciding how far to trust a linearised residual
Further reading
Chapter 4 develops scalar and vector rootfinding. Compare Newton and secant iterates at a simple root, then repeat at a multiple root to expose the change in convergence order. Driscoll and Braun · Fundamentals of Numerical Computation



