[R] Euler identity with complex exp

2012-01-30 Thread Joseph Park
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]

Re: [R] Euler identity with complex exp

2012-01-30 Thread Joseph Park
Thanks Michael Peter. Michael's expansion makes sense. This is what I expected: a = pi + 0i complex( real = cos(Re(a)), imaginary = sin(Im(a)) ) [1] -1+0i Not this: exp(a) [1] 23.14069+0i Is this not an implementation of Euler's formula: complex( real = cos(2*pi), imaginary =

Re: [R] Euler identity with complex exp

2012-01-30 Thread Joseph Park
Thanks Gentlemen. Now I see the disconnect. I was misusing exp( i x ) and expecting to get exp( i x ) = cos x + i sin x, which is Euler's formula. Since it is a mapping of a real number onto the unit circle in the complex plane, any answer it gives must have a magnitude of 1 and the argument to

Re: [R] Cross Spectrum : Conversion of 2-D spectrum into a single complex array

2011-09-24 Thread Joseph Park
Perhaps this question is inappropriate or posted to the wrong list? Any guidance would be appreciated. Thanks. --- On Fri, 9/23/11, Joseph Park jpark...@att.net wrote: From: Joseph Park jpark...@att.net Subject: Cross Spectrum : Conversion of 2-D spectrum into a single complex array To: r

[R] Cross Spectrum : Conversion of 2-D spectrum into a single complex array

2011-09-23 Thread Joseph Park
Hi, I'm wondering why the spectrum() phase of quadrature couple isn't purely +/-pi. But mostly, I'm looking for a recommended way to take a 2-D spectrum and convert it into a single complex array. Kindly consider: # 10 Hz sine wave 10 seconds long sampled at 50 Hz deltaT = 1/50 t =

Re: [R] S4 vs Reference Classes

2011-09-14 Thread Joseph Park
the difference is between creating a SetReplaceMethod vs a SetMethod, since it seems that in either case one has to 'externally' assign the slot value. My limitation, of course. On 9/14/2011 12:17 AM, Martin Morgan wrote: On 09/13/2011 10:54 AM, Joseph Park wrote: Hi, I'm looking

Re: [R] S4 vs Reference Classes

2011-09-14 Thread Joseph Park
, or perhaps as suggested, hybridize the current app. On 9/14/2011 12:02 PM, Martin Morgan wrote: On 09/14/2011 06:01 AM, Joseph Park wrote: Thanks Martin. What i'm hoping to do is have a class object, with a member method that can change values of slots in the object, without

[R] S4 vs Reference Classes

2011-09-13 Thread Joseph Park
Hi, I'm looking for some guidance on whether to use S4 or Reference Classes for an analysis application I'm developing. I'm a C++/Python developer, and like to 'think' in OOD. I started my app with S4, thinking that was the best set of OO features in R. However, it appears that

Re: [R] Spectral Coherence

2011-07-12 Thread Joseph Park
Thanks you! I should have realized that without explicitly engaging some form of averaging (which raises a windowing question) that the coh is always 1. On 7/12/2011 4:48 AM, Rolf Turner wrote: On 12/07/11 09:04, Joseph Park wrote: Greetings, I would like

[R] Spectral Coherence

2011-07-11 Thread Joseph Park
Greetings, I would like to estimate a spectral coherence between two timeseries. The stats : spectrum() returns a coh matrix which estimates coherence (squared). A basic test which from which i expect near-zero coherence: x = rnorm(500) y = rnorm(500) xts = ts(x, frequency