When the problem arrives again

The accuracy that is thrown away

A Newton step is the exact answer to a linearised problem, and the linearisation is wrong at second order. So there is a floor under how close the step can land, the floor is the square of where it started, and eleven decades of inner tolerance below it buy the same four digits at four times the price.

Worth reading first: The problem that arrives again · The rate the condition number predicts.

Newton’s method for F(x) = 0 does one thing per step: it replaces F by its tangent at the current point and solves the linear problem exactly. Everything anybody knows about the method — that it doubles the correct digits, that it needs a good starting point, that it converges quadratically near a simple root — is a statement about that replacement rather than about the linear solve.

At the sizes where any of this is expensive, the linear solve is iterative and it stops when a tolerance says so. So there is a number to choose, it is called the forcing term, and the natural instinct is that it should be small: the step is what the method is made of, and a step computed badly is a bad step.

The instinct is wrong, and it is wrong by a factor that can be measured rather than argued about.

The plateau

The measurement is direct and needs no theory to state. Take an iterate 3.719·10⁻² from the root of the model problem — a root that is known exactly, because the right-hand side was built from it. Solve the Newton system at that point to a relative residual of 10⁻³, and the point it steps to is 2.4966·10⁻³ from the root, at 354 conjugate gradient iterations. Solve the same system to 10⁻¹⁴, and the point it steps to is 2.4967·10⁻³ from the root, at 1,126.

Eleven decades of inner accuracy. Four parts in ten thousand of difference in the answer. A factor of 3.2 in work.

That is the whole essay and the rest of it is about why the floor is where it is, how far the effect extends, and what it costs to ignore.

A single Newton step solved to eleven inner tolerances, against how far the resulting point is from the rootThe iterate is 0.0025 from a root that is known exactly by construction. The same linear system is solved to relative residuals from 0.3 down to 10⁻¹⁴, at 109 and 1129 conjugate gradient iterations, and the resulting point is 2.837·10⁻⁴ and 1.2·10⁻⁵ from the root. The curve is flat below about 10⁻³: the linearisation is wrong at second order, so the step cannot land closer than the square of the distance it started at — 6.234·10⁻⁶ — however exactly it is computed.10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³110⁻⁶10⁻⁵10⁻⁴10⁻³10⁻²inner tolerance η, relative residual of the linear solvedistance from the root after the stepd² = 6.23·10⁻⁶distance before the step, 0.00251093397131129the number by each point is the iterations it costeleven decades, one landing placedistance before the step0.0025its square6.2·10⁻⁶where η = 10⁻³ lands1.2·10⁻⁵where η = 10⁻¹⁴ lands1.2·10⁻⁵iterations for the first339iterations for the second1129the accuracy that is thrown awaymeasured against a root that is known
Fig. 1 And one step later, where the iterate is 2.497·10⁻³ out. The plateau is at 1.1999·10⁻⁵ and the tolerance at which it begins has not moved.

Why there is a floor at all

A Newton step solves J(x)·s = −F(x), and s is the exact correction for the linearised problem. The real problem is not linear. Expanding F about x,

F(x + s) = F(x) + J(x)s + ½·F″(ξ)[s, s]

and the step is chosen to kill the first two terms exactly, so what is left is the second-order term — of size proportional to ‖s‖², which near the root is proportional to the distance from it, squared.

The step therefore cannot land closer than a constant times d², where d is where it started, however exactly the linear system is solved. Below that, the accuracy of the linear solve is being spent on a difference between two points that are both the wrong point by the same amount.

That is a derivation, and this collection’s habit is to measure the thing rather than take the derivation’s word for it. Five iterates, five plateaus:

distance in its square where the plateau sits
1.027 1.055 5.0714·10⁻¹
5.071·10⁻¹ 2.572·10⁻¹ 1.7869·10⁻¹
1.787·10⁻¹ 3.193·10⁻² 3.7187·10⁻²
3.719·10⁻² 1.383·10⁻³ 2.4967·10⁻³
2.497·10⁻³ 6.234·10⁻⁶ 1.1999·10⁻⁵

Fitted on log axes, the plateau’s height against the distance it started at has a slope of 1.82, against a predicted 2. Not 1, which is what a floor set by the linear solve’s own error would give, and not 0, which is what a floor set by the arithmetic would give. The constant is between 0.5 and 1.9 across the five, which is order one — so the floor is the linearisation and it is not an artefact of the conditioning, which runs to 10⁵ on this problem and does not appear — a conditioning that decides less than it is credited with, which is a recurring finding here.

Newton on the Bratu problem: analytic Jacobian, differenced Jacobian at ε = 10^-6, and matrix-freeThree residual sequences, all starting from zero. The analytic Jacobian gives 8, 0.052, 3·10⁻⁶, 5.2·10⁻¹³; a Jacobian differenced at ε = 10^-6, whose entries are correct to about 1.3·10⁻¹⁰, gives 8, 0.052, 3·10⁻⁶, 4.6·10⁻¹³. They stop at the same residual. The matrix-free run, where GMRES sees only a closure and no entry exists anywhere, lands 8.1·10⁻¹⁶ from the analytic answer in 438 products.0123456710⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²1Newton step‖F(x)‖analytic Jdifferenced Jmatrix-freeone fixed point, three derivativesanalytic floor4.2·10⁻¹³differenced floor3.9·10⁻¹³matrix-free floor3.8·10⁻¹³products used, matrix-free438the derivative chooses the stepand the residual decides the answer
Fig. 2 A Newton residual history from the essay on operators with no entries, where two very different derivatives produce the same sequence — the same phenomenon seen through the Jacobian rather than through the solve.

The 1.82 is the fit, not the law

A slope of 1.82 against a predicted 2 is close enough to report and far enough off to be worth explaining, and the explanation is in the same five rows rather than in anything further.

Take the constant rather than the exponent — the plateau divided by the square of the distance it started at — and it is not constant. It runs 0.481, 0.695, 1.165, 1.805, 1.925, rising monotonically and flattening at the end. A quantity with a drifting constant fitted as a pure power law returns an exponent that has absorbed the drift, which is exactly what 1.82 is.

The local slopes say the same thing and say it more usefully. Between the first pair of iterates the slope is 1.478, between the second 1.505, between the third 1.721, and between the last pair 1.976. The exponent is converging to 2 as the iteration approaches the root, which is what “the second-order term dominates near a simple root” means when it is written as a measurement rather than as a theorem.

So the far rows are not noise and they are not a failure of the model — they are the pre-asymptotic regime, where an iterate 1.03 away from the root is not close enough for the third-order term to be negligible against the second. The fit spans both regimes because five points is what was affordable, and reporting one number over both is what pulls it to 1.82.

That is worth carrying beyond this figure. A fitted exponent over a range that includes the approach to an asymptote is biased towards the pre-asymptotic value, always, and the diagnosis is always the same: plot the constant the fit assumed was constant, or take the slope pairwise. Both cost nothing once the data exist, and either would have said that the law here is 2 and the last decade of the measurement already knows it.

It also sharpens the claim the section makes. The alternatives it rules out are slope 1, which is what a floor set by the linear solve’s own error would give, and slope 0, which is what a floor set by the arithmetic would give. The measured sequence 1.478 → 1.976 is not near either of them anywhere, and it is approaching the third. A single 1.82 would leave a reader entitled to wonder whether the truth might be 1.5 and drifting; the pairwise slopes say it is 2 and arriving.

And the constant is what the rule needs

The constant matters as well as the exponent, because the practical statement of this essay is a tolerance and a tolerance is a number rather than a scaling law.

At the last two iterates the constant is 1.81 and 1.92, so the plateau is very nearly 2d² — the step from distance d lands about twice d² from the root, whatever the inner solve does. That converts directly into the usable inner tolerance. The inner solve’s own contribution to the step’s error is about η·d, so it stops mattering when η·d falls below 2d², which is when η falls below about 2d.

At the iterate 3.719·10⁻² from the root that is η ≈ 0.07, and the table shows tolerances from 10⁻³ downwards all landing on the plateau — 10⁻³ is already more than an order below the threshold, which is why every row of it agrees. At the last iterate, 2.497·10⁻³ from the root, the threshold is η ≈ 5·10⁻³, and a tolerance of 10⁻² sits just above it and does land 22 per cent short.

Both of those are the same rule, and the rule needs no derivative and no norm: the usable tolerance is a small multiple of the distance to the root, and the distance to the root is what the ratio of consecutive residuals estimates. That is the quantity the next essay’s rule reads, and this section is the arithmetic that says what the multiple should be.

How much it costs to ignore

One step is not a solve. The forcing term is chosen once and applies to every step, so the interesting quantity is the total inner work for a complete run to a stated outer tolerance.

Total inner iterations for a whole inexact Newton solve, against the constant forcing termEvery point is a complete solve of the same problem to the same outer tolerance of 10^-10. At η = 10⁻¹⁴ it takes 9358 conjugate gradient iterations across 9 Newton steps; at η = 0.1 it takes 980 across 10. The left arm is oversolving and the right arm is too many outer steps. The open circle is the adaptive rule, which is not a constant: it costs 1009 iterations and reaches 3.37·10⁻¹¹.10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³110²10³10⁴10⁵constant forcing term ηtotal inner iterationsthe adaptive ruleoversolvingstarving the outer loopone problem, twelve budgetsη = 10⁻¹⁴, inner iterations9358cheapest constant0.1its inner iterations980adaptive rule, iterations1009adaptive final residual3.4·10⁻¹¹outer tolerance asked for10⁻¹⁰a tolerance is a cost decisionand its optimum is not machine precision
Fig. 3 Total conjugate gradient iterations for a whole Newton solve to a relative residual of 10⁻¹⁰, against the constant forcing term chosen for it. Both arms are real and the bottom is nowhere near machine precision.

The curve is a U and both of its arms are worth naming.

The left arm is oversolving. At η = 10⁻¹⁴ the run takes 9 Newton steps and 9,358 inner iterations. At η = 10⁻⁶ it takes the same 9 Newton steps and 4,382. The outer iteration is doing exactly the same thing — the same number of steps, landing in the same places to within the plateau — and one of the two runs is paying twice as much for it.

The right arm is starving the outer loop. At η = 0.5 each step is nearly free, but the steps stop being Newton steps: the quadratic convergence goes, the run takes 30 outer steps instead of 9, and the total climbs back to 1,178.

The bottom is at η ≈ 0.1, at 980 iterations, which is a factor of 9.5 below the fully solved run. Nine and a half times the work, for a final answer whose residual is below the same tolerance.

The one thing the tight run does buy

An honest accounting has to say what the extra work is not wasted on, and there is one thing.

The run at η = 10⁻¹⁴ ends with a forward error of 2.79·10⁻¹⁰. The run at η = 0.1 ends with 2.43·10⁻⁸ — eighty-five times worse. Both satisfy the stopping test, which asks for a relative residual below 10⁻¹⁰, and neither is more correct than the other by that test.

The reason for the difference is not that the loose run was less careful. It is that a quadratically converging iteration overshoots its stopping test: the tight run’s last step lands at a residual of about 10⁻¹⁶, five orders of magnitude below what was asked for, because the step before it was at 10⁻⁸ and the next one squares that. All of that accuracy is free in the sense that it was not asked for, and it is expensive in the sense that the last inner solve is the most expensive one in the run.

So the tight constant is not buying nothing. It is buying digits nobody requested, at the highest price the run has to offer, on every step rather than on the last one.

That observation is what the essay on a rule that reads its own residual is about, and the shape of the answer is already visible here: what is wanted is a loose tolerance early and a tight one at the end, which no constant can be.

Where the plateau’s left edge is

The tolerance at which the inner solve stops mattering is not machine precision and it is not a fixed number either. It sits at about the square root of the plateau — which is to say at about the distance to the root — because that is where the linear solve’s own error stops being smaller than the linearisation’s.

That has a consequence worth stating plainly: the correct inner tolerance is proportional to how far from the root the iteration currently is, and the iteration knows that quantity to within a constant, because it is roughly the ratio of consecutive residuals.

At the first step of the run drawn here, the iterate is 2.95 away from the root and the plateau is at 1.80. Any tolerance below about 0.1 is spent on nothing. At the last step the iterate is 2.5·10⁻³ away and the plateau is at 1.2·10⁻⁵; there a tolerance of 10⁻² lands at 1.4669·10⁻⁵ against the plateau’s 1.1999·10⁻⁵, a genuine 22 per cent shortfall, and one more decade closes it entirely.

The demand a step can use rises by two decades for every decade the outer iteration gains, and a constant is by construction wrong at one end of that or the other.

A single Newton step solved to eleven inner tolerances, against how far the resulting point is from the rootThe iterate is 1.8 from a root that is known exactly by construction. The same linear system is solved to relative residuals from 0.3 down to 10⁻¹⁴, at 33 and 700 conjugate gradient iterations, and the resulting point is 1.138 and 1.027 from the root. The curve is flat below about 10⁻³: the linearisation is wrong at second order, so the step cannot land closer than the square of the distance it started at — 3.238 — however exactly it is computed.10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³110⁻¹110¹inner tolerance η, relative residual of the linear solvedistance from the root after the stepd² = 3.24distance before the step, 1.833167416700the number by each point is the iterations it costeleven decades, one landing placedistance before the step1.8its square3.2where η = 10⁻³ lands1where η = 10⁻¹⁴ lands1iterations for the first167iterations for the second700the accuracy that is thrown awaymeasured against a root that is known
Fig. 4 The far-field case, where the whole picture is nearly flat. A Newton step taken this far from the root is barely worth computing carefully at all.

The plateau is a claim about where the inner solve stops buying anything, so it is worth watching across the whole outer iteration rather than at one step of it.

A single Newton step solved to eleven inner tolerances, against how far the resulting point is from the rootThe iterate is 2.95 from a root that is known exactly by construction. The same linear system is solved to relative residuals from 0.3 down to 10⁻¹⁴, at 22 and 560 conjugate gradient iterations, and the resulting point is 1.963 and 1.799 from the root. The curve is flat below about 10⁻³: the linearisation is wrong at second order, so the step cannot land closer than the square of the distance it started at — 8.686 — however exactly it is computed.10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³110⁻¹110¹inner tolerance η, relative residual of the linear solvedistance from the root after the stepd² = 8.69distance before the step, 2.9522123336560the number by each point is the iterations it costeleven decades, one landing placedistance before the step2.9its square8.7where η = 10⁻³ lands1.8where η = 10⁻¹⁴ lands1.8iterations for the first123iterations for the second560the accuracy that is thrown awaymeasured against a root that is known
Fig. 5 The first iterate, 2.95 from the root. d² is 8.686 and the plateau is at 1.799 — a fifth of d². The inner solve takes 22 iterations at η = 0.3 and 560 at 10⁻¹⁴.
A single Newton step solved to eleven inner tolerances, against how far the resulting point is from the rootThe iterate is 0.507 from a root that is known exactly by construction. The same linear system is solved to relative residuals from 0.3 down to 10⁻¹⁴, at 78 and 1005 conjugate gradient iterations, and the resulting point is 0.2069 and 0.1787 from the root. The curve is flat below about 10⁻³: the linearisation is wrong at second order, so the step cannot land closer than the square of the distance it started at — 0.2572 — however exactly it is computed.10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³110⁻²10⁻¹110¹inner tolerance η, relative residual of the linear solvedistance from the root after the stepd² = 0.257distance before the step, 0.507782576211005the number by each point is the iterations it costeleven decades, one landing placedistance before the step0.51its square0.26where η = 10⁻³ lands0.18where η = 10⁻¹⁴ lands0.18iterations for the first257iterations for the second1005the accuracy that is thrown awaymeasured against a root that is known
Fig. 6 The fourth, 0.507 from the root: d² = 0.2572, plateau 0.1787, and 78 against 1,005 inner iterations.

Both quantities are falling, and they are falling at different rates — which is the whole of the argument, and needs a third and fourth reading to establish.

A single Newton step solved to eleven inner tolerances, against how far the resulting point is from the rootThe iterate is 0.179 from a root that is known exactly by construction. The same linear system is solved to relative residuals from 0.3 down to 10⁻¹⁴, at 91 and 1099 conjugate gradient iterations, and the resulting point is 0.04787 and 0.03719 from the root. The curve is flat below about 10⁻³: the linearisation is wrong at second order, so the step cannot land closer than the square of the distance it started at — 0.03193 — however exactly it is computed.10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³110⁻²10⁻¹1inner tolerance η, relative residual of the linear solvedistance from the root after the stepd² = 0.0319distance before the step, 0.179913086891099the number by each point is the iterations it costeleven decades, one landing placedistance before the step0.18its square0.032where η = 10⁻³ lands0.037where η = 10⁻¹⁴ lands0.037iterations for the first308iterations for the second1099the accuracy that is thrown awaymeasured against a root that is known
Fig. 7 The fifth, 0.179 out: d² = 0.03193 and the plateau 0.03719 — the two have crossed.
A single Newton step solved to eleven inner tolerances, against how far the resulting point is from the rootThe iterate is 0.0372 from a root that is known exactly by construction. The same linear system is solved to relative residuals from 0.3 down to 10⁻¹⁴, at 109 and 1126 conjugate gradient iterations, and the resulting point is 0.005319 and 0.002497 from the root. The curve is flat below about 10⁻³: the linearisation is wrong at second order, so the step cannot land closer than the square of the distance it started at — 0.001383 — however exactly it is computed.10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³110⁻⁴10⁻³10⁻²10⁻¹1inner tolerance η, relative residual of the linear solvedistance from the root after the stepd² = 0.00138distance before the step, 0.03721093547231126the number by each point is the iterations it costeleven decades, one landing placedistance before the step0.037its square0.0014where η = 10⁻³ lands0.0025where η = 10⁻¹⁴ lands0.0025iterations for the first354iterations for the second1126the accuracy that is thrown awaymeasured against a root that is known
Fig. 8 And the sixth, 0.0372 out: d² = 0.001383 against a plateau of 0.002497, now 1.8 times d².
outer iterate distance d d² plateau plateau ÷ d² inner iterations, η = 0.3 at η = 10⁻¹⁴ ratio
1 2.95 8.686 1.799 0.21 22 560 25.5
2 1.80 3.238 1.027 0.32 33 700 21.2
3 1.03 1.055 0.5071 0.48 53 849 16.0
4 0.507 0.2572 0.1787 0.70 78 1,005 12.9
5 0.179 0.03193 0.03719 1.17 91 1,099 12.1
6 0.0372 0.001383 0.002497 1.81 109 1,126 10.3
7 0.0025 6.234·10⁻⁶ 1.2·10⁻⁵ 1.93 109 1,129 10.4

The plateau converges on twice d², and it gets there from below. plateau ÷ d² runs 0.21, 0.32, 0.48, 0.70, 1.17, 1.81 and 1.93 — so far from the root the plateau is a fraction of d² and near the root it settles at about 1.9·d². The quantity the inner solve cannot help with is exactly the quantity the outer iteration was going to gain, and the identification is only clean in the limit the essay cares about.

And the premium for over-solving falls as the iteration converges. Solving to 10⁻¹⁴ instead of 0.3 costs 25.5× the inner iterations at the first outer step and 10.4× at the last — the ratio runs 25.5, 21.2, 16.0, 12.9, 12.1, 10.3, 10.4. So the proportional waste is worst early, when the plateau is largest and there is genuinely nothing to buy.

In absolute terms it is worst late. At the seventh iterate the loose tolerance costs 109 inner iterations and the tight one 1,129 — 1,020 extra iterations, more than at any earlier step, spent resolving a correction below a plateau of 1.2·10⁻⁵. And the loose column has stopped growing: 109 at both the sixth and the seventh iterate, to the unit. The inner work under a sensible forcing term converges; under a fixed tight tolerance it does not.

What the sweep costs to make

It is worth saying what the U above is, because a curve of twelve points where each point is a whole solve is a different kind of object from a curve where each point is an evaluation.

Every point on it is a complete inexact Newton run on the same 200×200 problem to the same outer tolerance: nine to thirty outer steps, each with its own conjugate gradient solve, and the vertical coordinate is the sum of every inner iteration in the run. Nothing is estimated and no step count is extrapolated. The adaptive point drawn beside the curve is a thirteenth complete run under a different rule, and it is a point rather than a curve because it is not a constant and there is no axis it belongs on.

The reason to say so is that the two arms of a U are usually a fit through a model. These are measurements of runs, and the asymmetry between the arms is a measurement too: the left arm rises smoothly, because oversolving costs a predictable number of extra iterations per decade, and the right arm rises in jumps, because a Newton step either survives being solved that loosely or the run needs another whole step.

What this is not

Three readings to rule out, because each of them is available from the figure and each is wrong.

Not that the inner solve does not matter. It matters enormously; it is where all the work is. What does not matter is the part of its accuracy that lies below the linearisation error, and that part is most of the accuracy a default tolerance asks for.

Not that this is about conjugate gradients. The plateau is a property of the outer method. Any inner solver put in its place meets the same floor; what changes is how much a decade of tolerance costs, and that only moves the vertical distance between the points on the plateau, not the plateau.

Not that the effect is small on well-conditioned problems. It is invisible on well-conditioned problems, which is different: there the inner solve costs a handful of iterations at any tolerance, so the waste is real and cheap. The effect scales with how expensive the inner solve is, which is to say it is largest exactly where it is worth having.

Two numbers a solver could report and does not

The measurement suggests two things an inexact Newton implementation could print, neither of which is expensive and neither of which is usual.

The linearisation error of the step just taken, which is ‖F(x + s)‖ compared against what the linear model predicted. It costs nothing extra — the residual at the new point is evaluated anyway on the next step — and it is exactly the floor this essay is about. A solver that printed it would be telling its user how much inner accuracy the next step can use.

And the share of the inner solve that was spent below that floor, which is the difference between the tolerance asked for and the tolerance the floor justified. On the runs here that share is most of the work, and it is invisible in any log a solver currently writes.

Neither is a new algorithm and neither changes an answer. They are both the collection’s standing habit applied to somebody else’s code: a quantity that decides something should be printed beside the thing it decided, so that a reader can see whether the decision was a good one.

The refusal

The claim that a Newton step landing short of the root was solved too loosely is a claim about which of two quantities is the binding one, and it is fed here the case where the answer is the other one.

At the iterate 3.719·10⁻² from the root, the seven tolerances from 10⁻³ down to 10⁻¹⁴ land between 2.4966·10⁻³ and 2.4967·10⁻³. The assertion that the shortfall belongs to the inner solve is fed those numbers and required to fail, which it does. Then the same assertion is fed the first Newton step from a cold start — where the tolerance genuinely does move the answer, because the linearisation error there is the size of the iterate — and it passes, which is what makes the first result a measurement rather than a tautology.

What it means for the rest of the field

The plateau is the first of the four assets this field is about, and it is the one with no downside at all. A tolerance is not an object that has to be built, so choosing it badly costs nothing but work; there is no risk of a wrong answer, no cliff, and no case where being too loose destroys anything that cannot be recovered on the next step.

That is exactly why it is first. The other three — the factorisation, the preconditioner, the pivot order — are objects with a construction cost, and each of them adds a failure mode that a tolerance does not have.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Conjugate gradientsExact ground truthFlop countForcing termInexact newtonKrylov subspaceLinearisationNewton iterationQuadratic convergence