Ask Your Question

How to manipulate equations with non-commuting symbols

asked 2021-06-22 21:14:20 +0100

9cco gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-06-24 10:19:22 +0100

9cco gravatar image

I think I was 90% of the way to the answer. Instead of defining equations by eq = pol1 == pol2, I simply defined pol1 and pol2 as separate variables as

var('k1', latex_name=r'\kappa_1')
var('k2', latex_name=r'\kappa_2')
var('k3', latex_name=r'\kappa_3')
var('k4', latex_name=r'\kappa_4')    
F.<eta_x,eta_y,D_x,D_y> = FreeAlgebra(SR,4)

pol1 = (k1*D_x^2 + k2*D_y^2)*eta_x + (k3*D_x*D_y + k4*D_y*D_x)*eta_y
pol2 = eta_x

I could then substitute new non-commuting variables by making another FreeAlgebra and substituting in all the generators by

G.<eta_p,eta_m,D_p,D_m> = FreeAlgebra(SR,4)
pol2_subs = pol2.subs(eta_x = (eta_p + eta_m)/sqrt(2))
pol1_subs = pol1.subs(eta_x = (eta_p + eta_m)/sqrt(2), eta_y = I*(-eta_p + eta_m)/sqrt(2), D_x = (D_p + D_m)/(q*sqrt(2)), D_y = I*(-D_p + D_m)/(q*sqrt(2))

I defined several equations by defining more polynomial expressions and was able to add and subtract them in the normal way. The only problem I had was that I now wasn't able to substitute the normal k1 variables for some reason. But I was able to solve my problem through this method anyway.

edit flag offensive delete link more


You can accept your own answer. Click the "check mark" button at the top left of the answer.

slelievre gravatar imageslelievre ( 2021-06-24 12:26:16 +0100 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2021-06-22 21:14:20 +0100

Seen: 280 times

Last updated: Jun 24 '21