[Numpy-tickets] [NumPy] #638: var should take absolute value for complex numbers.
NumPy
numpy-tickets@scipy....
Sat Dec 29 22:14:28 CST 2007
#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 | Keywords: var complex
------------------------+---------------------------------------------------
Hi!
I was just wondering why numpy.var gives me complex variances for complex
numbers.
e.g.
{{{
h1 = (randn(1000,1) + 1j *randn(1000,1)) / sqrt(2)
var(h1)
}}}
gives: {{{ (-0.00757596036094-0.0234608549341j) }}}
While I actually expect the output to be similar to that which is from
{{{
var(square(abs(h1)))
}}}
which gives: {{{ 0.994899762171 }}}
I feel this is an error, though I may be wrong. :-)
Thanks.
Kumar
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/638>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list