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

Can we include some variable(e.g. x,y,z,...) in values={}? For example,

{a,b,c,d}::Indices(values={0,1,2, 3, z},position=fixed); \Gamma{#}::GammaMatrix(metric=\eta); \eta{a b}::KroneckerDelta; C{a b c}::AntiSymmetric; D{a b c}::AntiSymmetric; ex1:= C{a b c} \Gamma^{a b c}; ex2:= C{a b c} D{a b c}; rl:= { C{0 1 2} = \alpha, C{1 2 3} = \beta, C{1 2 z} = \gamma, D{1 2 3} = \theta, D_{1 2 z} = \tau}; evaluate(ex1, rl); evaluate(ex2, rl);

from which we would like to expect

\alpha \Gamma^{012} + \beta \Gamma^{123} + \gamma \Gamma^{12z} \beta \theta + \gamma \tau,

respectively.

in General questions by (700 points)

2 Answers

+2 votes
 
Best answer

Yes, just make sure that you declare z to be a Coordinate, so add as your first line

z::Coordinate;

and then all works as you expected.

by (82.5k points)
selected by
0 votes

I'd like to provide the full answer using Kasper's suggestion (and adding a few changes of my own)

z::Coordinate;
{a,b,c,d}::Indices(values={0,1,2, 3, z},position=fixed); 
\Gamma{#}::GammaMatrix(metric=\eta); 
\eta{a b}::KroneckerDelta; 
C_{a b c}::AntiSymmetric; 
D^{a b c}::AntiSymmetric; 
ex1:= C_{a b c} \Gamma^{a b c}; 
ex2:= C_{a b c} D^{a b c}; 
rl:= { C_{0 1 2} = \alpha, C_{1 2 3} = \beta, C_{1 2 z} = \gamma, D^{1 2 3} = \theta, D^{1 2 z} = \tau}; 
evaluate(ex1, rl); 
evaluate(ex2, rl);

The result of the code is here

by (15.0k points)
...