Refactored mat_inv_mul into separate function

mat_inv_mul has been moved to functions.py. Test has been moved
to test_functions.py. KanesMethod and LagrangesMethod classes
have been modified to reference this function. Link for inv() method
has been added into the docstrings of rhs() in both these classes.