Readability cleanup on helper_functions.
Readability cleanup on helper_functions.

It's in a pretty readable state at this point. There are a few unexplained
constants, some division and order-of-operations bugs to tackle in the next
change, and the tree-related functions that I haven't taken any time to
understand. For building test cases, I'll focus on the functions that clearly
have bugs, but it's not like I have the expertise to know whether equations
are right or anything like that.

PandaStabber/Goldberg_et_al_2016,PandaStabber/Goldberg_et_al_2016,PandaStabber/Goldberg_et_al_2016,PandaStabber/Goldberg_et_al_2016