Issues with vary

+1 vote

Why will following code produce odd result?

{\mu,\nu}::Indices(vector).
\Vt{#}::LaTeXForm("{\tilde{V}}").
ex:=\int{\Vt_{\mu}\Vt^{\mu}};
vary(_,$\Vt_{\mu}->\delta{\Vt_{\mu}}$);


I confirm the behaviour reported by @Eureka. See the image

Cadabra: Version 2.2.7 (build 2275.333ca654f6 dated 2019-12-03

OS: Debian Linux (bullseye)

Ok, vary seems to do something with the expression tree which corrupts the tree, and then depending on what is in memory, the bug will get triggered (I have now reproduced it a few times). Hang on.

This is a printing problem actually, the tree structure is fine. As a temporary workaround, use

\delta{#}::IndexInherit;


instead of using the Accent property. Has the same effect (indices of whatever \delta acts on will be visible 'outside' the \delta), but prints correctly.

Confirm that the work around works!

Ok, It works.