# Integral of the shark function

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? :)

• $2 - \arctan(2) \approx 0.89285$ Commented Sep 11, 2021 at 14:31
• Your hobbit! en.m.wikipedia.org/wiki/Hobbit Did you maybe mean hobby? :0) Commented Sep 11, 2021 at 14:57
• @AlexKruckman my bad! lol (unfortunately I did not watch the hobbit :( ) Commented Sep 11, 2021 at 15:25

## 2 Answers

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)|$$.

Using a Lebesgue dominated convergence argument you can get $$\lim_{n\rightarrow\infty} \int_{-\infty}^{\infty} f_n(x)dx = \int_{-\infty}^{\infty} \lim_{n\rightarrow\infty} f_n(x)dx$$ and $$\lim_{n\rightarrow\infty} f_n(x) = \left\{\begin{array}{cc} \frac{1}{1 + \frac{1}{(1-x)^2}} & \mbox{if -1 Then from WolframAlpha we can evaluate $$\int_{-1}^1 \frac{1}{1+\frac{1}{(1-x)^2}}dx$$:

https://www.wolframalpha.com/input/?i=int+1%2F%281%2B1%2F%281-x%29%5E2%29%2C+x%3D-1..1