Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In your particular example, you are doing the computation on the free algebra on ax,ay,az,b over the polynomial ring on px,py,pz,m.

sage: R.<px,py,pz,m>=QQ[]
sage: F.<ax,ay,az,b>=FreeAlgebra(R)
sage: (ax*px+ay*py+az*pz+m*b)^2
px^2*ax^2 + px*py*ax*ay + px*pz*ax*az + px*m*ax*b + px*py*ay*ax + py^2*ay^2 + py*pz*ay*az + py*m*ay*b + px*pz*az*ax + py*pz*az*ay + pz^2*az^2 + pz*m*az*b + px*m*b*ax + py*m*b*ay + pz*m*b*az + m^2*b^2