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

Consider the following example:

\m::LaTeXForm("\mu").
\n::LaTeXForm("\nu").

D{#}::Derivative;
{\m,\n}::Indices(s,position=fixed);
{\mu,\nu}::Indices(p,position=fixed);


{x_\mu}::Coordinate;
ex:=D_{x_\mu}{\theta_\mu};
for i in ex.top().free_indices(): 
   display(i);

{x_\m}::Coordinate;
ex:=D_{x_\m}{\theta_\m};
for i in ex.top().free_indices(): 
   display(i);

One would expect no free indices in both expressions. Indeed, for D{x\mu}{\theta_\mu}, there are no free indices. However, for the expression involving the user-defined LaTeXForm symbols \m, there are free indices.

This creates issues when trying to add two expressions like this together.

in Bug reports by (170 points)

1 Answer

0 votes

You cannot use x_\mu or x_\m in the derivative like that. Current github HEAD will report $x_\mu$ and $\mu$ (twice) as free indices in both cases. However, if you use

D_{\mu}{ \theta_\mu }

or in the 2nd case

D_{\m}{\theta_\m}

then things work and (again with current github HEAD) will report no free indices.

Please let me know if this is still a problem with github HEAD (2.4.3.5).

by (80.3k points)
...