The basis vectors of the coupled spin (energy eigenstate) basis
are generated using genVecs[].
genVecs[ {rep_,order_,scale_} ] :=
Block[ { a={},n,j,m,q,newrep },
n=Length[rep]-order;
q=2(order+1);
If[ order<(n-1) ,
For[ j=Abs[rep[[q]]-rep[[q-1]]],
j<=(rep[[q]]+rep[[q-1]]),
j++,
newrep=Insert[rep,j,q+1] ;
a=Join[a,
genVecs[{newrep,order+1,scale}]] ;
] ;
] ;
If[ order==(n-1) ,
For[ m=-rep[[q-1]], m<=rep[[q-1]], m++,
a=Join[a,{{Join[rep,{m}],n-1,scale}}]
] ;
] ;
Return[a] ;
]
The arguments of genVecs are rep, a list of the spin values, order, the order of the representation given, usually 0, and scale, the value of the amplitude to be assigned to the vectors generated. For example,
![]()
produces the list of four vectors with their order and scale.

Here the order has become 1 because one coupling has occurred between the two spins given.