GenerateRandomSearch

Condition Number Generator

Some questions are difficult to answer accurately no matter how carefully you calculate. When two equations say almost the same thing, their solution sits where two nearly parallel lines cross, and a tiny nudge to either slides that crossing a long way. The condition number puts a figure on exactly how far — and the important part is that no amount of extra precision helps, because the difficulty is in the question rather than the arithmetic.

What this generator does

Builds a system of equations, optionally with one equation nearly a repeat of another, solves it, and computes the condition number exactly. It also nudges the right-hand side in sixty different directions and reports the worst amplification actually observed, which must fall within the bound.

How to use this tool

  1. Choose how many equations, and whether to make the system sensitive.
  2. Read the condition number: it bounds how much a relative error can be magnified.
  3. Compare the sensitive and well-behaved cases — they differ by orders of magnitude.
  4. Note that the answer is exact either way; what changes is how much you should trust it.

Understanding the controls

How many equations
Between 2 and 5. Larger systems have more scope for two equations to nearly coincide.
Make it sensitive
Builds one equation as a nudged near-copy of another. It must be nudged rather than an exact multiple — an exact multiple has no unique answer at all, which is a different problem from a sensitive one.
Seed
Any word reproduces exactly the same system and the same answer.

Common use cases

  • Understanding why a linear solve produces implausible answers
  • Teaching numerical stability with a measurable quantity
  • Generating well- and ill-conditioned test systems
  • Showing that precision cannot fix a badly posed question
  • Setting the same system twice from a seed

How this generator works

The condition number is computed rather than estimated by probing, because probing only finds the sensitivity if it happens to push in the sensitive direction — and a random nudge usually does not, which understates a sensitive system badly. Inverting the matrix a column at a time and taking the norms gives the worst case exactly. The measured amplification is reported alongside it and must never exceed it, which is checked.

Randomness and fairness

The coefficients and the perturbation directions are random; the condition number itself is an exact property of the resulting system. A seed reproduces the same system exactly and is therefore explicitly not cryptographically secure. Without a seed the browser's cryptographically secure generator is used.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • The infinity-norm condition number, which is standard and cheap. The version based on singular values gives a slightly different figure with the same meaning.
  • Systems whose answer would exceed a million are rejected as too extreme to display usefully.
  • Square systems with a unique answer only; over- and under-determined systems need least squares instead.
  • The measured amplification samples sixty directions and can still miss the true worst case — the computed condition number does not.
  • Systems are not stored between visits; seed one you want again.

Privacy and your data

The system, its answer and the condition number are computed in your browser. Nothing about them or your seed is transmitted or kept.