(Tao volume 2, P.50) Define $f^{(n)} : [ a,b] \to R$ by $f^{(n)}(x) = 2n$ if $x \in [1/2n, 1/n]$ and $f^{(n)}(x) = 0$ otherwise. We can see that $f^{(n)}$ converges pointwise to zero function. On the other hand, $\int_{[0,1]} f^{(n)} = 1$. As a result, $$ \lim_{n \to \infty} \int_{[a,b]} f^{(n)} \not=\int_{[a,b]} \lim_{n\to \infty} f^{(n)}.$$
The author points out that $f^{(n)}$ is discontinuous. However, the author further says that it is easy to make this function continuous and the limit still does not preserve integral.
It is not clear to me how we can make this function continuous. I guess that we need to connect two points $(x,0)$ and $(1/2n, 2n)$ for $x < 1/2n$, and the slope of this line need to get steeper as $n$ goes to infinity. I am not sure how to write such function. Any help would be appreciated.
One choice would be $$g^{(n)}(x) := \begin{cases} 2n & x\in[\frac1{2n},\frac1n], \\ (2n)^2x & x\in[0,\frac1{2n}],\\ 2n-2n^2(x-\frac1n) & x\in[\frac1n,\frac2n], \\ 0 & x\in[\frac2n,1].\end{cases} $$