We provide necessary and sufficient conditions for the space of smooth functions with compact supports $C^\infty_C(\Omega)$ to be dense in Musielak-Orlicz spaces $L^\Phi(\Omega)$ where $\Omega$ is an open subset of $\mathbb{ R}^d$. In particular we prove that if $\Phi$ satisfies condition $\Delta_2$, the closure of $C^\infty_C(\Omega)\cap L^\Phi(\Omega)$ is equal to $L^\Phi(\Omega)$ if and only if the measure of singular points of $\Phi$ is equal to zero. This extends the earlier density theorems proved under the assumption of local integrability of $\Phi$, which implies that the measure of the singular points of $\Phi$ is zero. As a corollary we obtain analogous results for Musielak-Orlicz spaces generated by double phase functional and we recover the well known result for variable exponent Lebesgue spaces.
Categories: math.FA