# Analysis of Euler's Formula

As I am a man with a very huge interest in Mathematics, I want to share series of some math myths(just for me) and deep dive into this area as curious about math. Euler's Formula is a very specific equation to start this series. It is magnificently pure and its mind behind comes from an extremely clever perspective of mathematics. No magic, just a prove of human brain to overcome problem of interests. Let's use Python as our tricky helper mate to understand this beauty of mathematics. 


### Euler's Formula

$e^{i\phi} = \cos(\phi) +  i\sin(\phi)$


### Euler's Idendity

$e^{i\pi} + 1 = 0$

Constant $e$ is one of the important mathematical constant. Otherwise most known constants, its magic comes from that it isn't defined by geometry such as pi. $e$ is a mathematical constant that is related to growth and rate of change. Its mindly source is compound interest. Okay, enough for its history😊  

#### Power Series of Definition
$e^x = 1 + \frac{x}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots = \sum_{n=0}^{\infty} \frac{x^n}{n!}.$

#### if $x = 1$,
$e =  \sum\limits_{n = 0}^{\infty} \frac{1}{n!} = 1 + \frac{1}{1} + \frac{1}{1\cdot 2} + \frac{1}{1\cdot 2\cdot 3} + \cdots$

#### also,
$e = \mathop {\lim }\limits_{n \to \infty } \left( {1 + \frac{1}{n}} \right)^n$

#### with this informations it is clear that,

$e = 2.718281828459045$

Let's prove it by using very easy piece of code.

$e = \mathop {\lim }\limits_{n \to \infty } \left( {1 + \frac{1}{n}} \right)^n$


```python
import cmath #package of complex numbers
from math import e,factorial 

print(e) #submodule provides e number here, #2.718281828459045

#Find the constant of euler's number 
#I divide the e_value of 2 part and final result of e is what we expected.
x = 1
e_value_firstPart = 1 + x + ((x**2)/factorial(2)) + ((x**3)/factorial(3)) + ((x**4)/factorial(4)) + ((x**5)/factorial(5)) + ((x**6)/factorial(6)) + ((x**7)/factorial(7)) 
e_value_secondPart = ((x**8)/factorial(8) + ((x**9)/factorial(9))) + ((x**10)/factorial(10))  + ((x**11)/factorial(11))  + ((x**12)/factorial(12)) + ((x**13)/factorial(13))
e_value_thirdPart = ((x**14)/factorial(14) + ((x**15)/factorial(15))) + ((x**16)/factorial(16))  + ((x**17)/factorial(17))  

e_value = e_value_firstPart + e_value_secondPart + e_value_thirdPart
print(e_value)

print(e == e_value) #True, nice to see it :)
```

    2.718281828459045
    2.718281828459045
    True


We need to take a closer look at the Taylor series of the sine and cosine functions. Just remember results.

<math>
\begin{align}
\sin x & = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots \\[8pt]
& = \sum_{n=0}^\infty \frac{(-1)^n x^{2n+1}}{(2n+1)!} \\[8pt]
\end{align}
</math>



<math>
\begin{align}
\cos x & = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots \\[8pt]
& = \sum_{n=0}^\infty \frac{(-1)^n x^{2n}}{(2n)!} \\[8pt]
\end{align}
</math>

Using the power-series definition we can reach the complex definition with sinus and cosine.


<math>\begin{align}
 e^{ix} &= 1 + ix + \frac{(ix)^2}{2!} + \frac{(ix)^3}{3!} + \frac{(ix)^4}{4!} + \frac{(ix)^5}{5!} + \frac{(ix)^6}{6!} + \frac{(ix)^7}{7!} + \frac{(ix)^8}{8!} + \cdots \\[8pt]
 &= 1 + ix - \frac{x^2}{2!} - \frac{ix^3}{3!} + \frac{x^4}{4!} + \frac{ix^5}{5!} - \frac{x^6}{6!} - \frac{ix^7}{7!} + \frac{x^8}{8!} + \cdots \\[8pt]
 &= \left( 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \frac{x^8}{8!} - \cdots \right) + i\left( x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots \right) \\[8pt]
 &= \cos x + i\sin x ,
\end{align}</math>


### by the way, Euler's Formula is 
$e^{i\phi} = \cos(\phi) +  i\sin(\phi)$


if $\phi = \pi$,

$e^{i\pi} + 1 = 0$

### it brings us euler identity.

### So what are the mutuals of cosine and sine by $e$ .

$e^{i\phi} = \cos(\phi) +  i\sin(\phi)$

$e^{-i\phi} = \cos(\phi) +  i\sin(-\phi)$


Remember cosine is even function and sine is odd function. If we do addition and substraction respectively,


$\sin(\phi) = \frac{1}{2}(e^{i\phi} - e^{-i\phi})$

$\cos(\phi) = \frac{1}{2}(e^{i\phi} + e^{-i\phi})$

### General Defination For Engineering Math

$\sin(\omega t + \theta) = \frac{1}{2}(e^{i(\omega t + \theta)} - e^{-i(\omega t + \theta)})$

$\cos(\omega t + \theta) = \frac{1}{2}(e^{i(\omega t + \theta)} + e^{-i(\omega t + \theta)})$

- $\theta$ is phase, $\omega$ is angular frequency
