# Euler function using COS and SIN

I already asked a similar question but now I have source code and I still don't get it. I am trying to understand the Euler formula :$$e^{ix} = \cos(x) + i\sin(x)$$

Since I am not a mathematician but a programmer, I looked at the source code of the .NET framework for the EXP function. From what I understand, this function should be $e^{ix}$. Here is the code:

public static Complex Exp(Complex value) // The complex number raised to e

{
Double temp_factor = Math.Exp(value.m_real);
Double result_re = temp_factor * Math.Cos(value.m_imaginary);
Double result_im = temp_factor * Math.Sin(value.m_imaginary);
return (new Complex(result_re, result_im));
}


If the formula $e^{ix}$ should replace $\cos(x) + i\sin(x)$, why does the EXP function still uses COS and SIN?

• Read it as $\,e^{a+ib} = e^a \cdot e^{ib}= e^a \cos(b) + i \,e^a \sin(b)\,$. – dxiv Feb 8 '18 at 20:19
• The Euler formula doesn't want to replace anything, you can understand it even as the definition of the exponential function for purely imaginary argument. Why would anybody replace existing functionality (implemented in the hardware of the floating point unit of contemporary processors) by a program for complex numbers (not supported by hardware of existing processors)? – Professor Vector Feb 8 '18 at 20:22
• So does that mean that the formula from the left is in fact calculated using the formula from the right? Like a function f(x) = 2x ? I thought that it was an equivalence like cos(x) = sin(x+90). – Choz Feb 9 '18 at 3:10