exec( open("timmy.py").read() ) from sympy import init_printing, Matrix, MatMul, latex from IPython.display import Math init_printing() P = Matrix([[0, 1, 0],\ [1, 0, 0],\ [0, 0, 1]]) A = Matrix([[0, 4, -2],\ [4, 8, 6],\ [6, -4, 2]]) new = P * A Math( "$$" + latex( MatMul( P, A ), mat_str = "array" ) + "=" + latex( new, mat_str = "array" ) + "$$" )