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

I have some expression reached after a long list of manipulations with some free indices, and I want to create a mapping (I think documentation prefers calling them "substitution rules") like:

M_{\mu} -> <previous expression with only \mu as free indice>

I tried doing:

M_mapping := M_{\mu} -> $(_);

but this gives:
`\begin{verbatim}RuntimeError: Python object '' does not exist.

At: Notebook Cell (Line 1): Mmapping = Ex(' M{\mu} -> @(_)') \end{verbatim}`

I tried doing:

M_expr = _;   <--- this succeeds
M_mapping := M_{\mu} -> @(M_expr); <--- this gives an error:

`\begin{verbatim}RuntimeError: Python object '\prod' does not exist.

At: Notebook Cell (Line 1): Mmapping = Ex(' M{\mu} -> @(M_expr)') \end{verbatim}`

What's the correct syntax to create a mapping with the previous expression?

in General questions by (230 points)

1 Answer

0 votes

For some reason, the syntax @[something] or @(something) does not like underscores, so if you remove it from the variable name, the construction will work. For example:

M_mapping := M_{\mu} -> @(M_expr); <--- error

but

M_mapping := M_{\mu} -> @(Mexpr); <--- works
ago by (1.8k points)
...