2
$\begingroup$

I want to generate all possible vectors programicaly with entrys in $\Bbb Z_4$: $$A_j:=\begin{bmatrix}x_1\\ x_2\end{bmatrix}, \qquad x_i\in \{0,1,2,3\}, j=1,2,\cdots 16.$$

$\endgroup$
6
$\begingroup$

Use Tuples.

Tuples[{0,1,2,3}, {2}]
$\endgroup$
  • $\begingroup$ Thanks @Szabolcs. My purpose of this question was the detailed code of Tuples. $\endgroup$ – C.F.G Aug 19 at 15:11
2
$\begingroup$

You can also use Outer, since this is a kind of outer product with the function List:

elem = {0, 1, 2, 3}; Flatten[Outer[List, elem, elem], 1]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.