Test boson and fermion commutators and anticommutators¶

In [1]:
from sympy import *
init_printing()

In [2]:
from sympy.physics.quantum import *
from sympy.physics.quantum.boson import *
from sympy.physics.quantum.fermion import *
from sympy.physics.quantum.operatorordering import *


These distinguishable single-mode boson/fermion operators, but do not in general need to be independent.

In [3]:
a, b = BosonOp("a"), BosonOp("b")
c, d = FermionOp("c"), FermionOp("d")


Boson¶

In [4]:
Commutator(a, Dagger(a)).doit()

Out[4]:
$$1$$
In [5]:
AntiCommutator(a, Dagger(a)).doit()

Out[5]:
$${{a}^\dagger} {a} + {a} {{a}^\dagger}$$
In [6]:
normal_ordered_form(AntiCommutator(a, Dagger(a)).doit())

Out[6]:
$$1 + 2 {{a}^\dagger} {a}$$

In general, different boson operators do not commute, and we do not know anything about the commutation and anticommutation relations:

In [7]:
Commutator(a, b).doit()

Out[7]:
$${a} {b} - {b} {a}$$
In [8]:
AntiCommutator(a, b).doit()

Out[8]:
$${a} {b} + {b} {a}$$

But often different bosons are independent and do commute. We can use the independent=True hint to doit method in this situation:

In [9]:
Commutator(a, b).doit(independent=True)

Out[9]:
$$0$$
In [10]:
AntiCommutator(a, b).doit(independent=True)

Out[10]:
$$2 {a} {b}$$

Fermion¶

In [11]:
AntiCommutator(c, Dagger(c)).doit()

Out[11]:
$$1$$
In [12]:
Commutator(c, Dagger(c)).doit().expand()

Out[12]:
$$- {{c}^\dagger} {c} + {c} {{c}^\dagger}$$

In general different fermion operators do not commute (if they are dependent):

In [13]:
Commutator(c, d).doit()

Out[13]:
$${c} {d} - {d} {c}$$

And we do not know their anticommutator:

In [14]:
AntiCommutator(c, d).doit()

Out[14]:
$${c} {d} + {d} {c}$$

But if we know that they are independent we can indicate this with the independent=True hint:

In [15]:
Commutator(c, d).doit(independent=True)

Out[15]:
$$0$$

and in this case the anticommutator is:

In [16]:
AntiCommutator(c, d).doit(independent=True)

Out[16]:
$$2 {c} {d}$$

Mix of fermion and boson operators¶

Boson and fermion operators commute:

In [17]:
Commutator(a, c).doit()

Out[17]:
$$0$$

So their anticommutator is this one:

In [18]:
AntiCommutator(a, c).doit()

Out[18]:
$$2 {c} {a}$$

Versions¶

In [19]:
%reload_ext version_information

%version_information sympy

Out[19]:
SoftwareVersion
Python3.4.1 (default, May 21 2014, 01:39:38) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]
IPython2.1.0
OSposix [darwin]
sympy0.7.4.1-git
Thu Jun 05 15:27:54 2014 JST