  In this work, we propose new statistical tools that are capable of
characterizing the simultaneous dependence of dark matter and gas clustering on
the scale and the density environment, and these are the environment-dependent
wavelet power spectrum (env-WPS), the environment-dependent bias function
(env-bias), and the environment-dependent wavelet cross-correlation function
(env-WCC). These statistics are applied to the dark matter and baryonic gas
density fields of the \texttt{TNG100-1} simulation at redshifts of
$z=3.0$-$0.0$, and to \texttt{Illustris-1} and \texttt{SIMBA} at $z=0$. The
measurements of the env-WPSs suggest that the clustering strengths of both the
dark matter and the gas increase with increasing density, while that of a
Gaussian field shows no density dependence. By measuring the env-bias and
env-WCC, we find that they vary significantly with the environment, scale, and
redshift. A noteworthy feature is that at $z=0.0$, the gas is less biased in
denser environments of $\Delta \gtrsim 10$ around $3 \ h\mathrm{Mpc}^{-1}$, due
to the gas reaccretion caused by the decreased AGN feedback strength at lower
redshifts. We also find that the gas correlates more tightly with the dark
matter in both the most dense and underdense environments than in other
environments at all epochs. Even at $z=0$, the env-WCC is greater than $0.9$ in
$\Delta \gtrsim 200$ and $\Delta \lesssim 0.1$ at scales of $k \lesssim 10 \
h\mathrm{Mpc}^{-1}$. In summary, our results support the local density
environment having a non-negligible impact on the deviations between dark
matter and gas distributions up to large scales.
