If you want to use the huffman program, here are some options. 1) Use it directly in a shell a) Type ~mackay/bin/huffman.p b) Type in a list of numbers, one per line 0.25 0.5 0.125 0.125 c) Then (on the next line) press CONTROL-d 2) Feed huffman.p with a list of numbers in a file. a) First make a list of numbers in a file. $ cat > myprobabilities 0.25 0.5 0.125 0.125 [Hit Control-d to stop writing to the file] [You can make this list of numbers in any way you want, using emacs, or a program, for example.] b) Use huffman.p thus: $ ~mackay/bin/huffman.p < myprobabilities The program will immediately run (no need to press control-d). 3) For your convenience, you may also give names to the different outcomes. For example a) $ cat > myprobabilities a 0.25 b 0.5 c 0.125 d 0.125 b) $ ~mackay/bin/huffman.p < myprobabilities The output from this example is: sorted characters c d a b codewords: a 0.25 2.0 2 00 b 0.5 1.0 1 1 c 0.125 3.0 3 010 d 0.125 3.0 3 011 total count 1 expected length 1.75 entropy 1.75 length / entropy 1 The 5th column lists the codewords. The other columns list the probabilities, log(1/p), and the assigned codeword lengths {l_i} NEW, December 2004: ------------------- If you would like the huffman codewords to be printed in an octave-readable format, you can use huffmano.p Usage: ~mackay/bin/huffmano.p < probs > codewords1 This produces a file that can be read with octave> load codewords1