mercurial.core.entropy module

Generalized entropy calculations for patterns (MERCURIAL A.8).

class mercurial.core.entropy.GeneralizedEntropy(beta_info: float = 1.0, beta_therm: float = 1.0, beta_ph: float = 1.0)[source]

Bases: object

Implements S_gen from Definition 1.6.

Methods

compute(info_entropy, therm_entropy, ph_disorder)

S_gen = β_info * I + β_therm * S_therm + β_ph * S_ph.

from_pattern(pattern)

Compute S_gen directly from a Pattern object.

compute(info_entropy: float, therm_entropy: float, ph_disorder: float) float[source]

S_gen = β_info * I + β_therm * S_therm + β_ph * S_ph.

from_pattern(pattern: Pattern) float[source]

Compute S_gen directly from a Pattern object.

mercurial.core.entropy.phenomenological_disorder(pattern_coherence: float) float[source]

Phenomenological disorder measure (0 = fully ordered, 1 = fully disordered). pattern_coherence ∈ [0,1] (1 = maximal coherence).

mercurial.core.entropy.shannon_entropy(probabilities: ndarray, base: float = 2.0) float[source]

Shannon entropy H = -Σ p_i log(p_i).

Parameters:
probabilitiesarray

Probability distribution (must sum to 1).

basefloat

Logarithm base (2 for bits, e for nats).

Returns:
float

Entropy in chosen units.

mercurial.core.entropy.thermodynamic_entropy(energy_distribution: ndarray, temperature: float) float[source]

Thermodynamic entropy S_therm = (U - F)/T. Here we approximate from energy distribution variance.