Finding the probabilities of the energy eigenstates is a matter of utilizing the quantum numbers in the eigenvectors in the coupled spin basis to find the energy of each, and using the Boltzmann distribution to assign the probability. This is done using the routine getProbabilities[].
getProbabilities[x_] :=
Block[ {i,j,numVecs,y,rep,order,energy,
e={},relP,absP=0,p={}} ,
numVecs=Length[x] ;
For[ i=1,i<=numVecs,i++,
y=x[[i]] ;
order=y[[2]] ;
rep=y[[1]] ;
energy=rep[[2 order+1]] (rep[[2 order+1]]+1) ;
energy-=rep[[1]] (rep[[1]]+1) ;
For[ j=1,j<=order,j++,
energy-= rep[[2 j]] (rep[[2 j]]+1) ;
] ;
e=Join[e,{energy}] ;
relP=Exp[Q/2 b energy] *
Exp[R b rep[[2 (order+1)]] ];
absP+=relP ;
p=Join[p,{relP}] ;
] ;
Return[{absP,p}] ;
] ;
The argument of getProbabilites is a list of vectors in the coupled spin basis, like that produced by genVecs. The output is a two element list, the first element being the normalization for the second element, which is proportional by the first element to the list of probabilies of the vectors input. For example, the command
![]()
produces the output
![]()
Note that the first element is the sum of the elements of the second element.