I was wondering whether the Schwartz functions are also dense in
$$\{f \in L^2(\mathbb{R}^n); \int\_{\mathbb{R}^n} |x|^2 |f(x)|^2 dx + \int\_{\mathbb{R}^n}|\xi|^2 |\hat{f}(\xi)|^2 d \xi < \infty\}$$


where the norm is given by $$||f||\_{L^2}^2 = \int (1+|x|^2) |f(x)|^2 dx + \int (1+|\xi|^2) |\hat{f}(\xi)|^2 d \xi.$$


If we would only have one summand, then this would be a $H^1-$ Sobolev summand norm and for this space it is of course true, but what about this case here, where we have an additional term in the norm?


I suspect it is true, but how can I see it?


Edit: I want to note that the argument given in the comments is incomplete.



Density argument with Schwartz functions?
We can do this by approximating the derivative of such an $f$ in $L^2$, as follows: Given $\epsilon>0$, take $L>0$ so large that $\int\_{|x|>L}(x^2|f|^2+|f'|^2)<\epsilon$.


Now approximate $f'$ in $L^2(-L,L)$ by an $h\in C\_0^{\infty}(-L,L)$, and put
$$
g(x)=f(-L)+\int\_{-L}^x h(t)\, dt .
$$
Finally, we modify $g$ on the two intervals $L\le |x|\le L+1$ to obtain a compactly supported smooth function. Notice that this can be done in such a way that $|g|, |g'|\lesssim |f(\pm L)|$ on these intervals.


We're now hoping that both $\|(1+|x|)(g-f)\|\_2$ and $\|g'-f'\|\_2$ will be small, and that is pretty much clear already, except for the contributions of the type $\int\_{L\le x\le L+1} x^2|g|^2\simeq L^2|f(L)|^2$. However, these are harmless also because it can not be the case that for all large $L$, at least one of $|f(L)|, |f(-L)|$ is $\ge\epsilon/L$ (in that case $xf$ would not be in $L^2$), so we just need to choose our $L$'s carefully.


