ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

One-dimensional transport distance from cumulative sums

For probability distributions on a line, Wasserstein-1 distance is the integral of the absolute difference of their cumulative distributions. The function normalizes its input masses, computes cumulative sums, and returns their mean absolute difference. This…

Implementation mathematicsSource recovered; runtime not executed
Learn with the Atlas

Learn to read this model

Start with the symbols, follow the operations, and check what the result means.

Open guided lesson
gh-eq-f68d4a30514d35fasource-comment-equation
W1(P,Q)=∫∣FP(x)−FQ(x)∣dxW_1(P,Q) = ∫|F_P(x) - F_Q(x)|dx

Read the equation

For probability distributions on a line, Wasserstein-1 distance is the integral of the absolute difference of their cumulative distributions. The function normalizes its input masses, computes cumulative sums, and returns their mean absolute difference. This corresponds to a particular equal-grid scaling; physical support coordinates or grid spacing are not supplied.

Terms & definitions

TermMeaning in this source
P

First distribution

Q

Second distribution

F_P

First cumulative distribution

F_Q

Second cumulative distribution

How it works

Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.

Assumptions & limits

  • Nonnegative mass and nonzero totals are needed for valid input distributions.

Original context

Read the surrounding source passage
}

// ═══════════════════════════════════════════════════════════════════════════════
// OPTIMAL TRANSPORT EQUATIONS
// ═══════════════════════════════════════════════════════════════════════════════

// Wasserstein1D computes 1D Wasserstein-1 distance
// W_1(P,Q) = ∫|F_P(x) - F_Q(x)|dx
func Wasserstein1D(p, q []float64) float64 {
	if len(p) != len(q) {
		return math.Inf(1)
	}

	n := len(p)

	// Compute CDFs
	cdfP := make([]float64, n)
	cdfQ := make([]float64, n)
Exact original notation
W_1(P,Q) = ∫|F_P(x) - F_Q(x)|dx

Related builds

Sources & provenance

01
Go mathematical helpers
Lines 189–189 · 33aa84f2aa61
02
Go mathematical helpers
Lines 189–189 · 33aa84f2aa61

Search equations, builds, manuscript text, and recovered sources.