Home▸Computer Science▸Shannon Source Coding: Symbol Probabilities, Huffman Codewords and Entropy Bound (2D)

Shannon Source Coding: Symbol Probabilities, Huffman Codewords and Entropy Bound (2D)

A top view of the encoder with symbol-probability bars, the Huffman codeword of every symbol and the live encoded stream, plus charts of entropy against average code length and the effect of block extension. Same shared model as the 3D scene.

Computer Science2DModerate60 FPS📱 Mobile-adapted🟠 Blender⇄ 3D version
Shannon Source Coding: Symbol Probabilities, Huffman Codewords and Entropy Bound (2D) ↗ Open standalone

Build a symbol source and watch the best prefix code for it. Choose the alphabet size and how skewed the probabilities are (Zipf-like), and the Huffman algorithm assigns short codewords to common symbols and long ones to rare symbols. A stream of sampled symbols is encoded live; its measured bits per symbol converges to the exact Huffman average length, which always sits between the entropy H and H + 1. Block extension shows how coding pairs and triples closes the gap. A Blender-built encoder and numerical checks are included.

⚙ Under the hood

A top view of the encoder with symbol-probability bars, the Huffman codeword of every symbol and the live encoded stream, plus charts of entropy against average code length and the effect of block extension. Same shared model as the 3D scene.

Shannon EntropyHuffman CodingSource CodingKraft InequalityInformation Theory

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)