Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
0 votes


I'm completely new to Cadabra and just installed this on my Mac OS laptop. As a first step in familiarising myself with the syntax, I tried to modify the first tutorial of varying the action for the Maxwell gauge field by that of the Rarita-Schwinger action for the gravitino. However, when I define the action, the output is zero, and I don't know what I did wrong. Here is my code:

#Rarita-Scwhinger Action
def post_process(ex):





At this stage I guess the output should just be the action itself since no manipulation has been performed. Yet the output is zero.
Any help is appreciated. Thanks.

asked in General questions by

1 Answer

0 votes
Best answer

It's mostly an issue with not putting brackets at the right places. While Cadabra uses TeX notation, you sometimes have to be a little more explicit than strictly necessary in TeX, in order to avoid ambiguity. So you have to write e.g.


so that it is clear to Cadabra that the \psi_{\mu} is an 'argument' of \bar. Ditto for \partial, which you need to write as

\partial_{\nu}{ \psi_{\rho} }

so that the \psi_{\rho} explicitly becomes an 'argument' of \partial. In your example, the \partial_{\nu}\psi_{\rho} was interpreted as a derivative acting on nothing, multiplied with \psi_{\rho}, giving nothing.

Here's a tidied-up version which works:

#Rarita-Scwhinger Action
def post_process(ex):




S:=\int{\bar{\psi_{\mu}} \Gamma^{\mu\nu\rho} \partial_{\nu}{\psi_{\rho}} }{x};

I have fixed a few typos and also changed the index type to 'independent' to prevent Cadabra from raising/lowering index pairs (usually better for susy computations, as you can then keep all indices on the Gamma's upstairs and more easily convert them using vielbeine).

answered by (37.9k points)

Thank you for taking the time to answer my question. I've used your fixed-up code to define the action, and it works fine.

However, I'm encountering a problem with the variation itself. Since \bar{#}::DiracBar is defined as such, when I try to vary $S$ with respect to


the bar is automatically over the whole of $\delta{\psi_{\mu}}$,

i.e. $\bar{\delta{\psi_{\mu}}}$

S:=\int{\bar{\psi{\mu}} \Gamma^{\mu\nu\rho} \partial{\nu}{\psi{\rho}} }{x};
vary(S, $\psi
{\mu}-> \delta{\psi_{\mu}}$);

Is it possible to have 2 separate variations: one with respect to


and one with respect to $\psi_{\mu}$?
Thank you !

If you want to do these variations separately, you need to use a different object for $\bar{\psi}_{\mu}$, and not declare \bar{#} as accent. So e.g.

{\psi_{\mu}, \bpsi_{\mu} }::Spinor;

(the first line is to make the output look nice). You can then write a variation rule for \bpsi_{\mu} separately.

The alternative is to keep the story as you wrote originally, but expand the Dirac bar after you have done the variation. See the expand_diracbar algorithm for details https://cadabra.science/manual/expand_diracbar.html.

(I have removed the question in which you asked the above; please keep related things in one thread on the forum. I read everything, but sometimes do not immediately have time to respond).