I am trying to find examples of the following but have only found ones with finite domain:
Give an example of $f, f_{j} \in L^{2}(\mathbb{R}), j \in\{1,2, \ldots\}$ for which $f_{j} \longrightarrow f \quad$ uniformly in $\mathbb{R}$, but not in $L^{2}(\mathbb{R}) .$
Give an example of $f, f_{j} \in L^{2}(\mathbb{R}), j \in\{1,2, \ldots\}$ for which $f_{j} \longrightarrow f \quad$ in $L^{2}(\mathbb{R})$, but not uniformly in $\mathbb{R}$
I can't think of an example for the first case but for the second case I've found this example but I'm not sure if it is correct:
$f_{n}: \mathbb{R} \rightarrow \mathbb{R}: t \rightarrow\left\{\begin{array}{ccc}-1 & \text { if } & -\infty<t<-\frac{1}{n} \\ n t & \text { if } & -\frac{1}{n} \leq t \leq \frac{1}{n} \\ 1 & \text { if } & \frac{1}{n}<t<+\infty\end{array}\right.$
Can anyone think of any examples for these?
For the first one, let $f_{n}(x)=\dfrac{1}{n}\chi_{[-n^{3},n^{3}]}(x)$, then $|f_{n}(x)|\leq\dfrac{1}{n}$, so $f_{n}\rightarrow 0$ uniformly on $\mathbb{R}$. But then $\displaystyle\int_{\mathbb{R}}f_{n}^{2}(x)dx=\dfrac{1}{n^{2}}\cdot 2n^{3}=2n\rightarrow\infty$, so $f_{n}$ does not converge to $0$ in $L^{2}(\mathbb{R})$.