import numpy as np def commute(a, b): ab = np.dot(a, b) ba = np.dot(b, a) com = ab - ba return com