def density(p, Z, R, T):
    """
    :param p: Absolute pressure of the natural gas, Pa
    :param Z: Compressibility factor of the natural gas, dimensionless
    :param R: Gas constant of the natural gas, J/(kg*K)
    :param T: Temperature of the natural gas, K
    :return: Density of the natural gas, kg/m3
    """
    return p / (Z*R*T)