# [Numpy-discussion] def of var of complex

David Cournapeau david@ar.media.kyoto-u.ac...
Wed Jan 9 01:50:35 CST 2008

Robert Kern wrote:
> Travis E. Oliphant wrote:
>
>> Robert Kern wrote:
>>
>>> Neal Becker wrote:
>>>
>>>
>>>> I noticed that if I generate complex rv i.i.d. with var=1, that numpy says:
>>>>
>>>> var (<real part>) -> (close to 1.0)
>>>> var (<imag part>) -> (close to 1.0)
>>>>
>>>> but
>>>>
>>>> var (complex array) -> (close to complex 0)
>>>>
>>>> Is that not a strange definition?
>>>>
>>>>
>>> 2. Take a slightly less naive formula for the variance which seems to show up in
>>> some texts:
>>>
>>>    mean(absolute(z - mean(z)) ** 2)
>>>
>>> This estimates the single parameter of a circular Gaussian over RR^2
>>> (interpreted as CC). It is also the trace of the covariance matrix above.
>>>
>>>
>> I tend to favor this interpretation because it is used quite heavily in
>> signal processing applications where "circular" Gaussian random
>> variables show up quite a bit --- so much so, in fact, that most EE
>> folks would expect this as the output and you would have to explain to
>> them why there may be other choices that make sense.
>>
>> So, #2 is kind of a nod to the signal-processing community (especially
>> the communication section).
>>
>
> <sigh> Fair enough. I relent. You implement it; I'll document the correct^Wcov()
> alternative.  :-)
>
>
Not that I find the argument pertinent most of the time, but if there is
no clear argument in favor of one formula, would following matlab
conventions be ok ?

To me, the definition 2 makes more sense, as a perticular case of the
correlation between two different complex random variables: \mathbb{E}[X
\bar{Y}], such as it keeps the nice properties of scalar product.

cheers,

David