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

Hello,

one can assign integers 0 to d to indices a,b,c,d with the command

{a,b,c,d}::Integers(0..d);

How can we assign a set of integers, say, (0,1,5,6) to the indices? I tried

{a,b,c,d}::Integers(0,1,5,6);

but I got a Kernel crash. Thanks :)

in General questions by (700 points)

1 Answer

+2 votes
 
Best answer

Good one; not possible right now, I'll put it on the list. However, you can assign such sets to Indices for the purposes of evaluate: you can do

{a,b,c,d}::Indices(values={0,1,5,6});
ex:= A_{a} A_{a};
rl:= [ A_{1} = 3, A_{5} = 6 ];
evaluate(ex, rl);

to get '45'.

(Note: evaluate currently only looks at the values argument of Indices, not at any Integer property attached to the indices).

by (83.1k points)
selected by

Thanks for your helpful comments, Kasper!

...