edits to enable python 2 and 3 simultaneous compatibility

After this change, the tests pass and figures are created in both python 2.7 and 3.3.

Changing the division rule will create bugs if there is any integer division. I looked pretty carefully for integer division, and I couldn't find any. So hopefully everything is OK!

Switching xrange(N) to range(N) makes negligible difference in performance or memory for Python 2 for small N (at least up to 10,000 or so).

"raise E,V" is the same as "raise E(V)" in Python 2, but only the latter is legal in Python 3.