| 1 | initial version |
You can define a function as shown in the comments.
Alternatively you can substitute into a noncommutative polynomial, e.g.:
R.<x,y,z> = FreeAlgebra(QQ, 3)
f = (x*y - y*x)*z # not zero
A = Matrix(QQ, [[0,1],[0,0]])
B = Matrix(QQ, [[1,1],[1,1]])
C = Matrix(QQ, [[0,-1],[-1,0]])
f.subs({x: A, y: B, z: C})
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.