Hi Folks,
The following code does its job nicely (to fully expand the sum)
{a,b,c}::Indices(position=fixed,values={x,y,z}).
{x,y,z}::Coordinate.
ex := A_{a} B^{a};
rl1 := {A_{x}=Ax,A_{y}=Ay,A_{z}=Az};
rl2 := {B^{x}=Bx,B^{y}=By,B^{z}=Bz};
evaluate(ex,rl1+rl2,rhsonly=True);
My intention is to feed the final expression to the sympy printer and codegen packages to produce C code for inclusion in other C codes. For the above example that would be trivial. But if I had some messy expression in the Riemann tensor (which has 256 components in 4 dimensions) the rules that map components like R_{x y x y} to Rxyxy (as an example) would become extremely tedious to write out (and error prone).
Is there a simple way to avoid having to list every component in the rules?
I've tried using
rl1 := A_{a?}->A_{a?};
rl2 := B^{a?}->B^{a?};
but Cadabra complains "substitute: Argument is neither a replacement rule nor an equality".
Any suggestions?
Cheers,
Leo