Generator

Three bases for the same null space, at 10 unknowns and 4 constraints

One function in the nullbasis library, called 27 times across 4 essays. Below: what it draws at its defaults, what it draws at every value an essay asks for, the 29 claims it put to the test while drawing them, and where it stands against the rule this site is named for.

At its defaults it draws three bases for the same null space, at 10 unknowns and 4 constraints. The same constrained problem solved three times, differing only in which basis Z is used for the null space of A. The orthonormal basis, from a QR of Aᵀ, has κ(Z) = 1 exactly and is dense — 100 per cent of its entries are nonzero. The fundamental basis built on the first 4 columns has κ(Z) = 1.994·10⁸, and its reduced Hessian comes out at 3.801·10¹⁶, which is κ(Z)² to within a factor of 0.956 — the square attained rather than bounded. Its answer is wrong by 0.05179, against 1.07·10⁻¹⁵ for the orthonormal one. Choosing the same kind of basis by pivoting instead gives κ(Z) = 2.06, an error of 6.71·10⁻¹⁶, and the same 50 per cent density: all of the sparsity and none of the loss.

null-basis-bars is one function in lib/figures/nullbasis.js — the basis of a constraint — three spans of one null space, and the square between them. Everything below came out of it during this build, at arguments taken from the essays rather than invented for this page. A figure here is the figure a reader meets in an essay, and if the generator changes, this page changes with it.

At its defaults

Drawn even though every essay passes arguments — which on this site is every essay, at 100% of placements since the standard pass. A default nothing exercises is a trap for the next essay to call this with none, and this is the page where a default that has drifted from the figures around it becomes visible.

Three bases for the same null space, at 10 unknowns and 4 constraintsThe same constrained problem solved three times, differing only in which basis Z is used for the null space of A. The orthonormal basis, from a QR of Aᵀ, has κ(Z) = 1 exactly and is dense — 100 per cent of its entries are nonzero. The fundamental basis built on the first 4 columns has κ(Z) = 1.994·10⁸, and its reduced Hessian comes out at 3.801·10¹⁶, which is κ(Z)² to within a factor of 0.956 — the square attained rather than bounded. Its answer is wrong by 0.05179, against 1.07·10⁻¹⁵ for the orthonormal one. Choosing the same kind of basis by pivoting instead gives κ(Z) = 2.06, an error of 6.71·10⁻¹⁶, and the same 50 per cent density: all of the sparsity and none of the loss.κ(A) = 10⁶ throughout · κ(H) = 100 · the answer is the same answer for every basisorthonormal — κ(Z)1κ(ZᵀHZ)25.6relative error1.07·10⁻¹⁵first m basic — κ(Z)1.99·10⁸κ(ZᵀHZ)3.8·10¹⁶relative error0.0518pivoted basic — κ(Z)2.06κ(ZᵀHZ)31.9relative error6.71·10⁻¹⁶what the choice costsdensity, orthonormal1density, fundamental0.5κ(ZᵀHZ) ÷ κ(Z)², naive0.96error, pivoted choice6.7·10⁻¹⁶every one of them is a basisand one of them loses fourteen digits

The same constrained problem solved three times, differing only in which basis Z is used for the null space of A. The orthonormal basis, from a QR of Aᵀ, has κ(Z) = 1 exactly and is dense — 100 per cent of its entries are nonzero. The fundamental basis built on the first 4 columns has κ(Z) = 1.994·10⁸, and its reduced Hessian comes out at 3.801·10¹⁶, which is κ(Z)² to within a factor of 0.956 — the square attained rather than bounded. Its answer is wrong by 0.05179, against 1.07·10⁻¹⁵ for the orthonormal one. Choosing the same kind of basis by pivoting instead gives κ(Z) = 2.06, an error of 6.71·10⁻¹⁶, and the same 50 per cent density: all of the sparsity and none of the loss.

show: "fill-frontier", spread: 10000

The arguments are the ones Long loops pay before the factor starts passes. A value nobody placed would be a picture no essay asked for and no claim was ever checked against.

On a 10 by 10 network with resistances over four decades: the conditioning of the loop equations against the work of their Cholesky factor, for seven spanning trees, and the node equations beside themMedian over five draws of the resistances. Conditioning after scaling to a unit diagonal; work as the sum over pivots of the squared column count under minimum-degree ordering. least resistance: κ 12.5, work 16913; bands of 0.25 decades: κ 15.8, work 18939; bands of 0.5 decades: κ 18.7, work 19612; bands of 1 decade: κ 42.0, work 17628; bands of 2 decades: κ 504, work 14046; bands of 3 decades: κ 117, work 8782; breadth-first: κ 2.48e+3, work 8547; the node equations: κ 6.96e+3, work 5111.medians, five drawsleast tree: work ÷ breadth-first2breadth-first: κ ÷ least tree198node equations: κ ÷ least tree555050001000015000200002500010¹10²10³10⁴10⁵work of the Cholesky factorκ after unit-diagonal scalingβ 1β 2β 3node equationsleast resistancebreadth-firstβ: band width in decades, Kruskal on banded resistancesthe work is paid early

Median over five draws of the resistances. Conditioning after scaling to a unit diagonal; work as the sum over pivots of the squared column count under minimum-degree ordering. least resistance: κ 12.5, work 16913; bands of 0.25 decades: κ 15.8, work 18939; bands of 0.5 decades: κ 18.7, work 19612; bands of 1 decade: κ 42.0, work 17628; bands of 2 decades: κ 504, work 14046; bands of 3 decades: κ 117, work 8782; breadth-first: κ 2.48e+3, work 8547; the node equations: κ 6.96e+3, work 5111.

show: "fill-matrix"

The arguments are the ones Long loops pay before the factor starts passes. A value nobody placed would be a picture no essay asked for and no claim was ever checked against.

The loop equations of two spanning trees of one 8 by 8 network, in minimum-degree elimination order, with the entries their Cholesky factor fills inbreadth-first: 49 loops, 613 nonzeros in the loop matrix, factor 376 entries, work 3124; least resistance: 49 loops, 931 nonzeros in the loop matrix, factor 505 entries, work 6161. Blue: entries of the loop matrix; red: fill.breadth-first613 nonzeros, 45 fill entries a triangle, work 3124least resistance931 nonzeros, 15 fill entries a triangle, work 6161blue: the loop matrix · red: filllong loops couple more loops

breadth-first: 49 loops, 613 nonzeros in the loop matrix, factor 376 entries, work 3124; least resistance: 49 loops, 931 nonzeros in the loop matrix, factor 505 entries, work 6161. Blue: entries of the loop matrix; red: fill.

show: "fill-loops"

The arguments are the ones Long loops pay before the factor starts passes. A value nobody placed would be a picture no essay asked for and no claim was ever checked against.

The length of every fundamental loop of two spanning trees of one 10 by 10 network, sorted from longest to shortestbreadth-first: 81 loops, mean 7.31 arcs, longest 12, median 8; least resistance: 81 loops, mean 11.46 arcs, longest 42, median 6.81 loops eachbreadth-first: mean arcs7.3least resistance: mean arcs11020406080010203040loop, longest firstarcs in the loopbreadth-firstleast resistanceevery loop has at least four arcs on a gridthe light arcs make long loops

breadth-first: 81 loops, mean 7.31 arcs, longest 12, median 8; least resistance: 81 loops, mean 11.46 arcs, longest 42, median 6.

show: "fill-sizes"

The arguments are the ones Long loops pay before the factor starts passes. A value nobody placed would be a picture no essay asked for and no claim was ever checked against.

The work of the least-resistance tree's loop-equation factor over the breadth-first tree's and over the node equations', against the size of the grid, resistances over four decades4 by 4: over breadth-first 1.22 (1.07 to 1.48), over the node equations 0.75 (0.65 to 0.91); 6 by 6: over breadth-first 1.56 (1.27 to 1.93), over the node equations 1.57 (1.29 to 1.95); 8 by 8: over breadth-first 1.44 (1.05 to 1.97), over the node equations 2.00 (1.47 to 2.75); 10 by 10: over breadth-first 1.98 (1.34 to 3.08), over the node equations 3.31 (2.24 to 5.15); 12 by 12: over breadth-first 1.78 (1.50 to 2.27), over the node equations 3.80 (3.21 to 4.86). Median and range over five draws.least tree's factor workover the nodes, 4 × 40.75over the nodes, 12 × 123.846810120123456grid, k by kwork ÷ the other formulation'sover breadth-first loopsover the node equationsdashed: equal workthe loops lose ground as the grid grows

4 by 4: over breadth-first 1.22 (1.07 to 1.48), over the node equations 0.75 (0.65 to 0.91); 6 by 6: over breadth-first 1.56 (1.27 to 1.93), over the node equations 1.57 (1.29 to 1.95); 8 by 8: over breadth-first 1.44 (1.05 to 1.97), over the node equations 2.00 (1.47 to 2.75); 10 by 10: over breadth-first 1.98 (1.34 to 3.08), over the node equations 3.31 (2.24 to 5.15); 12 by 12: over breadth-first 1.78 (1.50 to 2.27), over the node equations 3.80 (3.21 to 4.86). Median and range over five draws.

show: "fill-tree", beta: 1

The arguments are the ones Long loops pay before the factor starts passes. A value nobody placed would be a picture no essay asked for and no claim was ever checked against.

A spanning tree of a 10 by 10 resistor network chosen by bands of 1 decade, with its longest loopResistances drawn over four decades; tree arcs dark, thicker for lighter resistance, off-tree arcs faint, and the longest fundamental loop in red, 34 arcs. Mean loop length 9.60 arcs; the loop matrix has 1987 nonzeros, its Cholesky factor 1076 entries and 17628 units of work; κ after scaling 45.2.bands of 1 decademean loop, arcs9.6longest loop, arcs34factor work1.8·10⁴κ, scaled45red: the longest loop the tree makesthe tree follows the light arcs

Resistances drawn over four decades; tree arcs dark, thicker for lighter resistance, off-tree arcs faint, and the longest fundamental loop in red, 34 arcs. Mean loop length 9.60 arcs; the loop matrix has 1987 nonzeros, its Cholesky factor 1076 entries and 17628 units of work; κ after scaling 45.2.

What it checked while drawing

Every figure above checked its own claims on the way to being drawn, and a claim that failed would have stopped the picture rather than shipped a wrong one. Those checks used to leave no trace at all: a passing one returned true and the only evidence the figure had checked anything was that nothing crashed. The list below is what they actually said, collected by running this generator with an observer installed — not a description of what it is believed to check.

29 distinct claims across 6 sets of arguments, grouped below by shape — because most of them are one sentence with a different number in it, and how many separate times that sentence was put to the test is the informative part.

a badness the double can hold

a band width the dial draws

a band width the family is drawn at

a basis rule this file implements

a constraint no larger than the problem

a finite double, since an infinity is not a rational

a grid the dense condition numbers can afford

a measure this view draws

a problem the exact solve can afford

a set of arcs with no loop in it

a spread of resistances the double can hold alongside its sums

a spread the family is measured at

a tree rule this file implements

a tree with one arc fewer than the nodes

a view of a network's loop basis this figure draws

and pivoting improves on the naive choice

and the node equations harder, by iterations

and the node equations harder, by scaled

every loop of the least-resistance tree has its own arc as its heaviest

fewer constraints than unknowns

fewer constraints than unknowns, so something is left to minimise

LU is for square matrices

matmul shapes agree

the least-resistance loops get easier as the resistances spread, by iterations

the least-resistance loops get easier as the resistances spread, by scaled

the least-resistance tree conditions the loop equations best once the resistances spread

the orthonormal basis has condition number one exactly

the scaled loop equations on the least-resistance tree stay under ten at every size once the resistances spread

while the fundamental bases are the sparse ones

Against the rule

It draws a decomposition and prints its residual. It calls basisComparison, and every figure above carries the badge — which residualcheck verifies by looking for it in the emitted SVG rather than by finding the call that builds one. A badge that is constructed and then left out of the body is the failure that check exists for.

Across the library: the rule bites on 217 of 397 generators — 199 print a residual and 18 are exempt with a published reason; 180 factorise nothing. Read from lib/residual-rule.js, which is the same body the gate enforces from, and the gate's last check fails the build if this page and it disagree about any generator.

Where it is called

Changing this generator changes every figure on this list. That is what makes the list worth publishing rather than keeping in a check script.

Orthogonality, measured

Long loops pay before the factor starts

The least-resistance spanning tree makes a network's loop equations well conditioned and its loops long, and the question left was what a direct solver pays for the length, and whether a tree reading the resistances only coarsely buys the conditioning back for less. Counted symbolically under minimum-degree ordering, the least tree's factor costs a median 1.2 to 2.0 times the breadth-first tree's on grids of 4 to 12 points a side, and the loop formulation goes from cheaper than the node equations at 4 × 4 to 3.8 times dearer at 12 × 12, for a conditioning two to three orders better. The price is paid in the loop matrix itself: on every network measured its factor fills in fewer entries than the breadth-first tree's. And no tree between them is a bargain. Kruskal on resistances rounded into bands pays nearly all the extra work until one band holds three quarters of the spread, and by then the conditioning has gone too.

Orthogonality, measured

Spread resistances make the loops easy

Scaled to a unit diagonal, the loop equations on the least-resistance tree get easier as a network's resistances spread — from 120 to 5.44 over six decades — and stop depending on the grid's size, while the node equations of the same flow get harder, from 538 to 4.6·10⁴. The spread that ruins the range-space formulation rescues the null-space one, though the loops' density means the work saved is a factor of two, not the factor of nine the iteration counts suggest.

Orthogonality, measured

The basis nobody chose on purpose

A method that eliminates a constraint has to pick a basis for its null space, and every basis is correct. Their condition numbers are eight orders apart, the reduced problem inherits the square, and the choice is usually made by a one-line rule nobody thought of as a numerical decision.

Orthogonality, measured

The tree the resistances choose

On a network every basic set is a spanning tree and every null-space basis is a set of loops with entries 0 and ±1, so no tree can make Z badly conditioned. The tree with the best-conditioned Z still gives loop equations 4.8 times worse than the tree of least resistance: the basis has to be chosen against the Hessian, and pivoting finds it only when it pivots on the resistances too.

The whole library · All essays · What must fail