The matrix that is a graph

A count that comes out of a determinant

The number of spanning trees of a graph is the determinant of its grounded Laplacian, so it is a whole number known in advance. The elimination that computes it is backward stable at every size — and from sixteen vertices the answer is wrong, because the count has seventeen digits and a binary64 has sixteen.

Worth reading first: The number that decides nothing · A matrix with no numbers in it · What a float can hold.

Kirchhoff proved in 1847 that the number of spanning trees of a graph is a determinant: delete any one row and column from the Laplacian and take the determinant of what is left. The answer does not depend on which row was deleted, and it is a positive integer.

That makes it an unusual computation for this site. The quantity is discrete, the routine that produces it is continuous, and the correct answer is known in advance to be a whole number — so it looks as though any computation accurate to better than a half can be rounded to the truth.

Backward stable at every size, and wrong from n = 16The number of spanning trees of the complete graph on n vertices, by Kirchhoff's theorem: the determinant of the Laplacian with one row and column deleted, which is nⁿ⁻² by Cayley's formula and is therefore a whole number known in advance. It is computed twice — in BigInt rationals, where the answer is exact, and by the site's own pivoted elimination in binary64. The filled curve is the relative error of the elimination, which never leaves the rounding level: worst 9.38·10⁻¹⁵ across the whole range, so the algorithm is backward stable at every size. The dashed curve is the spacing between consecutive doubles at the answer's own magnitude, relative to the answer. Where they cross, at n = 16, the count has 17 digits and a binary64 has sixteen: rounding to the nearest integer cannot recover it, because the nearest two representable numbers there are 8 apart. The error is committed by the format and not by the elimination, which is a distinction no residual can make.57911131517192110⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹vertices of the complete graphrelative sizethe algorithm is not the problemsizes counted18worst relative error9.4·10⁻¹⁵first wrong at n =16digits in the answer17spacing of doubles there8largest integer a double holds9·10¹⁵the elimination stays at the rounding levelthe format runs out
Fig. 1 The spanning-tree count of the complete graph on n vertices, computed in BigInt rationals and by pivoted elimination in binary64. The filled curve is the elimination’s relative error; the dashed one is the spacing between representable numbers at the answer’s own magnitude.

The two routes

Exactly. For an unweighted graph the Laplacian has integer entries, so the grounded matrix can be eliminated in BigInt rationals and the determinant is exact. Its denominator must come out 1 — the theorem says the answer is an integer — and the library asserts that rather than assuming it, which is a check on the rational arithmetic that costs nothing.

In floating point. The site’s own pivoted LU, on the same grounded matrix, with the determinant read off as the product of the pivots.

For the complete graph there is a third check that is not a computation at all: Cayley’s formula says the count is nⁿ⁻². Every row of the table below is checked against it.

The elimination is backward stable everywhere

n     spanning trees          relative error   digits   recovered by rounding
 6    1,296                     0                4        yes
 9    4,782,969                 1.9·10⁻¹⁶        7        yes
12    61,917,364,224            2.5·10⁻¹⁶       11        yes
15    1,946,195,068,359,375     2.6·10⁻¹⁶       16        yes
18    1.21·10²⁰                 1.4·10⁻¹⁵       21        no
20    2.62·10²¹                 4.9·10⁻¹⁵       24        no
22    7.05·10²⁶                 9.7·10⁻¹⁶       27        no

The relative error column never leaves the rounding level. It does not grow with n, it does not grow with the answer, and at twenty-two vertices it is 9.7·10⁻¹⁶ — the same as at nine.

That is exactly what the theory predicts and it is worth saying why, because it is the reassuring half of the essay. A Laplacian’s grounded submatrix is symmetric positive definite and well conditioned on these families, pivoted elimination on such a matrix is backward stable, and the error identity then bounds the forward error by about κ times the unit roundoff. The algorithm is not the problem at any size.

And the answer is wrong from n = 16

The complete graph on fifteen vertices has 1,946,195,068,359,375 spanning trees, which is 15¹³ and fits in a binary64 exactly. The one on sixteen has 16¹⁴ = 7.2·10¹⁶, which does not.

2⁵³ is 9,007,199,254,740,991. Above it, consecutive integers are not all representable: at 10¹⁷ the doubles are spaced two apart, at 1.2·10²⁰ they are spaced 16,384 apart, and at 2.6·10²³ they are spaced 33,554,432 apart.

So from sixteen vertices the count cannot be stored, let alone computed. The elimination returns the nearest representable number to the right answer, which is what a backward-stable algorithm should return and is not the count. Rounding it to the nearest integer returns itself, because it already is one — a representable one, sixteen thousand away from the truth.

The error is committed by the format and not by the elimination, and that is a distinction no residual can make. The computed determinant satisfies every check a determinant routine can run: the matrix reconstructs from its factors to 10⁻¹⁵, the pivots are all positive, the growth factor is 1.

The determinant is a product of pivots, and that is the whole story

It is worth following where the digits go, because the mechanism is completely visible.

Pivoted elimination computes the determinant as the product of the n − 1 diagonal entries of U. Each of those is a floating-point number with a relative error of a few roundings, so the product has a relative error of about n roundings — which for n = 22 is 5·10⁻¹⁵ and matches the measured column.

The product itself is where the size comes from. On the complete graph on twenty vertices the pivots are around twenty each, so their product is 20²¹ divided by something, which is 10²⁷ before the grounding is accounted for. Every intermediate partial product is representable — binary64 reaches 10³⁰⁸ — so there is no overflow, no underflow, and no warning.

What is lost is not magnitude but resolution. The exponent tracks the answer perfectly and the mantissa runs out after fifty-three bits, so the computed number has the right order and the right first sixteen digits and then nothing. For a real-valued determinant that is a completely satisfactory answer. For a count it is not an answer at all.

That distinction — a number whose leading digits are right and whose identity is wrong — is specific to answers that are integers. Nothing on this site that computes a real number has it, and it is why the graph field meets it first.

Why this is a different failure from the site’s usual one

Almost everything in this collection is about an algorithm’s contribution to a wrong answer, separated from the problem’s. The identity is forward ⪅ condition × backward, and every essay reports which of the two factors was responsible.

Here neither is. The backward error is a rounding, the condition number is small, and the answer is wrong by ten thousand. The missing term is the one this site named in the fifth author: a property of the representation rather than of the computation — and unlike the machine field’s version, which is about which order the additions happened in, this one is about whether the answer can be written down at all.

The general form is worth stating because it applies to any computation whose answer is a large integer. A permanent, a matching count, a partition function, a number of paths — all of them are computed by continuous routines and all of them have answers that outgrow binary64 quickly. The routine’s accuracy is beside the point once the answer has more digits than the format.

Every count recovered exactly, up to n = 12The number of spanning trees of the complete graph on n vertices, by Kirchhoff's theorem: the determinant of the Laplacian with one row and column deleted, which is nⁿ⁻² by Cayley's formula and is therefore a whole number known in advance. It is computed twice — in BigInt rationals, where the answer is exact, and by the site's own pivoted elimination in binary64. The filled curve is the relative error of the elimination, which never leaves the rounding level: worst 8.88·10⁻¹⁶ across the whole range, so the algorithm is backward stable at every size. The dashed curve is the spacing between consecutive doubles at the answer's own magnitude, relative to the answer. The error is committed by the format and not by the elimination, which is a distinction no residual can make.5791110⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹vertices of the complete graphrelative sizethe algorithm is not the problemsizes counted8worst relative error8.9·10⁻¹⁶largest integer a double holds9·10¹⁵the elimination stays at the rounding levelthe format runs out
Fig. 2 Up to twelve vertices, where every count is recovered exactly and the two curves have not crossed.

What “backward stable” is not promising

It is worth being precise, because the phrase is doing work in the table and could be read as an excuse.

Backward stability says the computed answer is the exact answer to a nearby problem. For a determinant that means: the number returned is the exact determinant of a matrix within 10⁻¹⁵ of the one handed over. That is a strong statement and it is true here at every size.

What it does not say is that the decimal digits of the answer are right, and for a large integer those are different claims. The exact determinant of a nearby matrix is a different integer, and how different depends on how large the answer is: at 10²⁰ a relative perturbation of 10⁻¹⁵ is an absolute perturbation of 10⁵.

So a backward-stable determinant of a well-conditioned matrix can be wrong by a hundred thousand, and nothing is broken. The site has made this argument before about a determinant deciding nothing; the graph case is the sharpest instance, because here the answer is known to be an integer and the temptation to round is at its strongest.

Where the crossover actually is

The figure draws two curves — the relative error, flat at 10⁻¹⁵, and the spacing of the doubles relative to the answer, which is 2⁻⁵³ once the answer exceeds 2⁵³ and irrelevant below it.

They cross where the answer passes the largest exactly representable integer, and for the complete graph that is at n = 16, since 15¹³ < 2⁵³ < 16¹⁴. For other families it is wherever the count passes 9·10¹⁵:

graph            spanning trees            digits   recovered
grid 4×4         100,352                     6       yes
grid 5×5         557,568,000                 9       yes
hypercube 4      42,467,328                  8       yes
hypercube 5      20,776,019,874,734,407,680  20      no
complete 15      1,946,195,068,359,375       16      yes
complete 16      72,057,594,037,927,936      17      no

A five-dimensional hypercube has thirty-two vertices and eighty edges — a small graph by any measure — and its spanning-tree count has twenty digits.

That is the practical content: the format runs out long before the graph gets interesting. Any tree count on a graph of more than about a dozen vertices needs exact arithmetic, and the question of which floating-point routine to use never arises.

What to do instead

Three options, and the third is the one that makes the theorem useful at scale.

Compute exactly. BigInt rationals give the count with no error at all, at a cost that is superquadratic in the size on top of the elimination. Affordable to a few dozen vertices, which is what the figures here do, and what makes the error column measurable in the first place.

Compute the logarithm. log(det) = Σ log(pivot) is a sum of about n terms, each accurate to a rounding, so the log of the count is accurate to about n·10⁻¹⁶ relative — which at n = 32 is fourteen correct digits of an answer that could not be represented at all. That is enough for every use of the count except printing it: comparing two graphs’ counts, computing a probability, estimating an entropy.

Or ask a different question. The number of spanning trees is rarely wanted for itself. What is usually wanted is a ratio — the probability an edge appears in a random spanning tree, which is its effective resistance — and a ratio of two determinants is a quantity of modest size computed by two well-conditioned solves.

That last route is worth dwelling on. It is the same move the inverse essays make: a formula names a quantity that is enormous and awkward, the thing actually wanted is a ratio of two of them, and computing the ratio directly avoids the enormous intermediate entirely. Here the intermediate is an integer with twenty digits and the ratio is a number between zero and one.

The theorem does not depend on which row is deleted

One property of Kirchhoff’s theorem is worth verifying rather than quoting, because it is the kind of claim that is easy to state and easy to get subtly wrong in an implementation.

Deleting any row and the corresponding column gives the same determinant. That is not obvious — the submatrices are different matrices, with different entries, different pivots and different condition numbers — and it is a consequence of every row of the Laplacian summing to zero.

In floating point the invariance holds to the rounding level and not exactly, and the reason is the one the grounding essay measured: the condition number of the grounded matrix depends on which vertex was grounded, by up to a factor of nine hundred on a star. So the determinant computed after grounding a leaf and the one computed after grounding a hub have different forward errors, both at the rounding level and not the same rounding.

For a count small enough to be represented that difference is invisible, since both round to the same integer. Past the crossing it is not: two implementations that ground different vertices return two different large numbers, both backward stable, differing in their last digits, and both wrong. A count that disagrees between two runs is not evidence of a bug.

That is the graph field’s version of a machine-field observation: the same program, twice returns different numbers for reasons nobody chose, and the right response is to report the disagreement rather than to pick a winner.

The check the theorem provides

One more use of the exact route belongs here, because it is the reason the exactness is not just a demonstration.

Kirchhoff’s determinant must come out an integer. In rationals the library asserts the denominator is 1, and if the elimination had a bug the assertion would fire — not because the answer was compared against another routine, but because it violated a property the answer must have.

That is the same class of check as Foster’s identity two essays back and the Hilbert inverse in the error field: a mathematical fact the answer has to satisfy, checkable without a second implementation. A brute-force enumeration over all subsets of a five-vertex graph’s edges confirms the theorem itself once, at nine spanning trees, and Cayley’s formula confirms it at four more sizes — so the chain from “the theorem is true” to “this code computes it” has no unchecked link in it.

What a count is usually wanted for

It is fair to ask why anybody computes this number, given how quickly it stops being computable, and the answer sharpens the advice above.

Network reliability. The number of spanning trees is a crude measure of how many ways a network stays connected, and ratios of it are the useful form: the fraction of spanning trees containing a given edge is that edge’s effective resistance, which is a number between zero and one.

Random spanning trees. Sampling uniformly from spanning trees underlies the sparsification of the previous anchor and several combinatorial algorithms. The samplers never form the count; they use random walks, whose stationary properties encode it.

Statistical physics. The count is the partition function of a spanning-tree model, and what is wanted from a partition function is its logarithm — the free energy — divided by the size. That is exactly the log-determinant route above, and it is well defined in a limit where the count itself is astronomically large.

And graph comparison. Two graphs with the same count are not the same graph, and two with different counts are certainly different. That is a use for the exact integer, on graphs small enough to have one — and it is the use the next essay turns on its head, since the cospectral pair there has the same count as well as the same spectrum.

In none of those is a twenty-digit integer printed. The count is an intermediate, and the intermediate is the part that does not fit — which is the standard situation this site meets whenever a formula names a quantity larger than the answer.

One more reading of the dashed curve

The figure’s dashed curve is the spacing of the doubles at the answer’s magnitude, divided by the answer — which is 2⁻⁵³ once the count exceeds 2⁵³ and much smaller below it, because a small integer sits among representable numbers spaced far more finely than itself.

Read that way, the curve is the relative resolution of the format at that answer, and the crossing is where the format’s resolution stops being finer than the algorithm’s error. Below the crossing the format is the precise part and the elimination is the imprecise one; above it, the reverse.

That is a general way to look at any computation whose answer is an integer, and it takes one line of arithmetic: compare log₂ of the expected answer against 53. If it is below, the integer is recoverable provided the algorithm is accurate. If it is above, no algorithm helps and the question is which exact route to take.

The line is not always drawn, and the reason it is not is that a floating-point routine gives no symptom when it crosses. Integer arithmetic overflows loudly; floating-point arithmetic loses resolution silently, and a determinant of 10²⁰ looks exactly as healthy as one of 10⁶.

At other settings

Every count recovered exactly, up to n = 8The number of spanning trees of the complete graph on n vertices, by Kirchhoff's theorem: the determinant of the Laplacian with one row and column deleted, which is nⁿ⁻² by Cayley's formula and is therefore a whole number known in advance. It is computed twice — in BigInt rationals, where the answer is exact, and by the site's own pivoted elimination in binary64. The filled curve is the relative error of the elimination, which never leaves the rounding level: worst 8.88·10⁻¹⁶ across the whole range, so the algorithm is backward stable at every size. The dashed curve is the spacing between consecutive doubles at the answer's own magnitude, relative to the answer. The error is committed by the format and not by the elimination, which is a distinction no residual can make.5710⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹vertices of the complete graphrelative sizethe algorithm is not the problemsizes counted4worst relative error8.9·10⁻¹⁶largest integer a double holds9·10¹⁵the elimination stays at the rounding levelthe format runs out
Fig. 3 Eight vertices, where the answer has five digits and everything is exact.
Every count recovered exactly, up to n = 15The number of spanning trees of the complete graph on n vertices, by Kirchhoff's theorem: the determinant of the Laplacian with one row and column deleted, which is nⁿ⁻² by Cayley's formula and is therefore a whole number known in advance. It is computed twice — in BigInt rationals, where the answer is exact, and by the site's own pivoted elimination in binary64. The filled curve is the relative error of the elimination, which never leaves the rounding level: worst 3.41·10⁻¹⁵ across the whole range, so the algorithm is backward stable at every size. The dashed curve is the spacing between consecutive doubles at the answer's own magnitude, relative to the answer. The error is committed by the format and not by the elimination, which is a distinction no residual can make.57911131510⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹vertices of the complete graphrelative sizethe algorithm is not the problemsizes counted11worst relative error3.4·10⁻¹⁵largest integer a double holds9·10¹⁵the elimination stays at the rounding levelthe format runs out
Fig. 4 Fifteen, the largest complete graph whose count a binary64 holds exactly.
Backward stable at every size, and wrong from n = 16The number of spanning trees of the complete graph on n vertices, by Kirchhoff's theorem: the determinant of the Laplacian with one row and column deleted, which is nⁿ⁻² by Cayley's formula and is therefore a whole number known in advance. It is computed twice — in BigInt rationals, where the answer is exact, and by the site's own pivoted elimination in binary64. The filled curve is the relative error of the elimination, which never leaves the rounding level: worst 6·10⁻¹⁵ across the whole range, so the algorithm is backward stable at every size. The dashed curve is the spacing between consecutive doubles at the answer's own magnitude, relative to the answer. Where they cross, at n = 16, the count has 17 digits and a binary64 has sixteen: rounding to the nearest integer cannot recover it, because the nearest two representable numbers there are 8 apart. The error is committed by the format and not by the elimination, which is a distinction no residual can make.5791113151710⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹vertices of the complete graphrelative sizethe algorithm is not the problemsizes counted14worst relative error6·10⁻¹⁵first wrong at n =16digits in the answer17spacing of doubles there8largest integer a double holds9·10¹⁵the elimination stays at the rounding levelthe format runs out
Fig. 5 Eighteen, two sizes past the crossing.
Backward stable at every size, and wrong from n = 16The number of spanning trees of the complete graph on n vertices, by Kirchhoff's theorem: the determinant of the Laplacian with one row and column deleted, which is nⁿ⁻² by Cayley's formula and is therefore a whole number known in advance. It is computed twice — in BigInt rationals, where the answer is exact, and by the site's own pivoted elimination in binary64. The filled curve is the relative error of the elimination, which never leaves the rounding level: worst 9.89·10⁻¹⁵ across the whole range, so the algorithm is backward stable at every size. The dashed curve is the spacing between consecutive doubles at the answer's own magnitude, relative to the answer. Where they cross, at n = 16, the count has 17 digits and a binary64 has sixteen: rounding to the nearest integer cannot recover it, because the nearest two representable numbers there are 8 apart. The error is committed by the format and not by the elimination, which is a distinction no residual can make.579111315171921232510⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹vertices of the complete graphrelative sizethe algorithm is not the problemsizes counted22worst relative error9.9·10⁻¹⁵first wrong at n =16digits in the answer17spacing of doubles there8largest integer a double holds9·10¹⁵the elimination stays at the rounding levelthe format runs out
Fig. 6 And twenty-six, where the count has thirty-three digits and the spacing is 10¹⁷.
Same matrix, same arithmetic, 4.13× the fillGaussian elimination on the Laplacian of the grid 6×6, under five orderings, counting the edges that did not exist before. Eliminating a vertex removes it and joins its neighbours into a clique — the star–mesh transform, which is what the Schur complement of a Laplacian does — so fill is a set of edges rather than a set of nonzeros, and the matrix that remains is still a graph: symmetric, zero row sums, nonpositive off the diagonal, checked at every step and worst at 3·10⁻¹⁵. Minimum degree fills 71 edges against 293 for the worst ordering here, on a graph with 60 to start with. Nothing about the arithmetic differs between these five runs.05101520253035059118177236295vertices eliminatededges of fill so farminDegree: 71natural: 125reverse: 125random: 160maxDegree: 293fill, by orderingminDegree71natural125reverse125random160maxDegree293edges to start60eliminating a vertex makes a cliqueand the order decides how big
Fig. 7 The elimination whose pivots this determinant is the product of.
complete 20: 20 vertices, 190 edges, and a matrix built from themThe complete 20 laid out at its own second and third Laplacian eigenvectors, so the picture is the same object the measurements are about. The Laplacian L = D − A is built by subtraction of integers, so every row sums to exactly zero — measured at 0, not at the rounding level — and L·1 is the zero vector with no arithmetic error anywhere in it. Its 1 zero eigenvalue counts the connected components, which breadth-first search also puts at 1; the smallest non-zero eigenvalue is 20 and the largest computed zero is 7.22·10⁻¹⁶, a gap of 2.77·10¹⁶. The quadratic form xᵀLx is Σ over edges of (xᵢ − xⱼ)², which at the alternating vector is 400.the matrix, measuredvertices20edges190‖L·1‖∞0zero eigenvalues1components, by search1λ₂20laid out at its own eigenvectorsand the row sums are exactly zero
Fig. 8 The complete graph whose count is 2.6·10²¹ at twenty vertices.
hypercube 5: 32 vertices, 80 edges, and a matrix built from themThe hypercube 5 laid out at its own second and third Laplacian eigenvectors, so the picture is the same object the measurements are about. The Laplacian L = D − A is built by subtraction of integers, so every row sums to exactly zero — measured at 0, not at the rounding level — and L·1 is the zero vector with no arithmetic error anywhere in it. Its 1 zero eigenvalue counts the connected components, which breadth-first search also puts at 1; the smallest non-zero eigenvalue is 2 and the largest computed zero is 2.7·10⁻¹⁷, a gap of 7.42·10¹⁶. The quadratic form xᵀLx is Σ over edges of (xᵢ − xⱼ)², which at the alternating vector is 64.the matrix, measuredvertices32edges80‖L·1‖∞0zero eigenvalues1components, by search1λ₂2laid out at its own eigenvectorsand the row sums are exactly zero
Fig. 9 A hypercube, whose count has twenty digits at thirty-two vertices.
Resistance to 15 vertices, against an answer that is a ratio of integersEffective resistance from vertex 0 to every other vertex of the grid 4×4, computed twice in floating point — once by grounding a vertex and eliminating, once by summing (uₖᵢ − uₖⱼ)²/λₖ over the whole spectrum — and once in BigInt rationals, where for an unweighted graph the answer is exactly a ratio of two integers and there is no rounding anywhere. The curves are the relative errors of the two floating-point routes against that exact answer: at worst 4.75·10⁻¹⁶ for the elimination and 9.98·10⁻¹⁶ for the spectral sum, which use no arithmetic in common beyond the matrix they are both handed. Foster's theorem says Σ w·R over the edges is exactly n − 1 whatever the graph is; it comes to 15 against 15.1357911131510⁻¹⁸10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³1vertexrelative error against the exact answerthree routes, one numberworst, by elimination4.8·10⁻¹⁶worst, by spectrum10·10⁻¹⁶solve residual1.5·10⁻¹⁵Foster's sum15n − 115difference3.6·10⁻¹⁵the answer is a ratio of integersso the error is known
Fig. 10 The ratio of two such determinants, which is a number between zero and one.
log₁₀|det H_n| by three routes, to n = 30The exact rational determinant of the Hilbert matrix falls to 10^-518 at n = 30. The accumulated logarithm of the pivots follows it to n = 13 and then departs, reaching 10^-352 — wrong by 166 orders of magnitude and still an ordinary-looking number. The product of the pivots is a separate curve that ends at n = 29, where it underflows to exactly zero.26101418222630-550-450-350-250-150-50nlog₁₀|det H_n|exact rationalΣ log|u_ii|Π u_iithree routes, one theoremexact at the largest n-518accumulated logarithm-352decades of disagreement166smallest pivot at that n1.2·10⁻¹⁷every pivot is a normal numberat every size on this axis
Fig. 11 A determinant that overflows before it is wrong, in the elimination field.
The exact solution of a 13×13 Hilbert system beside the computed oneTwo columns of numbers: the exact answer, which is the integers one to thirteen, and the answer double-precision elimination returns, with the number of correct digits beside each.H13 x = b, b formed exactly so that x = (1, 2, …, 13)12345678910111213exact1.00002.00003.00133.97865.18864.993010.46720.048921.2657-2.575319.21478.906013.5113computed6.6 correct digits4.8 correct digits3.4 correct digits2.3 correct digits1.4 correct digit0.8 correct digitno correct digitsno correct digitsno correct digitsno correct digitsno correct digits0.6 correct digit1.4 correct digitbackward error2.2·10⁻¹⁷κ = 1.7·10¹⁸The algorithm solved a neighbouring problem perfectly. That problem's answer is this one.right-hand side built in BigInt rationalsthe truth is known
Fig. 12 An answer that is known, computed in rationals, in the field that introduced the habit.
Growth factor under partial pivoting to n = 40: the bound, the worst case, and realityGrowth factor against matrix size on a logarithmic vertical axis. The two-to-the-n bound rises as a straight line; Wilkinson's matrix sits exactly on it; random matrices stay near one.0816243240110²10⁴10⁶10⁸10¹⁰10¹²10¹⁴matrix size ngrowth factor max|u| / max|a|the 2ⁿ⁻¹ boundworst of 30 randommedian randomWilkinson's matrix sits on the bound30 Gaussian matrices per sizeat n = 40: bound 5.5·10¹¹, worst 4.8
Fig. 13 Growth under elimination, which a Laplacian has none of.
A 6.25-bit block format against 8-bit E4M3, read two waysFour curves of relative error against the spread of the data. Two, for the block format, rise steeply when read as a median and gently when read as a norm; the other two are nearly flat.048121610⁻²10⁻¹1octaves of spread within a blockrelative errorblock, medianblock, 2-normE4M3, medianE4M3, 2-normthe same data, two readingsblock format, bits a value6.3norm across 16 octaves1.8median across 16 octaves62entries deleted at the wide end383640 values, blocks of 32a norm is dominated by what a block format keeps
Fig. 14 A format running out, in the arithmetic field.
Two condition numbers of one 8×8 system, as its rows are put into different unitsFour curves against the spread of the row units, in decades. κ_∞ of the scaled matrix rises from 9.83 to 1.9·10¹⁰ while the componentwise condition number stays at 6.98 throughout — the same system, the same solution, and one of the two numbers is a fact about the units. Hilbert's two numbers are drawn flat beside them at 3.4·10¹⁰ and 1.2·10¹⁰: a matrix whose sensitivity no scaling repairs.0246810110²10⁴10⁶10⁸10¹⁰10¹²spread of the row units (decades)condition numberκ_∞(DA)cond(DA)Hilbert κ_∞Hilbert condone system, two numbersκ_∞ at no spread9.8κ_∞ at 10 decades1.9·10¹⁰cond, either end7Hilbert, equilibrated1.3·10¹⁰the solution is the same at every spreadand one of these curves knows it
Fig. 15 The spacing of representable numbers, which is what this essay’s dashed curve is.
Relative error of two algebraically identical expressions for (1 − cos x)/x², in binary32A log–log plot of relative error against x. The expression written as it reads loses accuracy as x falls and is eventually wrong in every digit; the rearranged form stays at rounding level.10⁻⁸10⁻⁶10⁻⁴10⁻²110⁻⁹10⁻⁶10⁻³1xrelative error of the computed value(1 − cos x)/x², as written2 sin²(x/2)/x²no digits left at allbinary32 throughoutone function, two spellings · zero below 3.5·10⁻⁴
Fig. 16 Cancellation taking the answer rather than a digit, which is not what happens here.
Backward and forward error against the condition numberA log–log plot over twelve decades of condition number. The backward error is a flat line at ten to the minus sixteen; the forward error rises in proportion to the condition number.110²10⁴10⁶10⁸10¹⁰10¹²10¹⁴10⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹condition number κ(A)relative errorforward errorbackward errorpredicted: κ · u8×8, 20 seeds per κ; dashed is the worstthe problem worsens, not the method
Fig. 17 The two errors, neither of which is responsible for the wrong count.
How much a perturbation of the right-hand side is amplified, κ = 10⁶The cumulative distribution of the amplification factor over two hundred random perturbation directions, with the condition number marked as the upper limit.110¹10²10³10⁴10⁵10⁶10⁷00.250.50.751amplification of the input perturbationfraction of directions at or belowκ = 10·10⁵worst found 7.6·10⁵6×6, 200 directionsmedian reaches 0.29 of κ
Fig. 18 The amplifier belonging to the problem, which here is small.
Backward error, forward error and the condition number, with measured valuesTwo boxes at the top — the problem posed and the nearby problem the algorithm answered exactly — and two answers below them, with the distances between all four labelled by numbers from a Hilbert solve.the problem you posedA = H10b = A·(1, 2, …, 10)the problem it answered exactlyA + δA, b + δb‖δ‖ / ‖A‖ = 2.3·10⁻¹⁷the answer you wantedx = (1, 2, …, 10), exactlythe answer you gotx̂, wrong by 2.7·10⁻⁴ relativebackward error 2.3·10⁻¹⁷forward error 2.7·10⁻⁴κ = 1.6·10¹³κ · η = 3.6·10⁻⁴, and the measured forward error is 2.7·10⁻⁴.The algorithm is not at fault. The problem is.H10, LU with partial pivotingresidual and error differ
Fig. 19 The identity that has no term for what goes wrong in this essay.
Forward error of a 6×6 Hilbert solve at eight precisionsA bar for each significand width from 12 to 53 bits showing the relative error in the computed solution, with the condition number times the unit roundoff marked as a prediction.κ = 1.5·10⁷ · the exact answer is (1, 2, …, 6)12 bits3.316 bits0.8620 bits4.324 bits0.09330 bits7.6·10⁻⁴36 bits6.2·10⁻⁶43 bits2·10⁻⁷53 bits4.5·10⁻¹¹dashed: κ · unit roundoffone matrix, eight arithmeticsmeasured against a known answer
Fig. 20 The precision knob, which moves the crossing and does not remove it.
One system, 36 ways to remove its kernel, and 2.85× between themA Laplacian is singular, so a solve has to remove its kernel, and the usual way is to delete one row and column — grounding a vertex, in the electrical reading. Which vertex is a free parameter that no account of the method mentions, and it is set by whichever index the code happens to drop. Every point here is one choice on the grid 6×6: the condition number of the resulting positive definite matrix against the degree of the vertex removed. Grounding vertex 5, of degree 2, gives κ = 275.34; grounding vertex 15, of degree 4, gives 96.565 — a factor of 2.851 between two ways of solving the identical problem. The trend is that a high-degree vertex is the better ground, which has a reading: grounding a vertex fixes its potential, and fixing the potential of something the rest of the graph is strongly attached to constrains more of the graph.23410²degree of the grounded vertexcondition number of what is left96.56, the best choicea parameter nobody setsvertices tried36best κ97at degree4worst κ275at degree2spread2.9one row and column deletedand it matters which
Fig. 21 The row and column deleted before the determinant is taken.
κ is between 1 and the total stretch, and the bound is 2.28–3.47× looseThree spanning trees of the grid 5×5 used as preconditioners. For each, the bar spans the smallest and largest eigenvalue of L_T⁻¹L_G on the subspace orthogonal to the constant vector, and the tick is the total stretch — the sum over the graph's edges of the resistance of the path the tree makes them take, which is an integer for an unweighted graph and contains no arithmetic at all. The smallest eigenvalue is 1 to 2·10⁻¹⁵ on every tree, which is a theorem rather than a measurement: a tree is a subgraph, so its quadratic form is never the larger. The largest is below the stretch on every tree, by between 2.28 and 3.47. Choosing a preconditioner is therefore choosing a tree, and it can be scored without factorising anything.10⁻¹110¹10²10³1234eigenvalue of the preconditioned Laplacian, and the stretchbreadth-firstκ = 34.62randomκ = 55.17random, secondκ = 37.11the bar is the spectrumthe tick is a combinatorial bound
Fig. 22 The trees this determinant counts, used as preconditioners.
Twenty eigenvalues, one of them zero, and the graph has one pieceThe Laplacian spectrum of two ten-vertex paths joined by a single edge of conductance 1, plotted on a logarithmic axis so the zero end is visible. The dashed line is the threshold 10⁻¹⁰‖L‖ = 1.06·10⁻⁹, and the number of eigenvalues below it is the spectral count of connected components: 1. Breadth-first search, which performs no arithmetic on any weight, says 1. The largest computed zero is 5.81·10⁻¹⁷ and the smallest eigenvalue above the threshold is 0.02462. A count of components is therefore a rank decision at a threshold, and the bridge's conductance decides which side of it λ₂ falls on — at nine orders above the rounding level, not at it.13579111315171910⁻¹⁹10⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹indexeigenvalue of L10⁻¹⁰‖L‖, the thresholda count that is a thresholdeigenvalues below it1components, by search1largest computed zero5.8·10⁻¹⁷smallest above it0.025ratio4.2·10¹⁴the graph is connectedat every stop of the slider
Fig. 23 The spectrum whose product, with the zero removed, is n times this count.
Past the cliff: what each method returnsLoss of orthogonality at four condition numbers past κ²u = 1. Cholesky QR returns a factor whose implied Q is 0.37 away from orthogonal at κ = 10⁸ and 1.49 at 10¹² — and at 3·10¹⁰ it refuses outright, on a pivot of -6.5·10⁻¹⁷. The sweep and the tree return a usable factorisation of every one of these matrices.‖QᵀQ − I‖ of the implied Qκ = 10⁸, Cholesky0.37κ = 10⁸, sweep8.5·10⁻⁹κ = 10¹⁰, Cholesky1.3κ = 10¹⁰, sweep3·10⁻⁷κ = 3·10¹⁰, Choleskyrefusedκ = 3·10¹⁰, sweep6.7·10⁻⁶κ = 10¹², Cholesky1.5κ = 10¹², sweep1.4·10⁻⁴the safe run is the one that failsrefusals in the range1wholly non-orthogonal returns2the pivot it refused on-6.5·10⁻¹⁷one of these outcomes is safeand it is the refusal
Fig. 24 A routine that returns a number rather than refusing, which this one does past n = 16.
Singular values of a rank-4 matrix with noise of relative size 10⁻⁸Ten singular values on a logarithmic axis. The first four sit near one; the rest sit at the noise level, and the vertical distance between the two groups is the evidence for the rank.1234567891010⁻¹⁸10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³1indexsingular valuecutoff, σ₁ · 10⁻¹⁰numerical rank 10gap 8.2·10⁶an opiniontrue rank 410×10, built with 4 nonzero valuesrank is a decision
Fig. 25 A continuous quantity turned into an integer, which is the opposite of this essay’s problem.
Backward error with and without the structure, for Levinson and for elimination, n = 12Both solvers are backward stable on this family by the usual measure: the smallest perturbation of any kind that explains either answer stays below 3.1·10⁻¹⁷ at every ρ, and the two curves are indistinguishable. Insisting the perturbation be a symmetric Toeplitz matrix — the kind of object the problem was posed with — lifts both by orders, and at ρ = 0.999 Levinson's rises by a factor of 2.48·10⁶. Neither number is alarming in absolute terms; what is worth carrying is that the reassuring one is the one that is reported, and the two are not measuring the same thing.10⁻³10⁻²10⁻¹110⁻¹⁹10⁻¹⁷10⁻¹⁵10⁻¹³10⁻¹¹10⁻⁹1 − ρbackward errorLevinson, Toeplitzelimination, ToeplitzLevinson, any kindelimination, any kindat ρ = 0.999Levinson, any perturbation3.1·10⁻¹⁷Levinson, Toeplitz only7.6·10⁻¹¹the ratio between them2.5·10⁶diagonal defect of the first0.97the number that is reportedand the number that is asked about
Fig. 26 A backward error measured against a structure, which is what stability means here.

What links here

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

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.

Backward errorCospectral graphsDeterminantExact ground truthFloating pointGraph eliminationGraph invariantGraph laplacianInteger overflowMatrix tree theoremSpanning tree