add solve method

Document more difficult to understand parts of the code.

Set NumPy to ignore division by zero errors (restore when done solving).