Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
3

Symbolic simplificaction without commutativity

asked 11 years ago

akels gravatar image

updated 11 years ago

I would like to expand the expression:

(axpx+aypy+azpz+bm)2

where:

axayayaz

Or generally speaking the objects ax,ay,az,b are non-commutative for multiplication.

Preview: (hide)

3 Answers

Sort by » oldest newest most voted
3

answered 11 years ago

niles gravatar image

It sounds like you're looking for FreeAlgebra.

sage: R.<ax,ay,az,px,py,pz> = FreeAlgebra(QQ)
sage: R
Free Algebra on 6 generators (ax, ay, az, px, py, pz) over Rational Field
sage: (ax*px + ay*py + az*pz)^2
ax*px*ax*px + ax*px*ay*py + ax*px*az*pz + ay*py*ax*px + ay*py*ay*py + ay*py*az*pz + az*pz*ax*px + az*pz*ay*py + az*pz*az*pz
Preview: (hide)
link

Comments

The px,py,pz needs to be commutative.

akels gravatar imageakels ( 11 years ago )
1

answered 11 years ago

niles gravatar image

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
(az.pz)^^2+az.pz.ay.py+az.pz.ax.px+(ay.py)^^2+ay.py.az.pz+ay.py.ax.px+(ax.px)^^2+ax.px.az.pz+ax.px.ay.py

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).

Preview: (hide)
link

Comments

Nice work, Niles.

kcrisman gravatar imagekcrisman ( 11 years ago )
1

answered 11 years ago

mmarco gravatar image

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
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 11 years ago

Seen: 1,180 times

Last updated: Jan 10 '14