← 💻 Computer Science

📊 Entropy Lab

Show code-length bars
Animate bitstream
Entropy H:
Avg code length L:
Fixed-length bits:
Redundancy L−H:
FPS:
Drag — rotate · Scroll — zoom

📊 Shannon Entropy Lab

An interactive 3D symbol-frequency histogram where reshaping a source's probability distribution computes the Shannon entropy live and shows it as the hard floor beneath any compression scheme.

🔬 What It Demonstrates

Each pillar's height is a symbol's probability; the translucent overlay is the optimal code length Shannon's theorem predicts for it. The glowing ring marks entropy H — and the streaming bins below race entropy coding against naive fixed-length coding to show the bits actually saved.

🎮 How to Use

Pick an alphabet size, drag the skew slider to make the distribution more lopsided, or hit Randomize for a fresh draw. Watch H fall as one symbol comes to dominate, and watch the entropy-coded bin fill slower than the fixed-length one.

💡 Did You Know?

A uniform distribution has maximum entropy and cannot be compressed at all — every symbol is equally surprising. Real text, images and audio are far from uniform, which is exactly why ZIP, JPEG and MP3 work.