TITLE: Integral of the shark function
QUESTION [9 upvotes]: Messing around with functions is my hobby, I am asking this for fun, and maybe as a little challenge.
I gave this style of function the name "Shark function" because it looks like the shark's dorsal fin.
The function is of the form:
$$ f(x) = \frac{1}{\left(\sum_{i=0}^{n} x^i\right)^2 + 1}$$
And I wanted to ask if there is a formula for the integral:
$$ \lim_{n \to \infty} \int_{-\infty}^{\infty} f(x) \text{dx}$$

from first impression, it looks like it should be more than $1$, because the picture is way more than a $1 \times 1$ square.
Any ideas? :)

REPLY [15 votes]: If you let $\lim_{n \to \infty }f_n(x) = \lim_{n \to \infty }\frac{1}{\left(\sum_{i=0}^{n} x^i\right)^2 + 1}$ you get a geometric series in the denominator, so you can simplify the function as follows:
$$
\lim_{n \to \infty }f_n(x) =\frac{1}{\left(\sum_{i=0}^{\infty} x^i\right)^2 + 1} = \frac{1}{\left(\frac{1}{1-x}\right)^2 + 1} = 1 - \frac{1}{(x-1)^2+1}
$$
So indeed, the function you're approximating is just $1 - \frac{1}{(x-1)^2 +1}$ for $|x| <1$. This means that the integral you want can be calculated as follows:
\begin{align*}
\lim_{n \to \infty} \int_{-\infty}^{\infty} f_{n}(x) \text{dx} &=  \int_{-\infty}^{\infty} \lim_{n \to \infty} f_{n}(x) \text{dx}\\
& =\int_{-\infty}^{-1} 0 \ dx +\int_{-1}^{1}1 - \frac{1}{(x-1)^2 +1} dx + \int_{1}^{\infty} 0 \ dx\\
& =2 -\arctan(x-1)\Bigg\vert_{-1}^{1}\\
& =\boxed{2 -\arctan(2)}
\end{align*}
To justify interchanging the integral and the limit, you can use the Dominated convergence theorem with the function $g(x) = e^{-\left(\frac{x+1}{3}\right)^{2}}$, which is indeed integrable over all the reals and bounds your sequence of functions $|f_n(x)|$.