Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to manipulate equations with non-commuting symbols

Hi, I'm very new to sage so I'm not really sure if this is possible to do. For simplicity let's say I want to define an equation $$ D_1D_2\eta = \kappa\eta,\quad\kappa\in\mathbb{C}. $$ Then for the symbols $D_i$ all I want to do is define new symbols like $D_1 = D_x + iD_y$ and $D_2 = D_x - iD_y$, and insert this into the expression above and get sage to simplify it. If I had $D_i\in\mathbb{C}$, then this could I understand be done with the substitute command. However, the $D_i$ are such that $D_1D_2 \neq D_2D_1$.

Can I define D1 = var('D1', latex_name=r'D_1') in such a way that it will not commute when put into an expression for example by writing eq1 = D1*D2*eta == k*eta ?


Additional background

More specifically, $D_i$ are linear operators that act on functions $\eta : \mathbb{R}^3\mapsto\mathbb{C}$.

I understand FreeAlgebra somehow lets you define expressions based on non-commutative symbols, however I'm not very fluent in rings and abstract algebra so the language is a bit foreign to me. I tried to define

F.<eta,D1,D2> = FreeAlgebra(SR,3)
k = var('k', latex_name=r'\kappa')
eq1 = D1*D2*eta == I*eta*k

However, this just results in False. Not really what I wanted.