Approximating a subclass of $L^2(\mathbb{R})$ by Schwartz functions within similar subclass It is well-known that real valued Schwartz functions on $\mathbb{R}_+$ $\mathcal{S}(\mathbb{R}_+)$ are dense in the set of square integrable functions on $\mathbb{R}_+$ $L^2(\mathbb{R}_+)$. We can further restrict this result to nonnegative functions: any nonnegative $L^2$ function on $\mathbb{R}_+$ can be approximated by a nonnegative Schwartz function on $\mathbb{R}_+$.
Now $L^2(\mathbb{R}_+)$ functions can be expanded on the orthonormal basis of Laguerre functions $\{\mathscr{L}_n\}_{n \in \mathbb{N}}$ where $\mathscr{L}_n : x \in \mathbb{R}_+ \mapsto L_n(x) e^{\frac{-x}2}$ with $L_n$ is the n$^{\text{th}}$ Laguerre polynomial. So for $f \in L^2(\mathbb{R}_+) $ there exists a square integrable sequence $\{ f_n \} \in \ell^2$ such that:
$$
f = \sum_n f_n \mathscr{L}_n.
$$
And likewise we can expand a Schwartz function with a rapidly decreasing sequence.
My question is the following: can I approximate a nonnegative $L^2$ function on $\mathbb{R}_+$ with nonnegative coefficients $\{ f_n \}$ by a nonnegative Schwartz function on $\mathbb{R}_+$ with again nonnegative coefficients?
My fear is that if one of the coefficient $f_k$ is zero then the corresponding sequence of Schwartz functions converging to $f$ may have the k$^{\text{th}}$ converging to $f_k$ from below and thus being negative. So the additional constraint asking for non negative coefficients may be too much (though it would be true if I were asking for positive coefficients).
 A: With your understanding of "positive", the answer is negative.
Take a closed bounded totally disconnected set $E\subset R$ of positive measure. Let $f$ be the characteristic function of this set. I claim that it is
not a sum of positive functions of the Schwartz space. Indeed, suppose
that $f=\sum\phi_n$ is such a sum (the series is convergent in $L^2$. Then evidently we must have $\phi_n(x)=0$ for all $n$ and for all $x$ in the
complement of $E$. But then $\phi_n=0$ since $\phi_n$ are continuous and $E$
is nowhere dense.
A: Let us follow the way that density is proven: obviously simple non-negative functions are dense (simple means finite linear combination of indicatrix functions of sets with finite measure) in non-negative $L^2$ functions. Then the matter is reduced to the approximation of $\mathbf 1_E$ for a Borel set $E$ with finite measure. Then you can use that for any positive $\varepsilon$,  there exists $K$ compact and $\Omega$ open with
$$
K\subset E\subset \Omega, \quad \mu(E\backslash K)<\varepsilon.
$$
Then you can indeed construct a function in $C^\infty_c(\Omega;[0,1])$ which is 1 on $K$: the latter construction goes explicitly by convolution of $\mathbf 1_{K+\delta}$ by a standard mollifier which can be chosen as non-negative.
