\(\rho_n=\cfrac{8\pi}{\lambda^4}\)
why is this different from,
\(\rho_n=\cfrac{8\pi}{c^3}f^2\)
Because in actual,
\(\rho_{n\,\lambda}=\cfrac{dn_s}{d\lambda}=\cfrac{8\pi}{\lambda^4}\)
and
\(\rho_{n\,f}=\cfrac{dn_s}{df}=\cfrac{8\pi}{c^3}f^2\)
Because,
\(f\lambda=c\)
\(df\lambda+fd\lambda=0\)
\(df=-\cfrac{f}{\lambda}d\lambda\)
and
\(\rho_{n\,\lambda}*\cfrac{d\lambda}{df}=\cfrac{dn_s}{d\lambda}\cfrac{d\lambda}{df}=\cfrac{dn_s}{df}=\rho_{n\,f}\)
So,
\(\rho_{n\,f}=\cfrac{8\pi}{\lambda^4}*\cfrac{\lambda}{f}=\cfrac{8\pi}{\lambda^3}*\cfrac{1}{f}\)
\(\rho_{n\,f}=\cfrac{8\pi}{c^3}*\cfrac{f^3}{f}=\cfrac{8\pi}{c^3}f^2\)
It is a mistake to just substitute for \(\lambda=\cfrac{c}{f}\)
\(\rho_n=\cfrac{8\pi}{\lambda^4}=\cfrac{8\pi}{\left(\cfrac{c}{f}\right)^4}=\cfrac{8\pi}{c^4}f^4\ne\rho_{n\,f}\)
Have a nice day.