Entropy measures uncertainty in a probability distribution. It is also a useful diagnostic for how spread out a modeled distribution has become. The value belongs to a declared set of outcomes, weighting rule, and logarithm base; without those, a single entropy number has no stable interpretation.
Think like a programmer
Compute entropy from a normalized immutable distribution. Validate a non-empty nonnegative probability array and total one before calling the reducer; otherwise entropy is an attractive but meaningless number. Derive distributions from counts with a separate checked normalization stage, then keep outcome labels and base units with the result.
Model checklist
Inputs
Outcome labels, probability or count array, normalization policy, logarithm base, zero-probability convention, and ensemble/window metadata.
Normalize counts if needed; omit the zero times log zero limit; sum negative probability times logarithm under the declared base.
Output
Information uncertainty with units/base, normalized distribution, and validation status.
Check
Probabilities sum to one; a certain outcome contributes zero; a uniform distribution maximizes entropy over the same finite outcome support; malformed/empty distributions are rejected; reordering outcomes does not change entropy.
\[H=-\sum_i p_i\log_2p_i\]
The base-two convention reports bits. A distribution [1, 0] has H = 0 because no outcome is uncertain, while [0.5, 0.5] has H = 1 bit. Zero-probability outcomes contribute zero through the limiting rule p log p → 0; code should handle them deliberately rather than attempting log(0). A normalization helper turns nonnegative counts into probabilities only when their total is positive.
Entropy does not tell you what the outcomes mean or whether a process is thermodynamically irreversible. Coarse-graining can make a macrostate distribution appear more spread out because the representation discarded detail. To compare two entropy results, retain the outcome definition, binning, time window, weighting/ensemble rule, and log base; changing any of these can change the value without changing the underlying physical microstate stream.
Try this experiment
Prediction: Two equally likely outcomes contain one bit of uncertainty.
Write validation for a malformed distribution before computing entropy.
Where this model breaks
Information entropy and thermodynamic entropy use related mathematics but have different units and physical context. Do not swap them without explaining the mapping, Boltzmann constant, and ensemble. Finite samples, biased samplers, changing bins/outcome labels, correlated data, and unknown weights can make a plug-in entropy estimate unreliable.
Summary
Entropy is a tested reduction over a valid distribution. State outcomes, normalization, units/log base, window, and interpretation, then distinguish a changed summary representation from a demonstrated physical entropy process.
Glossary
Shannon entropy: information uncertainty measured in bits with base-two log.
Distribution: probabilities over outcomes.
Normalization: forcing probabilities to sum to one.
Self-check
What does a certain outcome contribute?
Which distribution maximizes entropy here?
Why validate before reducing?
Sources
C. E. Shannon, A Mathematical Theory of Communication.
Model contract
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
Quantities you set or measure, with units and useful bounds.
State
Values the program must retain to reproduce the next result.
Rule
The relationship or update that turns inputs and state into a result.
Check
A known limit, unit check, invariant, or measured result that can expose a bad model.
Implement the idea as a model
For Entropy as Information, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Entropy and the Second Law, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Guided experiment
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
Where this model breaks
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Summary
Treat Entropy as Information as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Glossary
Input: a measured value or chosen parameter supplied to a model.
State: the smallest set of values needed to continue or reproduce a model.
Validation: comparing an output with a known result, limit, invariant, or measurement.
Self-check
Which values are inputs, and which values must remain state?
What observable result would tell you the model is behaving as expected?
Which assumption would you test first before applying the model to a real system?
Model review: turn Entropy as Information into a test
Compute information entropy from validated probability distributions and document its units and meaning.
Name the inputs and units that the entropy and the second law model needs.
Separate the state you must keep from values you can calculate when needed.
Write one rule that maps the current state and inputs to an observable result.
Choose a limiting case, unit check, invariant, or known result before trusting an output.
State one assumption you would change before using this simplified model for a real decision.