Coding Theory

Here we will talk about linear codes, and how to analize them using SageMath. As discussed in Dr. Andrew Misseldine's lecture, we are interested in block codes, which will allow us to encode messages, as well as decode them and detect and potentially correct any errors (up to a certain number). The code to create the necesary matrices and message spaces is shown below.

Now we create a Bernoulli class, which is a implementation of a Bernoulli distribution, which will then be used in conjunction with the SymmetricChannel class we define later, to introduce random errors into our transmitted messages. We chose the Bernoulli Distribution in this case because of our assumption that errors are uniformly distributed throughout the message, which in practice, is not accurate. For a discussion of how to deal with errors that tend to occur in bursts, rather than uniformly, we will need the assistance of Polynomial Codes, to be discussed later.

Here we go through an example of using the above classes to simulate transmitting a message through a Binary Symmectric Channel, which will introduce random errors into our message, then using our parity check matrix $H$ to detect and possibly correct such errors.

Run the cell above several times to see errors randomly appear in the recieved message, since our encoding matrix $G$ contains the identity, the first three bits of the recieved message are the original message, assuming no error has occured.