change hamiltonian test to use math helper, and warn against use of ^ which is confusing because of associativity/precedence