Consider the $p$-spin spherical spin glass model with Hamiltonian $$H_{N,p}(\sigma)=\frac{1}{{N}^{\frac{(p-1)}{2}}} \sum \limits_{i_1,...i_p} J_{i_1,...i_p} \sigma_{i_1} \sigma_{i_2} .. \sigma_{i_p} $$ where $$\sigma = (\sigma_1,...,\sigma_{i_N}) \in S^{N-1}(\sqrt{N}) \subseteq \mathbb{R}^{N} $$ the Euclidean sphere with radius $\sqrt{N}$.
I am a mathematician, so my physics knowledge is very limited.
I am trying to understand why is the TAP functional, given by $$f_{TAP}(q)(\sigma) = 2^{-\frac{1}{2}}q^{\frac{p}{2}}\frac{1}{N}H_{N,p}(\sigma) + B(q) $$ where $$B(q)= -\frac{1}{2\beta} \log(1-q) -\frac{\beta}{4} (1+(p-1)q^{p} - pq^{p-1} ) ,$$ important in the study of p-spin spherical spin glass. A description in words or some comments would be enough for now, as a start. I have also found a few papers concerning the $f_{TAP} $ functional but they seem too advanced for me.
Could someone give me some help with this?