Would it be possible to calculate which function in the Schwarz class of infinitely differentiable functions with compact support is closest to triangle wave?
Let us measure closeness as $$<f-g,f-g>_{L_2}^2 = \int_{-\infty}^{\infty}(f(x)-g(x))^2dx$$
I don't expect my knowledge in functional analysis to be strong and polished enough to answer this, but maybe one of you guys know how to?
EDIT of course we need to edit triangle wave to have compact support. Say it has compact support on $$x \in [-1-2N,1+2N], N\in \mathbb Z_+$$ In other words, $2N+1$ whole periods and it goes down to $0$ just at both ends of support.
The class of Schwartz class is not closed with respect to the $L^2$ norm, so there isn't necessarily a closest element. Indeed, in this case there isn't, as you can find arbitrarily close functions (take for instance convolutions with an approximate identity), but the triangle wave itself is not in the Schwartz.