Solve matrix equations in python.