I'm trying to understand how one can calculate pressure, density and temperature of the atmosphere as a function of altitude.
My assumptions are mostly sourced from https://en.wikipedia.org/wiki/Lapse_rate and https://en.wikipedia.org/wiki/Barometric_formula#Derivation. However, on these pages, there seems to be a little vagueness regarding what parameters are being held constant so I shall write them out explicitly here with dependence on height $z$ where appropriate:
1) Air is an ideal gas so $P(z)M = \rho(z)RT(z)$.
2) The pressure is hydrostatic i.e. $dP(z) = -\rho(z) g dz$
3) There is some temperature lapse rate as a function of altitude and density of air $T(z) = f(z, \rho(z))$. This allows me to take into account radiation and convection. Now, the Wikipedia page (https://en.wikipedia.org/wiki/Lapse_rate) treats $\rho$ as a constant and then assumes that air behaves like an adiabatic gas when it expands due to heat to obtain a valid expression for T(z). That seems incorrect though as density clearly does change with altitude.
4) It's not clear if I can obtain $\rho(z)$ from some other consideration independently.
Are there good tricks/reasonable physical assumptions to solve and obtain all three variables as a function of $z$?
EDIT: The constant density assumption is what I'm having trouble with. Why should this be true and if not, what is the way to obtain it (at least to some first order where we ignore temperature lapse)?