# An unexpected behavior from @prodrule

Hi everyone!

Please take a look at the first term of the result of the second @eliminate_metric and the first term of the @prodsort, in the following code. They must be equal but due an automatic "integral by part" in @prodsort all of the derivatives were moved to just one of the fields without any minus sign.

{\alpha, \beta, \rho, \sigma, \mu, \nu, \gamma, \lambda}::Indices.
\eta^{\mu \nu}::Metric.
\eta_{\mu \nu}::Symmetric.
\eta^\mu_\nu::KroneckerDelta.
h^{\mu \nu}::Symmetric.
\partial_{#}::PartialDerivative.
\Gamma^{\mu}_{\nu \rho}::Depends(\partial).
\Gamma^{\mu}_{\nu \rho}::TableauSymmetry(shape={2}, indices={1,2}).
\phi::Depends(\partial).
h^{\mu \nu}::Depends(\partial).
h::Depends(\partial).
term:=(\eta^{\mu \nu} \eta^{\alpha \beta}\partial_{\mu}\phi
-k h^{\mu \nu} \eta^{\alpha \beta}\partial_{\mu}\phi )
(\partial_{\alpha}\partial_{\beta}\partial_{\nu}\phi
- \partial_{\alpha}(\Gamma^{\rho}_{\beta \nu}\partial_{\rho}\phi));
@prodrule!(%);
@distribute!(%);
@distribute!(%);
@eliminate_metric!(%);
@eliminate_metric!(%);
@prodsort!(%);

As another question, in the above code I used @eliminate_metric and @distribute twice sequentially to get the desired effect. Is there any way to use just once with the same effect?

If you write

\partial_{\mu}A

this may look like the right thing on your screen, but actually represents a partial derivative acting on nothing, multiplied with A.

What you need to write is

\partial_{\mu}{A}

to explicitly tell Cadabra on which object the derivative acts.

by (64.9k points)
selected

Oops! You are right! This issue is mentioned in the manual!

Would you please give me a hint for the second question that I made in the final.

You can use the 'repeat until expression no longer changes' form

 @distribute!!(%)

and ditto for eliminate_metric.

By the way there are much more powerful ways to do this in 2.x; I'd recommend that you switch to 2.x for new projects as that is where all the exciting new things happen. See http://cadabra.science.

But what should I do for three derivates like

\partial_{\alpha}\partial_{\beta}\partial_{\nu}{\phi}

The above form is correct?

Thanks for answer. For sure, I am in a phase transition to the second version. Now I am trying to learn Sympy to can use Cadabra2 in a more efficient way.

Either

\partial_{\alpha}{ \partial_{\beta}{ \partial_{\nu}{\phi} } }

or

\partial_{\alpha \beta \nu}{\phi}