Outer
. Let us consider two lists defined asThen the following commanda={a1,a2,a3};
b={b1,b2};
Outer[f, a, b]
gives a matrix of the formf[a1,b1] f[a1,b2]
f[a2,b1] f[a2,b2]
f[a3,b1] f[a3,b2]
A practical example is given below. Consider d-band electrons with spins. There are five d-orbitals and two spin states. Suppose
orbital
and spin
stores the orbital and spin part of the state vector. The complete basis can be obtained byFlatten[Outer[Join, orbital, spin, 1], 1]