How generate all possible samples of size n = 2 that can be drawn with replacement from this population [0,1,2]?
It occurs to me using these commands.
restart; with(combinat); choose([0, 0, 1, 1, 2, 2], 2);
[[0, 0], [0, 1], [0, 2], [1, 1], [1, 2], [2, 2]]
permute([0, 0, 1, 1, 2, 2], 2);
[[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]