For example,

```
{\mu,\nu,\rho}::Indices(vector).
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.
g_\mu^\nu::KroneckerDelta.
g^\mu_\nu::KroneckerDelta.
\delta{#}::Accent.
ex:=\delta{g_{\mu\nu}} g^{\nu\rho};
eliminate_metric(_);
```

I get an odd result.

+1 vote

Whether this is odd or not depends a bit on what you were expecting.

First of all, in order to make the indices not be moved up/down at will, declare them with the `position=fixed`

argument, so on the first line

`{\mu,\nu,\rho}::Indices(vector, position=fixed).`

Otherwise declaring `g_{\mu\nu}`

a metric automatically makes the `g`

object with indices moved up or down a metric too. Which is nonsense (Cadabra cannot and will not warn against mathematical inconsistencies like this).

Now for the answer. As it stands above, the object `\delta{g_{\mu\nu}}`

is a metric (because the `Metric`

property is visible 'through' the `Accent`

) and can be used to lower the first index on the `g^{\nu\rho}`

object. That explains why you get `g_{\mu}^{\rho}`

as answer.

You may have expected that `g^{\nu\rho}`

would be used to instead *raise* the `\nu`

index on the `\delta{g_{\mu\nu}}`

. In that case you would probably want this to produce `\delta{g_{\mu}^{\rho}}`

. You can enforce this by simply *not* declaring that `g_{\mu\nu}`

is a metric (but only declaring that `g^{\mu\nu}`

is an inverse metric). If you drop the 2nd line in your example, you indeed get `\delta{g_{\mu}^{\rho}}`

.

Ideally Cadabra would understand that `\delta{g_{\mu\nu}}`

should not be used to lower indices, or maybe only on objects which carry a `\delta`

accent too. I have added this to the issue tracker at https://github.com/kpeeters/cadabra2/issues/305 to avoid the idea getting lost.

0 votes

Hi Eureka and Kasper.

Thank you K for the suggestions in solving the issue. I used your point to evaluate the code by Eureka.

I noted that the accent desappear when the `ex`

got evaluated, unless the accent surround just the symbol `g`

(wihtout the indices).

Here my code:

```
{\mu,\nu,\rho}::Indices(vector, position=fixed).
g^{\mu\nu}::InverseMetric.
g_\mu^\nu::KroneckerDelta.
g^\mu_\nu::KroneckerDelta.
\delta{#}::Accent.
ex:=\delta{g}_{\mu\nu} g^{\nu\rho};
eliminate_metric(_);
```

Best wishes, Dox

I think the right result is $\delta g_{\mu\nu} g^{\nu\rho}$\, instead of $\delta g_{\mu}^{\rho}$. `eliminate_metric`

shouldn't touch the expression.

Hi Eureka. The result you're expecting is the initial expression. Once you use the algorithm `eliminate_metric`

the inverse metric will raise the index of **any** tensor it is contracted.

I belive your problem is that the example is part of a more involved expression, and you want to eliminate metric in other parts of the (longer) expression without touching the parrt in your example. If that is the case, you could use a bypass utilising `substitute`

, or the pair `zoom`

and `unzoom`

.

Cheers.