Refactor monogramRefactor

Mathematics / Heat grids · Numerical error

How quickly does the residual doubling cost settle?

Follow the same smooth-pulse amplitude on a grid and on one twice as wide. Its later crossing on the larger grid explains why the residual doubling cost falls short of its limit by a fraction of about 1/log d.

Begin with: Logarithms and implicit differentiation. The remainder piece introduces the checkerboard signs, and the printable proof gives the Gaussian and boundary estimates.

Pick one amplitude in the smooth heat pulse and follow that same amplitude on two grids. Put the walls 1,024 steps away on the first grid and 2,048 on the second. When does a layer of height one overtake the fading checkerboard on each grid? If the second crossing came exactly twice as late as the first, the layer would earn a full log 2 of extra logarithmic time. It comes a little later. That delay is where the missing fraction of the doubling cost goes.

Keep one amplitude fixed

Let d be the distance from the center to a wall. At each tick a cell keeps 1/d of its old value and takes the remaining fraction from the weighted average of its neighbors. Read the center minus that same neighbor average. An error made t ticks ago reaches this thermometer with a weight we can calculate backward. The weight has a smooth part and a part that changes sign from one cell to the next.

Through the late crossing, the two Gaussian approximations share the same spreading density to leading order. Divide it out. A smooth amplitude layer of height y then has size y/t, while the local checkerboard has size about 2 exp(−2t/d). A layer contributes to a sign disagreement once the fading checkerboard drops below it. Measure the lag in units of d/2 by writing v = 2t/d. Its late crossing solves

y = 2t exp(−2t/d) = d v exp(−v),

v − log v = log d − log y, v > 1.

Try y = 1. At d = 1,024 the solution is v ≈ 9.145, or about 4,682 ticks. At d = 2,048 it is v ≈ 9.919, or about 10,157 ticks. Twice the first lag is only 9,364 ticks. These are crossings of the smooth-pulse approximation. The calculation below explains how to add up the layers and recover a statement about the discrete grid.

Each layer earns time at the rate dt/t after its crossing. Heat reaches the walls on a time scale of d², which quadruples when d doubles. Write vd and v2d for the two roots at the same y. On these time scales the gain in logarithmic time is

log 4 − log(2v2d/vd)

= log 2 − log(v2d/vd).

The height-one layer earns about 0.612 of an ideal 0.693. Why should the fraction it misses be about 1/log d?

Measure the delay on the larger grid

Call the solution of v − log v = a on the decreasing-amplitude branch τ(a), and write L = log d and ℓ = log 2. Doubling adds exactly ℓ to the input a = L − log y. Implicit differentiation tells us how fast the logarithm of the crossing time moves in these units.

d log τ(a) / da = 1 / (τ(a) − 1).

For a fixed y and large d, the root is close to L. The derivative is then close to 1/L throughout that step of length ℓ. The layer loses about ℓ/L out of a possible ℓ, a relative shortfall of 1/log d. To turn this one-layer calculation into a rate for the thermometer, we need to know how much weight each height carries and how accurately we can discard the walls in the comparison.

Weigh each layer by the signs it can change

The five-cell calculation in the remainder piece gives the starting identity. Each backward weight that disagrees with the checkerboard contributes twice its magnitude to the excess over the checkerboard reading. Pair nearby cells of opposite color. If their smooth weight is u and their common checkerboard magnitude is c, the average excess of the two parities is

(|u + c| + |u − c|)/2 − c

= max(|u| − c, 0).

This identity tells us how to count a height y. After dividing out the Gaussian density and multiplying by t, the smooth magnitude is Y = |X − n|/2, where n is the dimension and X is the sum of squares of n independent standard normal variables. A layer between y and y + dy is present wherever Y > y. Its weight is therefore P(Y > y) dy. Call this measure ν. Its total mass is α = E Y. For a checkerboard threshold z, the mean excess E max(Y − z, 0) is exactly the mass of the layers above z.

Take a centered box with zero values on the walls. Fix the dimension and the positive probabilities of choosing each axis, with equally likely directions along it. Starting with an exact grid, let C(d,h) be the sharp all-run thermometer error factor per unit of bounded per-cell, per-tick error. On the free grid the signed checkerboard mass at lag t is 2(1 − 2/d)t. Its sum supplies the linear term d. Define the residual, its doubling cost and its limiting cost by

R(d) = C(d,1/d) − d,

D(d) = R(2d) − R(d), Q = α log 2.

Subtract with the walls in place

The preceding proof of the doubling limit leaves a term that tends to zero. To resolve a gap of size 1/log d we need finer control. Up to lag (3/8)d log d, sign disagreements cost only O(d−1/4) in total. From there to lag d3/2 the Gaussian approximation and the pairing of adjacent cells have a combined error of the same order. At still later lags the smooth pulse reaches the walls. Reflection gives its contribution as a logarithm plus a constant depending on the fixed box shape and axis probabilities. That constant is identical on the two grids.

Keep amplitudes in I(d) = [d−1/2, d1/8] on both grids. The discarded low layers have total mass at most d−1/2, and the high layers have exponentially small mass. Subtracting the two grid estimates now cancels the boundary constant. The lost logarithmic time is the integral of the crossing-time derivative for the same y on both grids.

Delay(y) = ∫₀ℓ [τ(L + s − log y) − 1]−1 ds,

Q − D(d) = ∫I(d) Delay(y) ν(dy) + O(d−1/4).

The root equation gives τ(a) = a + log a + O((log a)/a). On the retained interval the derivative differs from 1/L by at most a constant times (log L + |log y| + 1)/L². The measure ν has a finite integral of |log y|, so we can sum the layer estimates. The leading term in the shortfall is αℓ/L = Q/L. In relative units the result is

(Q − D(d)) / Q = 1/L + O((log L)/L²).

Thus the cost approaches its limit from below for all sufficiently large d. For any fixed η > 0, the gap eventually lies between (1 − η)Q/log d and (1 + η)Q/log d. The distance at which this estimate applies can depend on the stencil and the dimension. Squaring a large wall distance roughly halves the relative shortfall.

Read the size of the gap on a line

On a line α = 2/√(2πe), so Q ≈ 0.33544. Propagate the actual weights backward and sum their absolute values to see how much of that limit a finite doubling earns.

Doubling costs on a line. The last two columns compare the measured relative shortfall with its leading asymptotic prediction. Values are rounded.
dD(d)Gap / Q1/log d
2560.2893813.7%18.0%
5120.2953811.9%16.0%
1,0240.2997010.7%14.4%
2,0480.302949.7%13.1%

Moving the walls from 1,024 to 2,048 on a line adds about 0.29970 times the local error tolerance after accounting for the linear term. Its gap from the limiting allowance is about 0.03575 times that tolerance. The first asymptotic term at d = 1,024 predicts a gap of about 0.04839. For all four rows the computed D(d) is within 0.00005 of the displayed value, including rounding.

Keep the crossings at d = 1,024

Return to the two grids in the opening. Propagating their weights gives D(1,024) ≈ 0.2996973. The limit is Q ≈ 0.3354427, so the line loses 10.66% of a full doubling. How much of that loss can we recover from the smooth pulse itself?

At height y = 1 the late roots were 9.14464 and 9.91908. This layer loses log(9.91908/9.14464) ≈ 0.08129 units of logarithmic time. Repeat that calculation at every height shared by the two grids. For each k = 1,024 or 2,048, take the late root vk(y) of v − log v = log(k/y). Give its delay the weight of the layer. On a line that weight is T(y) dy, where T(y) = P(|Z² − 1|/2 > y) for a standard normal Z.

Delay(y) = log(v2048(y) / v1024(y)),

predicted shortfall = (1/Q) ∫₀1024/e T(y) Delay(y) dy.

Both late roots exist up to height 1,024/e, the peak of the smaller grid’s threshold. One can evaluate the integral by bisecting the root equation at each height and splitting the quadrature at y = ½. Below that height, values of Z near zero and values in the two outer tails both contribute to T(y). Above it, only the outer tails contribute. Integrating through y = 80 already gives a weighted delay of 0.03411407. Dividing by Q gives 10.17%. The remaining common heights have negligible Gaussian mass. Page 5 of the proof bounds their contribution and gives the normal-tail formula.

Now expand those same crossing times. Write L = log 1,024 ≈ 6.93147. The root equation introduces a log L term, and averaging the delays over pulse heights introduces their weighted mean log amplitude. With Y = |Z² − 1|/2 and α = E Y, the full second-order prediction for the relative shortfall is

1/L − (log L + κ)/L²,

κ = (log 2)/2 − E[Y log Y]/α ≈ 0.71459.

Relative shortfall for the line doubling from 1,024 to 2,048. The backward-grid calculation supplies the comparison value.
CalculationShortfall
Leading term14.43%
Subtract (log L)/L²10.40%
Full second order8.91%
Keep the late roots10.17%
Backward grid weights10.66%

The measured drop from 14.43% is 3.77 percentage points. The log L term alone removes 4.03 points, already landing slightly below the grid. The constant removes another 1.49 points, bringing the prediction to 8.91%. Both terms belong to the expansion, but truncating there at this wall distance overshoots the measured drop by 1.75 points. Keeping the roots recovers 1.26 of those points within the Gaussian model. The remaining 0.49 points are the difference between that model prediction and the discrete weights.

The five-page proof gives the lattice and wall estimates, derives the next correction, and works through the numerical comparison. Download How quickly does the residual doubling cost settle? (PDF).

Of the remaining 0.49 percentage points, about 0.36 come from the scale of the thermometer. The next companion restores the effects of a holding tick and proves how fast the gap between the crossing prediction and the grid shrinks. Where did the 0.49 percentage points go?