Ask Your Question

Revision history [back]

If FreeAlgebra doesn't provide what you're looking for, note that Maxima also implements noncommutative symbolic algebra, and you can access it from sage with, e.g., the maxima command:

sage: e = maxima('expand((ax . px + ay . py + az . pz)^^2);')
sage: e

Note that this uses Maxima's syntax, which is generally different from Sage's. You can read more about it starting here (SO) or here (Maxima manual).