In [ ]:

```
n = 100000
```

In [ ]:

```
%timeit sum([1. / i**2 for i in range(1, n)])
```

In [ ]:

```
%%timeit s = 0.
for i in range(1, n):
s += 1. / i**2
```

In [ ]:

```
import numpy as np
```

In [ ]:

```
%timeit np.sum(1. / np.arange(1., n) ** 2)
```

You'll find all the explanations, figures, references, and much more in the book (to be released later this summer).

IPython Cookbook, by Cyrille Rossant, Packt Publishing, 2014 (500 pages).