# [Numpy-tickets] [NumPy] #638: var should take absolute value for complex numbers.

NumPy numpy-tickets@scipy....
Sat Jan 12 02:45:05 CST 2008

#638: var should take absolute value for complex numbers.
-------------------------+--------------------------------------------------
Reporter:  akumar       |        Owner:  somebody
Type:  defect       |       Status:  new
Priority:  normal       |    Milestone:  1.0.5
Component:  numpy.core   |      Version:  none
Severity:  normal       |   Resolution:
Keywords:  var complex  |
-------------------------+--------------------------------------------------
Comment (by cdavid):

I though a bit about it since the discussion on the numpy ML, and I have
to say I disagree with Robert on this one. I don't think the only
meaningful definition is to treat C as R^2. Variance is a special case of
covariance, and for complex random variables, covariance of X and Y,
assuming they are centered, is E[X conj(Y)] with conj(Y) the conjugate of
Y. This is the definition used in statistical signal processing (at least
the one I have always seen)

When considering complex random variables, it is often assumed some kind
of properties of the real part and the complex part (such as they have the
same variance, for example). For example, if you use complex Gaussian
random variables, by definition, Z = X + jY, with X and Y independent
Gaussian and same variance \sigma, Z have a variance equal to 2 * \sigma
variance, that is the trace of the covariance matrix of the real random
vector (X, Y), also obtained using the definition \sigma_Z \triangleq
\mathbb{E}[Z  \bar{Z}]. With Robert's definition, even for scalar complex
random variables, the density of a complex normal would involve matrices:
having a definition using only scalar is more appealing IMHO.

Those 2 arguments, variance as a special case of the covariance of two
variable, and staying scalar for complex random variables seem pretty
strong to me.

--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/638#comment:11>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.