Shannon Coding Calculator

Generate Shannon coding for a set of symbols based on their probabilities.

This page exists due to the efforts of the following people:

Timur

Timur

Created: 2019-03-29 06:20:13, Last updated: 2023-05-27 13:18:36

Using the calculator

To generate Shannon coding for a set of symbols, enter the symbol probabilities in the "Symbols probability table" by specifying the name and corresponding value (probability). Once you've entered the probabilities, click the "Calculate" button.
The calculator will determine the weighted path length, Shannon entropy, and display the Shannon coding table.

PLANETCALC, Shannon coding

Shannon coding

Symbols probability table

NameValue
Items per page:

Digits after the decimal point: 2
Weighted path length
 
Shannon entropy
 
The file is very large. Browser slowdown may occur during loading and creation.

Shannon Coding

Shannon coding, developed by Claude Shannon, is a lossless data compression technique that constructs a prefix code based on a set of symbols and their probabilities. Unlike Huffman coding, Shannon coding does not achieve the lowest expected codeword length, but it provides an efficient encoding scheme.

In Shannon coding, the symbols are sorted in order of probability, and codewords are assigned based on the binary expansions of the cumulative probabilities. The number of bits used for each symbol's codeword is determined by the formula: l_{i}=\left\lceil -\log_{2}p_{i}\right\rceil, where l_{i} represents the number of bits and p_{i} is the cumulative probability of the symbol. \lceil \dots \rceil denotes the ceiling function (which rounds x up to the next integer value)

By using the calculator, you can easily generate Shannon coding for a set of symbols and explore the weighted path length, Shannon entropy, and corresponding codewords.

URL copied to clipboard
PLANETCALC, Shannon Coding Calculator

Comments