Skip to main content
updated
Source Link
Hubble07
  • 3.7k
  • 16
  • 24

Setting LeftQ[a, b] = True together with SetCommutingOperators seems to work.

ClearAll["Global`*"];
<< NC`
<< NCAlgebra`

NCE[b ** a - a ** b]

(*-a ** b + b ** a`*)

SetCommutingOperators[a, b];
LeftQ[a, b] = True;

NCE[b ** a - a ** b]

(*0*)

NCE[a ** c - c ** a]

(*a ** c - c ** a*)

Update providing explanation for the usage of SetCommutingOperators

Firstly the docs (see pg 74) says

SetCommutingOperators takes exactly two parameters. SetCommutingOperators[b, c] will implement the definitions which follow ...

This means that SetCommutingOperators is not supposed to be used as a standalone command instead it should always be followed by setting LeftQ

Secondly LeftQ determines which of the two operators should be equated to the other.

For e.g.

 SetCommutingOperators[a, b];
 LeftQ[a, b] = True;
 
 a ** b
(*a ** b*)

 b ** a
(*a ** b*)

 SetCommutingOperators[a, b];
 LeftQ[a, b] = False;
 
 a ** b
(*b ** a*)

 b ** a
(*b ** a*)

So LeftQ is required to be set in order to avoid any ambiguity about which operator is actually equated to the other. This is mentioned clearly in the NOTE section in that same page.

Also the order of operators in LeftQ should match the order in SetCommutingOperators. Read the WARNING section in that page.

Lastly for SetCommutingOperators it doesn't matter if you set LeftQ to either True or False with the correct ordering. I think the True/False matters for SetCommutingFunctions as seen here (scroll to the bottom).

Setting LeftQ[a, b] = True together with SetCommutingOperators seems to work.

ClearAll["Global`*"];
<< NC`
<< NCAlgebra`

NCE[b ** a - a ** b]

(*-a ** b + b ** a`*)

SetCommutingOperators[a, b];
LeftQ[a, b] = True;

NCE[b ** a - a ** b]

(*0*)

NCE[a ** c - c ** a]

(*a ** c - c ** a*)

Setting LeftQ[a, b] = True together with SetCommutingOperators seems to work.

ClearAll["Global`*"];
<< NC`
<< NCAlgebra`

NCE[b ** a - a ** b]

(*-a ** b + b ** a`*)

SetCommutingOperators[a, b];
LeftQ[a, b] = True;

NCE[b ** a - a ** b]

(*0*)

NCE[a ** c - c ** a]

(*a ** c - c ** a*)

Update providing explanation for the usage of SetCommutingOperators

Firstly the docs (see pg 74) says

SetCommutingOperators takes exactly two parameters. SetCommutingOperators[b, c] will implement the definitions which follow ...

This means that SetCommutingOperators is not supposed to be used as a standalone command instead it should always be followed by setting LeftQ

Secondly LeftQ determines which of the two operators should be equated to the other.

For e.g.

 SetCommutingOperators[a, b];
 LeftQ[a, b] = True;
 
 a ** b
(*a ** b*)

 b ** a
(*a ** b*)

 SetCommutingOperators[a, b];
 LeftQ[a, b] = False;
 
 a ** b
(*b ** a*)

 b ** a
(*b ** a*)

So LeftQ is required to be set in order to avoid any ambiguity about which operator is actually equated to the other. This is mentioned clearly in the NOTE section in that same page.

Also the order of operators in LeftQ should match the order in SetCommutingOperators. Read the WARNING section in that page.

Lastly for SetCommutingOperators it doesn't matter if you set LeftQ to either True or False with the correct ordering. I think the True/False matters for SetCommutingFunctions as seen here (scroll to the bottom).

Source Link
Hubble07
  • 3.7k
  • 16
  • 24

Setting LeftQ[a, b] = True together with SetCommutingOperators seems to work.

ClearAll["Global`*"];
<< NC`
<< NCAlgebra`

NCE[b ** a - a ** b]

(*-a ** b + b ** a`*)

SetCommutingOperators[a, b];
LeftQ[a, b] = True;

NCE[b ** a - a ** b]

(*0*)

NCE[a ** c - c ** a]

(*a ** c - c ** a*)