Skip to main content

SLOP8412 / Maths lab

One number.
More than one explanation.

A single score does not tell you what changed. Construct different explanations for it, then test what the number leaves out.

Experiment 03 / Between coordinates

The coordinates agree.
Their relationship does not.

Two identical marginal curves do not guarantee identical joint distributions. Change the correlation and watch what the coordinate-by-coordinate view misses.

Full 2D squared distance0.422291
Sum of marginal squared distances0.000000

Both marginal distances are zero, yet the full distance is positive. The difference is in covariance.

Define the relationship

Both means stay at (0, 0). Reference covariance ΣR = [[1, 0], [0, 1]].

Diagonal entries are variances. Off-diagonal entries are covariance and must match. Enter numbers, then apply. Matrix controls here are separate from the diagonal worksheet below.

ρ = covariance / √(variance 1 × variance 2). This control preserves both variances and edits the matrix. Try moving from +0.8 to −0.8.

Enable JavaScript to edit the matrix. Initial contours and scores remain visible.

Together / joint contours

━ R / reference┄ G / candidate

Reference circular contours and positively tilted candidate elliptical contours, at Mahalanobis radii 1 and 2.-6-6-3-3003366Coordinate 1Coordinate 2

Contours at Mahalanobis radii 1 and 2 enclose approximately 39% and 86% of each 2D Gaussian. Both axes stay fixed at −6 to 6; these are not sampled point clouds.

Separately / marginal curves

Each curve ignores the other coordinate. Dashed gold overlays solid blue when they agree.

Coordinate 1 of 2 Squared distance 0.000000

Coordinate 1: identical standard normal marginal densities.-606

Mean 0 for both. Reference variance 1; candidate variance 1.

Coordinate 2 of 2 Squared distance 0.000000

Coordinate 2: identical standard normal marginal densities.-606

Mean 0 for both. Reference variance 1; candidate variance 1.

Horizontal axes stay at −6 to 6. Vertical density scales adapt to variance; tails continue beyond view.

Why the full distance changes

The means are equal, so their contribution is zero. Since the reference covariance is the identity, the full squared distance reduces to D = (√λ₁ − 1)² + (√λ₂ − 1)², where λ₁ and λ₂ are the eigenvalues of ΣG.

Eigenvalues: 0.2, 1.8
Full D ≈ 0.422291
Marginal-only sum = 0

With both variances equal to 1, the eigenvalues are 1 − ρ and 1 + ρ (possibly in reversed order). Changing the sign of ρ flips the tilt but leaves the distance to the isotropic reference unchanged. This symmetry is specific to this reference; it is not a general rule for FID.

We evaluate the population Gaussian formula in floating-point arithmetic, not image-based FID. The sum of marginal distances omits cross-coordinate covariance and is not generally the full distance. The editor accepts positive-definite matrices with variances from 0.05 to 4 and |ρ| ≤ 0.98; degenerate limits are excluded.

Experiment 02 / Equation-driven worksheet

Write the construction.
Interrogate the number.

Different causes can collapse to the same score. Write a constraint, find its solutions, then inspect what each solution changes.

Keep the spread fixed. Which two means give a squared distance of 4?

Your definitions

01 / INPUT

Edit a parameter or expression. Definitions recalculate together; each name is defined once. Ctrl / ⌘ + Enter runs immediately. Tab leaves the editor.

Enable JavaScript to edit and solve locally. The initial construction is shown below.

Language and numerical limits

This is a bounded maths language, not Python or a general proof assistant. It uses no runtime downloads or backend.

  • + - * / ^, parentheses, sqrt(x), abs(x) and pi. Write multiplication explicitly.
  • Normal(mean=…, sd=…) takes scalars or equal-length vectors. Vectors mean independent coordinates, with diagonal covariance. No full covariance matrices or broadcasting.
  • distance(R, G) computes squared Gaussian W₂ distance. R and G are required; other names are yours.
  • solve D = 4 for m holds other independent parameters fixed and follows dependent definitions. Define m first. The equation must expand to a polynomial of degree at most 2 in m; variable denominators and symbolic square roots are unsupported.
  • check D = guess compares numbers at the current construction, with relative tolerance 10⁻⁹. Agreement is not proof of an identity.
  • Up to 16 dimensions, 100 lines and 12,000 characters. Each coordinate requires |mean| ≤ 1000 and 0.01 ≤ sd ≤ 1000. Algebra uses floating-point coefficients; displayed decimals are rounded.

The resulting construction

02 / OUTPUT

Squared Gaussian distance(R, G)

2.5

1 dimension
Population calculation
Not image-based FID

● R / reference● G / candidate

Gaussian marginal probability densitiesReference mean 0 and standard deviation 1; candidate mean 1.5 and standard deviation 1.5. The horizontal and vertical axes adapt to the construction.-4.50-1.501.504.507.50

Density vs feature coordinate. Both axes adapt; Gaussian tails continue beyond view.

Contribution of each coordinate to the total
CoordinateMean²SD difference²Sum
12.250.252.5
Show computation and current values

For diagonal covariance, D = Σᵢ [(μR,ᵢ − μG,ᵢ)² + (σR,ᵢ − σG,ᵢ)²]. These σ values are standard deviations. Off-diagonal covariance is not represented.

m = 1.5
s = 1.5
D = 2.5

Solutions and challenges

03 / REASONING

The initial constraint reduces to m² − 3.75 = 0. There are two means: approximately −1.9364917 and +1.9364917. Enable JavaScript to apply either solution.

The equation is the source of truth: applying a solution edits its parameter above. Nothing is uploaded. Your last valid worksheet is saved in this browser when storage is available; clear it with .

Guided construction / the original drag-and-compare experiment

This separate experiment keeps R fixed at N(0, 1). Its sliders and pins do not change your worksheet.

Experiment 01 / Gaussian distance

Different constructions. One score.

— R · reference— G · candidate

Reference and candidate Gaussian densitiesReference mean zero, standard deviation one. Move the circular mean handle or square spread handle. Sliders and number fields below provide the same controls.Probability density · vertical scale adjusts0.000.110.230.340.46-8-4048Feature coordinate · fixed horizontal scale (tails continue beyond view)

Density vs feature coordinate. Vertical scale adjusts; horizontal scale stays fixed. Tails continue beyond view.

Drag the circle to move the mean; drag the square to change the spread. Focus either handle and use arrow keys for small steps.

R: μ = 0, σ = 1 G: μ = 1.5000, σ = 1.5000, variance = 2.2500

Squared Gaussian distance · D

2.5000

Target 4.0000 Residual D − 4: −1.5000

Mean contribution · μ²
2.2500
Spread contribution · (σ − 1)²
0.2500

Free mode: −3 ≤ μ ≤ 3; 0.25 ≤ σ ≤ 3.5. σ is standard deviation, not variance.

D = μ² + (σ − 1)²= (1.5000)² + (1.5000 − 1)² = 2.5000

Enable JavaScript to manipulate the construction. The initial values and curves remain readable.

Compare your constructions

Pin up to two constructions. Their curves and decomposed scores stay visible while you explore.

Hints and a worked pair
  1. Match the spread first: set σ = 1. Which means give D = 4?
  2. Match the mean instead: set μ = 0. Find a positive standard deviation giving D = 4.
  3. Try (μ, σ) = (2, 1) and (0, 3). Both give 4, but for different reasons. Pin them and compare.

Keep-score mode follows σ = 1 + √(4 − μ²), with −2 ≤ μ ≤ 2. It deliberately explores the σ ≥ 1 branch; it does not enumerate every positive-σ solution.

What have you established?

Equal scores need not have equal explanations. A displacement in the mean and a change in spread can contribute the same amount. Your constructions demonstrate that ambiguity; they do not establish which distribution a person would prefer.

Return to Week 2: The Fréchet distance for the multivariate derivation, or use the Python workspace to investigate what changes when moments must be estimated.

All controls run locally in your browser. This lab makes no runtime downloads and has no backend. The worksheet saves its last valid definitions locally; guided constructions and pins last until you leave or refresh the page.