Have a textarea where the user can enter some text.
When a button is clicked, break the text into an array of letters and count the frequency (number of
occurrences) of each letter -- case insensitive. Disable the button. (Before breaking the text into
letters, eliminate spaces, puncuation, etc.)
Use JavaScript/jQuery to make an svg histogram showing the frequency of each letter.
Also calculate the information entropy -- the sum of - pi
log2(pi) where pi is the probability of the ith letter which we
will take to be its frequency divided by the number of letters. (The information entropy is the
number of bits conveyed by each letter.) See
http://nscraps.com/JavaScript/1017-how-calculate-log-base-102-javascript.htm to
see how to calculate the log base 2 of a number.
A check on your results is that the information entropy is less than or equal to the information
capacity which in this case is log2 (26) = 4.70044 bits/letter
Clear the histogram if the user changes the content of the textarea. Enable the button.
Using JavaScript/jQuery, make a horizontal bar chart of the state-capital population in thousands from
an SVG element, that is, divide the population by a thousand and then make a chart that shows the state
symbols going down the left of the SVG and have horizontal rectangles representing the state populations.