# Problem with rename_dummies and sort_product

+1 vote

Hello,

With the input

{a,b,c#}::Indices("a");

ex:=1/2 X_{a} B^{a b} X_{b} + K^{a} X_{a};
vary(ex,$X_{a}->A_{a}$);
sort_product(ex);
rename_dummies(ex);

{\delta{#},Z{#},X{#},B{#},K{#}}::SortOrder;

ex:=1/2 X_{a} B^{a b} X_{b} + K^{a} X_{a};
vary(ex,$X_{a}->Z_{a}$);
sort_product(ex);
rename_dummies(ex);

\delta{#}::Accent;

ex:=1/2 X_{a} B^{a b} X_{b} + K^{a} X_{a};
vary(ex,$X_{a}->\delta{X_{a}}$);
sort_product(ex);
rename_dummies(ex);

The output I get is

Attached property Indices(position=free) to {a, b, c#}.
1/2 X_{a} B^{a b} X_{b} + K^{a} X_{a}
1/2 A_{a} B^{a b} X_{b} +  1/2 X_{a} B^{a b} A_{b} + K^{a} A_{a}
1/2 A_{a} B^{a b} X_{b} +  1/2 A_{b} B^{a b} X_{a} + A_{a} K^{a}
1/2 A_{a} B^{a b} X_{b} +  1/2 A_{a} B^{b a} X_{b} + A_{a} K^{a}
Attached property SortOrder to {\delta(#), Z(#), X(#), B(#), K(#)}.
1/2 X_{a} B^{a b} X_{b} + K^{a} X_{a}
1/2 Z_{a} B^{a b} X_{b} +  1/2 X_{a} B^{a b} Z_{b} + K^{a} Z_{a}
1/2 Z_{a} X_{b} B^{a b} +  1/2 Z_{b} X_{a} B^{a b} + Z_{a} K^{a}
1/2 Z_{a} X_{b} B^{a b} +  1/2 Z_{b} X_{a} B^{a b} + Z_{a} K^{a}
Attached property Accent to \delta{#}.
1/2 X_{a} B^{a b} X_{b} + K^{a} X_{a}
1/2 \delta{X_{a}} B^{a b} X_{b} +  1/2 X_{a} B^{a b} \delta{X_{b}} + K^{a} \delta{X_{a}}
1/2 \delta{X_{a}} X_{b} B^{a b} +  1/2 \delta{X_{b}} X_{a} B^{a b} + \delta{X_{a}} K^{a}
1/2 \delta{X_{a}} X_{b} B^{a b} +  1/2 \delta{X_{b}} X_{a} B^{a b} + \delta{X_{a}} K^{a}

Is this behaviour expected? If yes, is there a way to obtain

 1/2 Z_{a} X_{b} B^{a b} +  1/2 Z_{a} X_{b} B^{b a} + Z_{a} K^{a}

and

 1/2 \delta{X_{a}} X_{b} B^{a b} +  1/2 \delta{X_{a}} X_{b} B^{b a} + \delta{X_{a}} K^{a}

In case it is really a bug, I run Cadabra 2.2.9 (built on April 7) on macOS High Sierra.

edited

I'm confused. Apart from the different index names in the 2nd term of that first line, the expressions that you get with cadabra are exactly what you asked for? The second line is identical, no?

Thank you for the prompt answer!

Indeed, my problem is the index name, I thought that that was the job of rename_dummies, maybe I got confused there? I would like to change the index name to be able to factor out \delta{X_{a}}.

The second one was a typo, sorry about that, I edited.