# How to change the order of two indexes in a complex statement

Thanks for all the help. Another newbie question: I have read the doc carefully but asym(..., ..., antisymmetric=False) did not solve the following question.

ex1 := g_{\mu\kappa} \partial_{\nu}{g^{\rho\kappa}} ->
-g^{\rho\kappa} \partial_{\nu}{g_{\mu\kappa}};
ex2 := g_{\mu\kappa} \partial_{\nu}{g^{\kappa\rho}} ->
-g^{\rho\kappa} \partial_{\nu}{g_{\mu\kappa}};

They are identical except for a change of order ρκ <--> κρ in g^{\rho\kappa}. I find this change does make a differnce in some substitutions, so that's why I need it.

Is there a way to make that change of order programmatically, without writing out the expression by hand? asym() will (anti-)symmetrize but then when I canonicalise I get back the original order rather than the order I want.

Many thanks as always GPN

Hi GPN. I don't understand your problem, Could you clarify it? Where are you heading with the substitutions?

And btw, the code blocks are not completely readable, so I cannot notice the difference on the RHS of the substitution.

Thanks @doxdrum

I found a workaround, using substitute():

ex1 := g_{\mu\kappa} \partial_{\nu}{g^{\rho\kappa}} ->
-g^{\rho\kappa} \partial_{\nu}{g_{\mu\kappa}};
ex2 := g_{\mu\kappa} \partial_{\nu}{g^{\kappa\rho}} ->
-g^{\rho\kappa} \partial_{\nu}{g_{\mu\kappa}};
substitute(ex1, $_{\kappa}^{\rho\kappa} -> _{\sigma}^{\sigma\rho}$);
ex1;
ex2;

You will notice that the only change this does - is a change to the order of the indexes - which is what I needed.

However to achieve this I also needed to change the name of the indexes. It is a workable solution.

Many thanks for your attention. GPN

by (2.0k points)
edited by