Similar to this question, I am interested in working with an implementation of quantum ladder operators.
I've been trying to use this "Quantum Mathematica Package" to solve some lengthy algebra with a lot of ladder-operators in different modes, but have been having trouble.
I want to be able to evaluate and manipulate some of the quantum operators that are inside of a sum.
For example, I might be working with a term involing the multiplication of multiple ladder operators such as:
$\frac{1}{4} a_1\cdot a_2^2\cdot a_7{}^{\dagger }\cdot a_2\cdot a_7\cdot a_7{}^{\dagger }$
One thing I would like to do is get it to simplify this knowing the commutation relation between operators to:
$\frac{1}{4} a_1\cdot a_2^3\cdot a_7{}^{\dagger }\cdot a_7\cdot a_7{}^{\dagger }$
(so I want Mathematica to identify that because $a_7$ and $a_2$ commute, that I can sort these operators in an "alphabetical ordering")
Theoretically I can do this with the following code:
Needs["Quantum`Notation`"];
Clear[a];
SetQuantumObject[a];
Now if I specify the commutation relationship between these operators using the code:
(I'm using pictures here because the code looks hideous if I copy+paste it)
Now I can apply a function called "CommutatorExpand[]" to try to simplify this to the desired form:
And here I see that it can successfully organize my operators!
But unfortunately I haven't been able to figure out how to do this consistently. For example, this case doesn't work:
Any idea what the issue is or how to fix this?
Here's a copy+paste version of the code:
Needs["Quantum`Notation`"];
Clear[a];
SetQuantumObject[a];
\!\(\*
TagBox[
SubscriptBox[
RowBox[{"[[",
TagBox[
RowBox[{
SubscriptBox["a",
RowBox[{"b", ":",
RowBox[{"1", "|", "2", "|", "3", "|", "4", "|", "5", "|", "6", "|",
"7", "|", "8", "|", "9"}]}]], ",",
SuperscriptBox[
RowBox[{"(",
SubscriptBox["a",
RowBox[{"a", ":",
RowBox[{"1", "|", "2", "|", "3", "|", "4", "|", "5", "|", "6", "|",
"7", "|", "8", "|", "9"}]}]], ")"}], "\[Dagger]"]}],
Quantum`Notation`zz080KetArgs,
Editable->True,
Selectable->True], "]]"}], "-"],
Quantum`Notation`zz050Commutator,
Editable->False,
Selectable->False]\) := KroneckerDelta[a, b];
\!\(\*
TagBox[
SubscriptBox[
RowBox[{"[[",
TagBox[
RowBox[{
SubscriptBox["a",
RowBox[{"b", ":",
RowBox[{"1", "|", "2", "|", "3", "|", "4", "|", "5", "|", "6", "|",
"7", "|", "8", "|", "9"}]}]], ",",
RowBox[{"(",
SubscriptBox["a",
RowBox[{"a", ":",
RowBox[{"1", "|", "2", "|", "3", "|", "4", "|", "5", "|", "6", "|",
"7", "|", "8", "|", "9"}]}]], ")"}]}],
Quantum`Notation`zz080KetArgs,
Editable->True,
Selectable->True], "]]"}], "-"],
Quantum`Notation`zz050Commutator,
Editable->False,
Selectable->False]\) := 0;
\!\(\*
TagBox[
SubscriptBox[
RowBox[{"[[",
TagBox[
RowBox[{
SuperscriptBox[
RowBox[{"(",
SubscriptBox["a",
RowBox[{"b", ":",
RowBox[{"1", "|", "2", "|", "3", "|", "4", "|", "5", "|", "6", "|",
"7", "|", "8", "|", "9"}]}]], ")"}], "\[Dagger]"], ",",
SuperscriptBox[
RowBox[{"(",
SubscriptBox["a",
RowBox[{"a", ":",
RowBox[{"1", "|", "2", "|", "3", "|", "4", "|", "5", "|", "6", "|",
"7", "|", "8", "|", "9"}]}]], ")"}], "\[Dagger]"]}],
Quantum`Notation`zz080KetArgs,
Editable->True,
Selectable->True], "]]"}], "-"],
Quantum`Notation`zz050Commutator,
Editable->False,
Selectable->False]\) := 0;
CommutatorExpand[ Subscript[a, 1]\[CenterDot]
\!\(\*SubsuperscriptBox[\(a\), \(2\), \(2\)]\)\[CenterDot]SuperDagger[
Subscript[a, 7]]\[CenterDot]Subscript[a, 2]\[CenterDot]Subscript[a,
7]\[CenterDot]SuperDagger[Subscript[a, 7]]]
CommutatorExpand[Subscript[a, 1]\[CenterDot]Subscript[a, 2]\[CenterDot]
\!\(\*SubsuperscriptBox[\(a\), \(7\), \(2\)]\)\[CenterDot]SuperDagger[
Subscript[a, 1]]\[CenterDot]SuperDagger[Subscript[a,
7]]\[CenterDot]SuperDagger[Subscript[a, 2]]]