Not sure why you think the formula does not hold... but am guessing you think that sin(x) and cos(x) are have values in [-1, 1]? Well that only holds for real x. If you have a complex x, sin(x) and cos(x) are unbounded - indeed, if you can write x=iy and y is real, you can show (up to my own ignorance of possible signs) cos(x) = cosh(y), and sin(x) = -sinh(y) simply by expressing (from the formula you wrote) cos(x) and sin(x) as
cos(x) = ( exp(ix) + exp(-ix) )/2 and sin(x) = ( exp(ix) - exp(-ix) )/2 In any case, plug any complex number into exp( ix ) and cos x + i sin x in R and you will get the exact same answers. HTH, Peter On Mon, Jan 30, 2012 at 7:37 AM, Joseph Park <josephp...@ieee.org> wrote: > Hi, > > Am i doing something silly here in expecting Euler's > formula to be handled by exp? exp( ix ) = cos x + i sin x. > The first example below follows this, the others not. > > Thanks for the education! > > > exp( complex(real = 0, imag = 2*pi) ) > [1] 1-0i > > exp( complex(real = pi, imag = 2*pi) ) > [1] 23.14069-0i > > exp( complex(real = pi/2, imag = 0) ) > [1] 4.810477+0i > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.