Pressure and altitude I am going to ask a simple question, for sure.
The pressure with respect to the altitude is given by this formula

Where 


*

*sea level standard atmospheric pressure p0 = 101325 Pa

*sea level standard temperature T0 = 288.15 K

*Earth-surface gravitational acceleration g = 9.80665 m/s2.

*temperature lapse rate L = 0.0065 K/m

*universal gas constant R = 8.31447 J/(mol·K)

*molar mass of dry air M = 0.0289644 kg/mol


( from Wikipedia )
In addition to this, we have $L = \frac{g}{C_p}$ where $g = 9.80665\ m/s^2$ and $C_p$ is the constant pressure specific heat $ = 1007\ J/(Kg\ K)$
Understood and thence the above formula can be written in this simple way:
$$\boxed{P = P_0\left(1 - \alpha h\right)^{\beta}}$$
where
$\alpha = \frac{g}{C_p\ T_0} \approx 3.3796\cdot 10^{-5}\ m^{-1}$
$\beta = \frac{C_p\ M}{R} \approx 3.5081971$
On the other side we learnt from the elementary physics that the formula for the pressure is also given by
$$\boxed{P = P_0 + \rho g h}$$
Where $\rho$ is the air density $(1.23\ kg/m^3)$.
The question
First thing first: I assumed that
$$h = h_1 - h_0$$
is that correct? I mean it's the difference between two heights (maybe from a table and the ground, just to say).
Since the two formulae seems quite different, I tried with a numerical example in calculating the pressure in two points, with a difference of height about $0.18$ m and I got a really similar result.
Since the first formula is more technique, I think it's the correct formula but I would like to understand if one could pass from the first to the second or vice versa somehow.
Also I would like to know if there are cases in which I can use only the second formula or only the first formula!
 A: For a compressible gas, your elementary physics formula changes to:
$$\frac{dp}{dz}=-\rho g$$whre z is the elevation (above ground level) and $\rho$ is the density of the gas.  From the ideal gas law, $$\rho=\frac{pM}{RT}$$ where M is the molecular weight.  If we combine these two equations, we get the "barotropic" equation:$$\frac{1}{p}\frac{dp}{dz}=-\frac{Mg}{RT}$$If we integrate the barotropic equation from 0 to z, we get:$$p=p_0\exp\left(-\frac{Mg}{R}\int_0^zT(z')dz'\right)$$This is leading to your first equation.
A: The key to understand the complex first formula is that air is compressible, that is, its density changes with pressure.
Your second formula, the simpler one, assumes a constant density in the fluid. It is useful when the medium is not compressible (such as the sea), or when the difference in height, thus in pressure, thus in density is small (such as from the floor to the ceiling of a room).
In the first formula, the complex one, the variation on density because of the difference in pressure is taken into account, and an exponential expression results, where the pressure asymptotically goes to 0 as the height goes to infinity.
A: For a height difference of 0.18 m the density of air changes very little so $h\rho g$ can be used.  As the Wikipedia article says "At low altitudes above the sea level, the pressure decreases by about 1.2 kPa for every 100 meters and this is the constant density of air (1.23 kg/m$^3$) approximation.  The full blown formula is for much higher altitudes.
If you look at the graph of pressure against height then for the first 2000 metres or so it approximates to a straight line  - constant density.

