Fix bug in fpdiff when called as a python function

A global variable was leaking into the fpdiff function from the code
executed when fpdiff.py was run as a script. This global relative
difference variable was used instead of the relative difference parameter
passed into the fpdiff function.

Fixed this and moved the script code into a function to prevent global
variables leaking again.
Return true/false rather than error codes in fpdiff called as a python function

Error codes only really make sense in shell scripts.
In sumofmatrices add paranoid check and be more consistent with equation number types