# Find a function for which integral does not exist but converges as a limit of a sequence

Find an example of a function $$f:[0,\infty)\rightarrow \mathbb{R}$$ integrable on all intervals such that $$\lim_{n\rightarrow \infty}\int_0^n f$$ converges as a limit of a sequence, but such that $$\int_0^\infty f$$ does not exist.

I think a kind of function whose integral oscillates between positive and negative region as $$n\rightarrow \infty$$ may do the job here but I am not sure. Appreciate your help.

• The statement is surely missing an $n$ somewhere; presumably the limit is of the integral over $[0,n]$? Otherwise, you have the limit of a constant. – Arturo Magidin Feb 3 at 23:45
• Yes there was a typo, fixed it. – Sher Afghan Feb 3 at 23:47
• Your idea is fine. Take $f(x) = \sin(2\pi x)$. – Arturo Magidin Feb 3 at 23:51

Just define $$f$$ separately on the intervals $$(n,n+\frac 1 2)$$ and $$(n+\frac 1 2,n+1)$$, $$n=1,2,...,$$ so that $$\int_n^{n+\frac 1 2} f(x)dx=1$$ and $$\int_{n+\frac 1 2} ^{n+1} f(x)dx=-1$$.
• E.g. $f(x)=2$ for $n\le x<n+1/2$ and $f(x)=-2$ for $n+1/2\le x<n+1.$ – DanielWainfleet Feb 4 at 3:03