# On including conserved charges when maximizing entropy of a statistical system

One approach towards constructing the probability of a state in a system is by maximizing the constrained entropy

$$S[p(n);\alpha,\beta] = -\sum_np(n)\log(p(n))\;+\; \alpha\big(\sum_nE_np(n) -\langle E\rangle\big)\;+\; \beta\big(\sum_np(n) - 1\big).$$ However, if there is a continuous symmetry in my Hamiltonian that preserves a charge $$Q$$, why not include this $$S[p(n);\alpha,\beta,\gamma] = -\sum_np(n)\log(p(n))\;+\; \alpha\big(\sum_nE_np(n) -\langle E\rangle\big)\;+\; \beta\big(\sum_np(n) - 1\big) \\+\gamma\big(\sum_nq_np(n)+\langle Q\rangle \big)?$$ Does it make sense to do something like this or is there something clearly wrong with it.

Perhaps this makes more sense in for a quantum statistical system. Since the conserved charge commutes with the Hamiltonian, there will be many eigenstates $$|n\rangle$$ with the same charge $$q_i$$ for some $$i$$. Therefore, performing the sum in the second equation might make more sense.