If $f(x)$ is analytic and non-negative, does convergence of $\int_a^{\infty} f(x)\,dx$ imply $\lim_{x\to\infty} f(x)=0$? It is well known that improper integrals don't have to satisfy $\lim_{x\to\infty} f(x)=0$ in order for $\int_a^{\infty} f(x)\,dx$ to converge, for instance $f(x)=\sin(x^2)$. It is also possible to construct such non-negative $f(x)$, and even continuous and non-negative, by taking $f(x)$ to be $0$ everywhere except for triangular spikes with appropriate converging areas.
I was wondering whether we can get such $f(x)$ which is smooth or even analytic. It seems clear that it should be possible to modify the triangular spikes example and get such a smooth $f(x)$ by using bump functions. However, what if we wish for $f(x)$ to be analytic? Bump functions no longer come to the rescue.
To summarize: does there exist a non-negative $f(x)$ which is analytic in $[a,\infty)$ and such that $\int_a^{\infty} f(x)\,dx$ converges, but such that $f(x)$ does not converge to $0$ at infinity?
 A: A comment (without proofs as those can be found in literature) that gives some idea about the complexity of this problem: the result is true if $f$ is the restriction of an entire function of order at most $1$ and finite type - and then it is true in a more general setting, namely that if $f$ has order at most one and is of finite type if it has order $1$ and if $\int_0^{\infty}|f(x)|^pdx<\infty$ for some $p >0$, then $|f(x)| \to 0, x \to \infty$.
(here we can reformulate the condition on $f$ as there is $c>0$ st $|f(z)|e^{-c|z|} \le M$ for all $z$ and some $M >0$)
On the other hand, Carleman approximation theorem implies that for any positive continuous function $g(x)>0, x \in \mathbb R$ (or $x \in I$ any interval), there is an entire function $f$ st $0< g(x)/2 < f(x)<g(x)$ for all $x \in \mathbb R$ (or $x \in I$). This clearly shows that the result fails in general even for analytic functions on $(a, \infty)$ that are restrictions of entire functions in the plane
As asked in the comments a few references; first for the case of an entire function of order at most one, the general result is in the Paley-Wiener circle of ideas and can be found for example in Boas Entire Functions Theorem 6.7.1 p 98
For example if $f^2$ is integrable on the line, the result follows directly from Paley-Wiener and Riemann-Lebesgue and of course if $f$ only integrable on the line, the result above implies $f^2$ integrable and more generally $f^p$ integrable for all $p>1$ since $f^p(x) \le f(x)$ for large enough $|x|$
The Carleman approximation theorem states that for any continuous function $\psi(x)$ on $\mathbb R$ (or some interval on the line and even more general sets in the plane) and any error function $E(x)>0$ there, one can find an entire function $F$ st $|F(x)-\psi(x)| < E(x), x \in \mathbb R$; applying this with $E=3g/4, \psi=g/4$ gives the result mentioned here - more generally one can interpolate any $0<h<g$ continuous on the line with such an $F$ using $E=(h+g)/2, \psi=(g-h)/2$
A simple (pretty much writing down some Taylor series to get the result for $\psi=0$ when we can actually say more and get an entire non-vanishing anywhere in the plane $F$ st $0<F(x)<E(x)$ on the line), and a few algebraic and integral manipulations) direct proof of the result and actually generalized to $\mathbb R^n$ is in the paper Uniform Approximations by Entire Functions by Stephen Scheinberg, while a more general approach including results for other sets than intervals on the line can be found in the book Lectures on Complex Approximations by D Gaier ch IV,3 p 149 and on
A: Here are two related problems that one might want to consider at the same time as this one.

Problem 1. Suppose that $ f $  is continuous on  $ [0,\infty) $  and that the improper integral $ \int_{0}^\infty f(x)\,dx $  converges. Find necessary and sufficient conditions on $ f $  so that  $ f(x) \to 0 $  as  $ x\to \infty .$


Problem 2. Suppose that  $ f $  is Riemann integrable on every bounded interval contained in  $ [0,\infty) $  and that the improper integral  $ \int_{0}^\infty f(x)\,dx $  converges. Find necessary and sufficient conditions on  $ f $  so that  $ f(x) \to 0 $  as  $ x\to\infty $.

The well-known answer to the first problem  is uniform continuity.
An answer to the second problem is given in this elementary paper:

R. B. Kelman and T. J. Rivlin. Conditions for Integrand of an
Improper Integral to be Bounded or Tend to Zero.  The American
Mathematical Monthly. Vol. 67, No. 10 (Dec., 1960), pp. 1019-1022.

