Atmospheric pressure, density and temperature variation with altitude 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)? 
 A: Heat transport in the lower atmosphere is predominantly convective, at least in daytime.  (Convection abates after the ground has cooled off at night.)  Up- and downdrafts do not exchange much energy, so it is a good approximation to assume that their expansion and compression are adiabatic.  
Adiabatic expansion of ideal gases is described by $P\sim {{\rho }^{\gamma }}$, where $\gamma \equiv {{C}_{P}}/{{C}_{V}}=7/5$ for dry air.  It follows that $P\sim {{T}^{7/2}}$ and $\rho \sim {{T}^{5/2}}$.   Combining these rules  with the equation of hydrostatic equilibrium, $dP/dz=-g\rho$, and the ideal gas law, $RT=PV=Pm/\rho$, we find a constant lapse rate: $dT/dz=-\tfrac{\gamma -1}{\gamma }mg/R=$ -9.8 deg/km, where m = 29 g/mol.  But this value exaggerates the measured average temperature profile.  
The International Standard Atmosphere use in aero engineering has $dT/dz=$ -6.5 deg/km, consistent with $\gamma$ = 1.26, from sea level up to 11 km, a good approximation at mid-latitudes.  You may use
$$\begin{align}
  & T(z)=290K-(6.5\tfrac{\deg }{\text{km}})z \\ 
 & P(z)/P(0)={{[T(z)/T(0)]}^{1.26/0.26}} \\ 
 & \rho (z)/\rho (0)={{[T(z)/T(0)]}^{1.00/0.26}} \\ 
\end{align}$$ 
In most climes, however, the air is not so dry.  On a muggy day with a dew point of 20°C, the partial pressure of water vapor will be 17.5 out of 760 torr.  That’s 2.30% by molar content or 1.43% by weight.  When a buoyant blob of air ascends, it will initially cool off at 9.8 deg/km, but when its temperature reaches the dew point, the water vapor will begin to condense, usually onto particulate nuclei.  (Caveat:  Very clean air can become supersaturated.  Surface tension acts as an obstacle to the formation of fog droplets from scratch.)  At this temperature, water releases about 585 cal/g as it condenses.  Given the slope of its vapor pressure curve, about 1.1 torr/deg at 20°C, condensation will roughly triple the heat capacity of saturated air, reducing $\gamma$ and the lapse rate until the air has dried out.  The effect is even greater in tropical climes, where the altitude of the tropopause can be as high as 17.5 km.  
A: The two basic equations are $$\rho=\frac{PM}{RT}$$ and $$\frac{dP}{dz}=-\rho g$$
If we eliminate the (altitude-dependent) density from these equations, we obtain:
$$\frac{dP}{dz}=-\frac{PM}{RT}g\tag{1}$$
For the troposphere, the equation for the adiabatic reversible expansion and compression of convected air parcels is:  $$\frac{P}{P_0}=\left(\frac{\rho}{\rho_0}\right)^{\gamma}$$where the subscript 0 revers to the values at ground level (z = 0).  If we combine this equation with the ideal gas law, we obtain:  $$\frac{T}{T_0}=\left(\frac{P}{P_0}\right)^{\frac{\gamma-1}{\gamma}}\tag{2}$$We can now substitute Eqn.2 into Eqn. 1 to obtain a equation (strictly valid for the troposphere) that involves only the pressure P (i.e., the density and temperature have been eliminated):  $$\frac{dP}{dz}=-\frac{MgP_0^{\frac{\gamma-1}{\gamma}}}{RT_0}P^{1/\gamma}$$If we integrate this equation between z = 0 and arbitrary z, we obtain:  $$\left(\frac{P}{P_0}\right)^{\frac{\gamma-1}{\gamma}}=1-\frac{(\gamma-1)}{\gamma}\frac{Mgz}{RT_0}\tag{3}$$Combining Eqns. 2 and 3 then yields:
$$T=T_0-\frac{(\gamma-1)}{\gamma}\frac{Mg}{R}z\tag{3}$$Eqn. 3 suggests that, for the assumed adiabatic convective expansion and compression of air parcels in the troposphere, the tropospheric temperature should vary linearly with altitude z.  The vertical temperature gradient predicted by this equation is called the "dry adiabatic lapse rate," and has a value of 9.8 C/km.  The actual temperature gradient observed in the atmosphere is less than this, with a value of 6.5 C/km.
A: The formula wikipedia quotes, 
\begin{align}
  P(z) = P_0 \exp \left( - \int_0^z \frac{M(z^*) g(z^*)}{R_\text{u} T(z^*)} \text{d} z^* \right)
\end{align}
provides a way to calculate $P(z)$ when $M(z)$, $g(z)$, and $T(z)$ are known. 
Unfortunately, $T(z)$ is complicated: in some layers, temperature increases with altitude, while in others it decreases with altitude. There isn't really a simple model to describe this variation because the effects that drive it (absorbtion of radiation by gas, convection) are not simple. On top of this, the composition of the atmosphere varies with elevation, so $M(z)$ is not a constant function. The answer to your question is therefore (sadly) that there is no simple analytical derivation of the type you seek. 
If you're interested in the variation of $P(z)$, I'd suggest you either look up the empirical trend or consider the simpler case of pure air at uniform $T$.
