$e$

Euler number is an irrational constant in mathematics that appears frequently in calculations and unexpected scopes!
Actually I don't think ultimate high precison for this constant would be necessary in practice, but it was kind of a fun challenge for me to calculate e in high decimal place numbers.

To read the mathematical base and the code continue reading this page.
To see e in 100,000 decimal places click here.



One of the unique properties of e is its derivative (and seqently its integral):

$$ {d\over dx} e^x = e^x \Rightarrow {d\over dx} e^{f(x)} = f'(x)e^{f(x)} $$

On the other hand, It is possible to expand any function by powers of its parameter:

$$ f(x) = \sum_{n=0}^\infty {(x-a)^n\over n!}({d^nf(x)\over dx^n})|_{x=a} \Rightarrow \\ f(x) = f(a) + {f'(a)\over 1!}(x-a) + {f''(a)\over 2!}(x-a)^2 + {f'''(a)\over 3!}(x-a)^3 + \cdots $$

$a$ is a constant arbitrary number. By replacing $a$ by $0$:

$$ f(x) = \sum_{n=0}^\infty {x^n\over n!}({d^nf(x)\over dx^n})|_{x=0} = f(0) + {f'(0)\over 1!}x + {f''(0)\over 2!}x^2 + {f'''(0)\over 3!}x^3 + \cdots$$

The recent phrase is called the expansion of function $f(x)$. Now using expansion of the $f(x) = e^x$, we have:

$$ e^x = \sum^{\infty}_{n = 0} {x^n\over n!}({d^n e^x\over dx^n})|_{x=0} \Rightarrow $$ $$ e^x = 1 + x + {x^2\over 2!} + {x^3\over 3!} + \cdots $$

Now we place 1 as x:

$$ e = 1 + 1 + {1\over 2!} + {1\over 3!} + {1\over 4!} + \cdots $$

and obtain the phrase :

$$ e = \sum_{n=0}^{\infty} {1\over n!} $$

Now the problem is to calculate $\sum_{n=0}^{N}{1\over n!}$ sequence with a large enough $N$ and in high enough precision.
You can download the .py file here.