Is it possible to get the element of a set for a given index?
I would like to take this minimum: x(k) = min{j: y(j) >= k}
Sets
k /k1, k2/
j /j1, j2/;
Parameter
y(j)
aux
x(k);
loop(k,
aux = smin(j$(y(j) ge ord(k)), y(j));
x(k)=smin(j$(y(j)=aux), ord(j));
);
But this returns x(k1)=1 and x(k2) = 2, which I suppose are the indices for j1 and j2. Is there any way to get x(k1)=j1 and x(k2) = j2 ???
Thanks