Function $f$ such that $f$ is integrable, but $\lim \sup_x f(x) = \infty$ I have to find a function $f$ with the following properties:
$$\lim_{x \to \infty} \sup f(x) = \infty$$
$$f \in L^1$$
What I came up with was $f(x) = x^2 \sin (x)$.
$f(-x) = -f(x)$ so it is an odd function. It follows that
$$\int_{(-\infty,\infty)} f(x) d\mu = \int_{(-\infty,0)} f(x) d\mu + \int_{(\infty,0)} f(x) d\mu = \int_{(\infty,0)} f(-x) d\mu + \int_{(\infty,0)} f(x) d\mu$$
$$ = -\int_{(\infty,0)} f(x) d\mu + \int_{(\infty,0)} f(x) d\mu = 0$$
Finally, since $f(x)$ oscillates, we have a sequence of local maxima. Since the amplitude grows with $x^2$ the amplitude grows monotonically to infinity from $0$ to $\infty$. Therefore, the sequence of local maxima from $(0, \infty)$ is an increasing unbounded sequence.
This implies
$$\lim_{x\to \infty} \sup f(x) = \infty$$
Is this rigorous enough?
 A: The fact is that, $f(x)=x^{2}\sin x$ does not belong to $L^{1}(\mathbb{R})$, so you cannot do the integral splitting at the first place.
You can look at $|f(x)|=x^{2}|\sin x|$ and consider the sum of the integral on the intervals $[n\pi+\pi/3,(n+1)\pi-\pi/3]$ for each $n=0,1,2,...$
An easy example would be like, $f(x)=n$ for $x=n$ and $f(x)=0$ for otherwise. Then sequence $(x_{n})$, $x_{n}=n$ is such that $\infty=\lim_{n\rightarrow\infty}f(x_{n})\leq\limsup_{x\rightarrow\infty}f(x)$ because $x_{n}\rightarrow\infty$.
$f$ is zero a.e. certainly it is integrable.
A: The function you've written is not Lebesgue integrable on R. Also the cancellation, at the end of your computation, does not make any sense unless you know that both quantities are finite. Unfortunately, in our case, they are not. I agree with your supremum part. In fact, you can see that the cute function sin(x) is not integrable on R let alone your x^2 sin(x).
A: *Here is an example which is continuous:
$$f(x)= \left\{ 
\begin{array}{lc}
n^4(x-n+\frac{1}{n^3}) & \mbox{ if there exists $n \in \mathbb N$ such that } n-\frac{1}{n^3} \leq x \leq n \\
n-n^4(x-n) & \mbox{ if there exists $n \in \mathbb N$ such that }  n \leq x \leq n+\frac{1}{n^3}\\
0 &\mbox{ otherwise }
\end{array}
\right.
$$
Graphically, $f(x)$ is a triangle with heigth $n$ and area $\frac{1}{n^2}$ around each $n$.
