nion = NAρ Σi Xi/Ai
= NAρ/μion introducing μion the mean molecular weight (per unit atomic mass).
Astronomers like to write XH as X, XHe as Y and the rest as Z=1-X-Y. And Z (which is mostly C N and O) is referred to as "metals". The Sun's metallicity is about Z=0.02. Then (average Z=16amu?)
μion = 1/( X/1.00794 + Y/4.00206 +...) ~ 1/( X + Y/4 + Z/16 )
If Z is small we can write Y=1-X and μion=1/(X+Y/4) = 4/(3X+1)
The electron gas is extremely complicated since we need the ionization fractions of all species (via the Saha ionization equation).
Let n(XR) be the number of atoms X in the Rth stage of ionization, eg, triply ionized carbon n(C+++).
A triply ionized species gives 3 electrons so contributes 3n(C+++) to ne so we have
ne= n(H+) + n(He+) + 2n(He++) + n(C+) +
2n(C++) + ... + 6n(C6+) + ...
= NAρ[Xn(H+)/n(H)/AH + Yn(He+)/n(He)/AHe + 2Yn(He++)/n(He)/AHe+ ...] = NAρ/μe
where we have introduced the mean molecular weight per free electron μe.
The μe would be infinite for a neutral gas (Pe=0) and unity for completely ionized H (where we would have μ=μe and Pion=Pe).
μe is the number of baryons per electron.
The problem simplifies considerably for complete ionization since all the ionization fractions
n(Xin+/Xi) are zero except the Z+ (last) stage = 1.
Then,
1/μe = (X + 2Y/4 + 6XC/12 + 7XN/14 + 8XO/16 + ...)
1/μe ~ (X + Y/2 + Z/2) = (X + (1-X)/2) = (X/2 + 1/2) = (1+X)/2
The total number of particles is n=ne+nI=NAρ/μ
where
1/μ=1/μe+1/μion
and
P = Pr + Pg = aT4/3 + NAρkT/μ
If the gas pressure Pg is a fraction β of the total pressure then
Pg=NAρkT/μ = βP=β(Pg+Pr)
Pr = Pg(1-β)/β = aT4/3
aT4/3 = NAρkT/μ ×(1-β)/β
T3 = (1-β)/β ×3MAk/a ×ρ/μ
P = β-1Pg = β-1NAρk/μ ×[(1-β)/β ×3NAk/a ×ρ/μ]1/3ρ1/3
= [(1-β)/β4 ×3/a ×(NAk/μ)4]1/3ρ4/3 = K ρ4/3 = K ργ
This is the basis of Eddington's "standard model", a polytrope of index n=1/(γ-1)=3.
Treatment of the degenerate electron gas is treated elsewhere, but two situations are of interest,
Nonrelativistic complete degeneracy
The White dwarf equation of state is dominated by complete nonrelativistic degeneracy,
Pe = NAh2/20me (3NA/π)2/3 (1/μe)5/3 ρ5/3 = K2 ρ5/3
Pe = 2.33E-38(NAρ/μe)5/3 [SI]
which corresponds to an n=1.5 polytrope.
Relativistic complete degeneracy
With increasing mass white dwarf densities increase to the point that the electrons at the "top of the Fermi sea" become ultrarelativistic for which the EOS becomes
Pe = NAhc/8 ×(3NA/π)1/3 ×(1/μe) ρ4/3 = K3 ρ4/3
which corresponds to an n=3 polytrope.
bottom line