Polarization of the vacuum and a quantum relativistic gas in an external field