Issue 16 (part 2)

Fixes #16,

I made a horrible mess of the previous PR, including an accidental push to master and closing of the original issue 16 PR.  I reverted the changes in master, re-did the changes in the branch seanmason-issue-16, and created this new PR.

See the original PR here:
https://github.com/stepthom/math-fun/pull/31