Math 480 - Homework 5
Due ...

As usual, write in your diary as you do the following exercises. TeX submission required.

  1. Install Mathematica on your computer (it's free for UMB students - find out how to get it).

  2. Write a Python function that accepts a list (or other iterable) of key-value pairs where the value is numeric (actually, in our application, a positive integer). The program should return a new list with the values scaled so that they sum to 1.

    Test your function by calling it on a letter frequency table for a text, to convert counts to fractions.

  3. (WRONG QUESTION!) This is what I first asked for:
    Write a Python function that accepts a list (or other iterable) of key-value pairs where the value is numeric. The program should create a histogram of the data.

    Test your function. Paste the graphic into your TeX document.

    stackoverflow.com/questions/11617719/how-to-plot-a-very-simple-bar-chart-python-matplotlib-using-input-txt-file

  4. In encoding and decoding we deal with partial permutations of the alphabet - a list (or dictionary) of key-value pairs where the keys are (lower case) letters of the alphabet and the value corresponding to a key is the letter that replaces it.

    For encoding the permutation will mix up the whole alphabet. For decoding you'll want to see what the text looks like with a partial replacement - perhaps changing the most frequent letter to an e. In that case you might want to have the output an upper case E so you can see which letters you've tried to guess so far.

    Write and test the Python function

    def scramble( input, output, permutation, encode=True ):
        """ input is a text file (maybe with spaces and
            punctuation), output is a text file with some letters
            replaced by lookup in the permutation dictionary.
    
           If encode==True then output should be all lower case. 
           If encode==False then input should be converted to lower
               case and output transformed letters should be upper case."""
    

  5. (Not yet specified) Think about creating digraph frequency tables, and using them to help decode. Should a digraph table be a dictionary with string keys "xy" or tuple keys (x,y) or perhaps a two dimensional matrix with characters for row and column indices.

  6. Here are some files of messages to decode ...