1

I want to get the tensor product of two column vectors, for example:

a = {1, 2, 3};
b = {2, 3, 1};
psi0 = ArrayFlatten[TensorProduct[a, b]];

The size of psi0 is $ 3 \times 3 $, but it should be a column vector with 9 components.

What am I doing wrong?

F.Mark
  • 599
  • 2
  • 8

1 Answers1

2

As already noted, what is wanted can be obtained using either of TensorProduct[{1, 2, 3}, {2, 3, 1}] or KroneckerProduct[{1, 2, 3}, {2, 3, 1}]. Additionally, consider the following evaluations:

KroneckerProduct[{{1, 2, 3}}, {{2, 3, 1}}]
   {{2, 3, 1, 4, 6, 2, 6, 9, 3}}

KroneckerProduct[{{1}, {2}, {3}}, {{2}, {3}, {1}}]
   {{2}, {3}, {1}, {4}, {6}, {2}, {6}, {9}, {3}}
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574