Let's import NumPy and Numexpr.

In [ ]:

```
import numpy as np
import numexpr as ne
```

We generate three large vectors.

In [ ]:

```
x, y, z = np.random.rand(3, 1000000)
```

In [ ]:

```
%timeit x + (y**2 + (z*x + 1)*3)
```

In [ ]:

```
%timeit ne.evaluate('x + (y**2 + (z*x + 1)*3)')
```

In [ ]:

```
ne.ncores
```

In [ ]:

```
for i in range(1, 5):
ne.set_num_threads(i)
%timeit ne.evaluate('x + (y**2 + (z*x + 1)*3)')
```

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