## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Profiling the Cython code

We will profile Cython and NumPy code that tries to approximate the Euler constant with the following formula:

See http://en.wikipedia.org/wiki/E_%28mathematical_constant%29 for more background information.

## How to do it...

This section demonstrates how to profile Cython code with the following steps:

1. For the NumPy approximation of e, follow these steps:
• First, we will create an array of `1` to `n` (`n` is `40` in our example).
• Then we will compute the cumulative product of this array, which happens to be the factorial. After that, we take the reciprocal of the factorials. Finally, we apply the formula from the Wikipedia page. At the ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required