sympy for Quantum Field Theory (QFT)

565 views
Skip to first unread message

cschwan

unread,
Aug 4, 2011, 8:21:01 AM8/4/11
to sympy
Hello!

I would like to know if sympy can be used for Quantum Field Theory
calculations. In particular, I would like to compute traces of dirac
matrices and contract them with four-vectors. For example, the
following holds true (latex notation):

Tr ( \gamma^\mu \gamma^\alpha \gamma^\nu \gamma^\beta ) p_\alpha n_
\beta = 4 ( p^\mu n^\nu + n^\mu p^\nu - g^{\mu \nu} p \cdot n )

I am using the following clifford identity to calculate the right hand
side:

\gamma^\mu \gamma^\nu + \gamma^\nu \gamma^\mu = 2 g^{\mu \nu}
\cdot 1

The \gamma^\mu are elements of a clifford algebra and at the same time
are lorentz vectors, g^{\mu \nu} is the metric tensor. Since the
\gamma^\mu are represented by 4x4 matrices, I can take the trace of
them. Because of the identity above and

Tr (1) = 4

I can show that

Tr ( \gamma^\mu \gamma^\nu ) = 4 g^{\mu \nu}

By repeatedly applying the clifford identity I can derive identities
for traces with than two gamma matrices.

Does somebody know if this is possible with sympy? When I looked into
sympy's documentation I noticed there are already modules for tensors
and geometric algebra, but I did not find anything to work out the
traces.

Alan Bromborsky

unread,
Aug 4, 2011, 8:40:42 AM8/4/11
to sy...@googlegroups.com
Try looking in Doran & Lasenby, "Geometric Algebra for Physicists",
Chapter 8 - Quantum Theory and Spinors. That might show how
geometric algebra could be used to calculate what you want. I don't
know enough quantum mechanics to know for sure. My interest in
geometric algebra is the gauge theory of gravity.

Alan Bromborsky

unread,
Aug 4, 2011, 12:58:45 PM8/4/11
to sy...@googlegroups.com
I have attached Havel.pdf. This might be of use to you.
Havel.pdf

Ondřej Čertík

unread,
Aug 4, 2011, 4:20:51 PM8/4/11
to sy...@googlegroups.com
Hi Cschwan,

Try to look at this example:

https://github.com/sympy/sympy/blob/master/examples/advanced/qft.py

I wrote it couple years ago. If you would like to help improve this
functionality, that would be absolutely awesome. Let us know.

Ondrej

cschwan

unread,
Aug 5, 2011, 3:50:06 AM8/5/11
to sympy
Thank you for your answers!

Unfortunately, I do not have access to the book Alan mentioned (I
think of buying it, saw it before when searching for the subject).
Nevertheless, thank you for your PDF-file, I will have a look into it.

The example from Ondřej is looking very similar to what I am looking
for. However, I noticed that the gamma matrices are implemented by a
specific representation. In my opinion it would be better to treat
them fully symbolically in order to gain results for dimensional
regularized calculations, which alter the Clifford-identity to the
following:

\gamma^\mu \gamma^\nu + \gamma^\nu \gamma^\mu = (2-\epsilon) g^{\mu
\nu}

I seriously think of implementing this functionality.

Christopher

Alan Bromborsky

unread,
Aug 5, 2011, 1:28:30 PM8/5/11
to sy...@googlegroups.com
I have one more reference for you (attached)
Shyamal_thesis.ps

Ondřej Čertík

unread,
Aug 5, 2011, 1:51:41 PM8/5/11
to sy...@googlegroups.com

That's right. There are basically 2 approaches:

1) use some particular representation, and simply multiply all the
matrices and then take a trace
2) do things symbolically using the relations between the matrices

I decided to try 1), as it seemed to me, that it should work fine. But
the resulting matrix is quite a mess, so one would need to figure out
whether there is some good way to simplify the result.

As to 2), I think there the difficulty is in the fact, that one needs
to know which rules to apply and how. If you go this route, I would be
very interested if you manage to get it working.

>
> I seriously think of implementing this functionality.

That would be really great. Whenever you have something, just let us
know on the list and we'll help you with git and patches. Or any other
question you might have.

Ondrej

Brian Granger

unread,
Aug 5, 2011, 2:49:12 PM8/5/11
to sy...@googlegroups.com
From the physics/quantum perspective, the gamma matrices are just
operators that act on states. For this type of thing the machinery in
sympy.physics.quantum would be perfect. Some of the things it would
provide:

* We already have abstract/symbolic states operators that behave like
they should.
* Everything can be defined symbolically, but states and operators can
be represented in a given basis.
* Symbolic commutation/antocommutation relationships can be defined.
* And more...

The best starting place is to look at how we handle spin in
sympy.physics.quantum.spin. I should note that we don't have a
symbolic trace operation, but that could be implemented quite easily.

Cheers,

Brian

2011/8/5 Ondřej Čertík <ondrej...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
>
>

--
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgra...@calpoly.edu and elli...@gmail.com

cschwan

unread,
Aug 7, 2011, 4:18:50 AM8/7/11
to sympy
On Aug 5, 7:51 pm, Ondřej Čertík <ondrej.cer...@gmail.com> wrote:
> That's right. There are basically 2 approaches:
>
> 1) use some particular representation, and simply multiply all the
> matrices and then take a trace
> 2) do things symbolically using the relations between the matrices
>
> I decided to try 1), as it seemed to me, that it should work fine. But
> the resulting matrix is quite a mess, so one would need to figure out
> whether there is some good way to simplify the result.

Thats the problem I saw - no manifest Lorentz covariance.

>
> As to 2), I think there the difficulty is in the fact, that one needs
> to know which rules to apply and how. If you go this route, I would be
> very interested if you manage to get it working.

I already have some ideas about that, but currently I wonder how one
does implement non-commutative symbols with indices. Are there any
plans to support indices with covariance?

On Aug 5, 8:49 pm, Brian Granger <elliso...@gmail.com> wrote:
> The best starting place is to look at how we handle spin in
> sympy.physics.quantum.spin. I should note that we don't have a
> symbolic trace operation, but that could be implemented quite easily.

Thank you for the pointer, I will have a look into it.

Christopher

Aaron Meurer

unread,
Aug 7, 2011, 4:28:53 AM8/7/11
to sy...@googlegroups.com
On Sun, Aug 7, 2011 at 2:18 AM, cschwan <csc...@students.uni-mainz.de> wrote:
> On Aug 5, 7:51 pm, Ondřej Čertík <ondrej.cer...@gmail.com> wrote:
>> That's right. There are basically 2 approaches:
>>
>> 1) use some particular representation, and simply multiply all the
>> matrices and then take a trace
>> 2) do things symbolically using the relations between the matrices
>>
>> I decided to try 1), as it seemed to me, that it should work fine. But
>> the resulting matrix is quite a mess, so one would need to figure out
>> whether there is some good way to simplify the result.
>
> Thats the problem I saw - no manifest Lorentz covariance.
>
>>
>> As to 2), I think there the difficulty is in the fact, that one needs
>> to know which rules to apply and how. If you go this route, I would be
>> very interested if you manage to get it working.
>
> I already have some ideas about that, but currently I wonder how one
> does implement non-commutative symbols with indices. Are there any
> plans to support indices with covariance?

The IndexedBase class and friends basically symbols with index, and
are non-commutative by default:

In [22]: mu = Idx('mu')

In [23]: IndexedBase?

In [26]: A = IndexedBase('A')

In [27]: B = IndexedBase('B')

In [28]: A[mu]*B[mu]
A[mu]*B[mu]

In [29]: B[mu]*A[mu]
B[mu]*A[mu]

In [30]: A[mu]*B[mu] - B[mu]*A[mu]
A[mu]*B[mu] - B[mu]*A[mu]

(btw, imho, they shouldn't be non-commutative by default, but they are)

Aaron Meurer

>
> On Aug 5, 8:49 pm, Brian Granger <elliso...@gmail.com> wrote:
>> The best starting place is to look at how we handle spin in
>> sympy.physics.quantum.spin.  I should note that we don't have a
>> symbolic trace operation, but that could be implemented quite easily.
>
> Thank you for the pointer, I will have a look into it.
>
> Christopher
>

Reply all
Reply to author
Forward
0 new messages