ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Shannon entropy with truncated small probabilities

The mathematical entropy sums −p log p over a normalized nonnegative distribution, with a zero contribution at p=0. The function uses log₂, so its output is in bits, but skips probabilities at or below EPSILON_PHI and near one. It does not validate normalization,…

Implementation mathematicsSource recovered; runtime not executed
Learn with the Atlas

Understand information

Learn to distinguish probabilities, logarithm conventions, and information quantities.

Open guided lesson
gh-eq-1e35bd0fc55c952csource-comment-equation
ShannonEntropycomputesH(X)=−Σp(x)logp(x)ShannonEntropy computes H(X) = -Σ p(x) log p(x)

Read the equation

The mathematical entropy sums −p log p over a normalized nonnegative distribution, with a zero contribution at p=0. The function uses log₂, so its output is in bits, but skips probabilities at or below EPSILON_PHI and near one. It does not validate normalization, making it a truncated entropy calculation whose input assumptions matter.

Terms & definitions

TermMeaning in this source
p

Probability masses

H

Entropy in bits

EPSILON_PHI

Approximately 0.001618 cutoff

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

Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.

Original context

Read the surrounding source passage
	return -float64(n*(n-1)) * PHI * 0.5 / float64(n*n)
}

// ═══════════════════════════════════════════════════════════════════════════════
// INFORMATION THEORY EQUATIONS
// ═══════════════════════════════════════════════════════════════════════════════

// ShannonEntropy computes H(X) = -Σ p(x) log p(x)
func ShannonEntropy(probs []float64) float64 {
	h := 0.0
	for _, p := range probs {
		if p > EPSILON_PHI && p < 1.0-EPSILON_PHI {
			h -= p * math.Log2(p)
		}
	}
	return h
}
Exact original notation
ShannonEntropy computes H(X) = -Σ p(x) log p(x)

Related builds

Sources & provenance

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

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