diff --git a/notes/ANS Theory.md b/notes/ANS Theory.md index 0c70945..fd1f52c 100644 --- a/notes/ANS Theory.md +++ b/notes/ANS Theory.md @@ -17,4 +17,20 @@ Arithmetic coding works by taking a stream of data, and converting it into an in For example, the probability of a coin flip resulting in tails is 50%, and the probability of a coin flip resulting in heads is 50%. The probability of a coin flip resulting in heads *or* tails is %100. -If we wanted to keep track of the result of a series of coin flips, this could be done by subdividing a range. If the coin flip is between $0$ and $0.5$, then we know that the first flip must +If we wanted to keep track of the result of a series of coin flips, this could be done by subdividing a range. If the coin flip is between $0$ and $0.5$, then we know that the first flip must have been tails. + +If the coin flip is between $0.5$ and $1$, then we know that the first flip must have been heads. + +This subdivision process can be repeated infinitely to store an infinite number of coin flips by dividing each range again. + +To store two coin flips, you might have the first subdivision represent the outcome of the first coin flip, and the second subdivision represent the outcome of the second coin flip: + +| Range | Result | +| ------------- | ------------ | +| $0.00 - 0.25$ | Tails, Tails | +| $0.25 - 0.5$ | Tails, Heads | +| $0.50 - 0.75$ | Heads, Tails | +| $0.75 - 1.00$ | Heads, Heads | +Imagine a situation where we want to store the coin flip *Heads, Heads, Tails*. +1. First we subdivide the range by the probability of each event happening. The probability of each is 50%, so that's simple. +2. We know that the r \ No newline at end of file