1. ## Integrable C-infinity function

Is there a function $\displaystyle f(x)$ of class $\displaystyle C^{\infty}$ defined on $\displaystyle (0,\infty)$ such that $\displaystyle \lim_{x\to0}f(x)=\infty$ and $\displaystyle \int_0^{\infty}f(x)\,dx$ exists and is finite?

I found a function:

$\displaystyle f(x)=\left\{\begin{array}{lr}\frac{1}{\sqrt{x}}:&0 <x\leq1\\e^{\frac{1-x}{2}}:&1\leq x<\infty\end{array}\right\}$

which fits everything except it's only class $\displaystyle C^1$ (because $\displaystyle f''(1)$ DNE).

Any ideas? I'm sure such a function exists; I'm just not sure whether it can be expressed in terms of elementary functions.

This is not a homework problem; I was just thinking.

2. What about $\displaystyle e^{-x}/\sqrt x$? It is $\displaystyle C^\infty$, it goes to ∞ at x=0, it's integrable on (0,1] (by comparison with $\displaystyle 1/\sqrt x$), and it's integrable on [1,∞) (by comparison with $\displaystyle e^{-x}$).

3. Excellent. I believe $\displaystyle \int_0^{\infty}\frac{e^{-x}}{\sqrt{x}}\,dx=\sqrt{\pi}$, for those curious.