Functions for A3.tcl
Cleanup. Pobabilities are calculated in log-space. BUGGY. Normalization does not work.