# [Numpy-discussion] def of var of complex

Travis E. Oliphant oliphant@enthought....
Tue Jan 8 22:59:46 CST 2008

```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).

But, there is also merit to me in #3 (although it may be harder to
explain why the variance returns a complex number --- if that is what
you meant).

-Travis O.

> 3. Take the variances of the real and imaginary components independently. This
> is equivalent to taking the diagonal of the covariance matrix above. This
> wouldn't be the definition of "*the* complex variance" that anyone else uses,
> but rather another form of punting. "There isn't a single complex variance to
> give you, but in the spirit of broadcasting, we'll compute the marginal
> variances of each dimension independently."
>
> Personally, I like 1 a lot. I'm hesitant to support 2 until I've seen an actual
> application of that definition. The references I have been given in the ticket
> comments are all early parts of books where the authors are laying out
> definitions without applications. Personally, it feels to me like the authors
> are just sticking in the absolute()'s ex post facto just so they can extend the
> definition they already have to complex numbers. I'm also not a fan of the
> expectation-centric treatments of random variables. IMO, the variance of an
> arbitrary RV isn't an especially important quantity. It's a parameter of a
> Gaussian distribution, and in this case, I see no reason to favor circular
> Gaussians in CC over general ones.
>
> But if someone shows me an actual application of the definition, I can amend my
> view.
>
>

```