# Assignment of a set of integers to indices

+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 :)

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 (71.6k points)
selected