[Numpy-discussion] unexpected behaviour of numpy.var

David Grant davidgrant at gmail.com
Tue Aug 1 11:56:15 CDT 2006


I also couldn't reproduce it on my 0.9.8 on Linux.

DG

On 8/1/06, David L Goldsmith <David.L.Goldsmith at noaa.gov> wrote:
>
> Hi, Hanno.  I ran your sample session in numpy 0.9.8 (on a Mac, just so
> you know; I don't yet have numpy installed on my Windows platform, and I
> don't have immediate access to a *nix box) and could not reproduce the
> problem, i.e., it does appear to have been fixed in 0.9.8.
>
> DG
>
> Hanno Klemm wrote:
> > Hello,
> >
> > numpy.var exhibits a rather dangereous behviour, as I have just
> > noticed. In some cases, numpy.var calculates the variance, and in some
> > cases the standard deviation (=square root of variance). Is this
> > intended? I have to admit that I use numpy 0.9.6 at the moment. Has
> > this been changed in more recent versions?
> >
> > Below a sample session
> >
> >
> > Python 2.4.3 (#1, May  8 2006, 18:35:42)
> > [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> >
> >>>> import numpy
> >>>> a = [1,2,3,4,5]
> >>>> numpy.var(a)
> >>>>
> > 2.5
> >
> >>>> numpy.std(a)
> >>>>
> > 1.5811388300841898
> >
> >>>> numpy.sqrt(2.5)
> >>>>
> > 1.5811388300841898
> >
> >>>> a1 = numpy.array([[1],[2],[3],[4],[5]])
> >>>> a1
> >>>>
> > array([[1],
> >        [2],
> >        [3],
> >        [4],
> >        [5]])
> >
> >>>> numpy.var(a1)
> >>>>
> > array([ 1.58113883])
> >
> >>>> numpy.std(a1)
> >>>>
> > array([ 1.58113883])
> >
> >>>> a =numpy.array([1,2,3,4,5])
> >>>> numpy.std(a)
> >>>>
> > 1.5811388300841898
> >
> >>>> numpy.var(a)
> >>>>
> > 1.5811388300841898
> >
> >>>> numpy.__version__
> >>>>
> > '0.9.6'
> >
> >
> >
> > Hanno
> >
> >
>
>
> --
> HMRD/ORR/NOS/NOAA <http://response.restoration.noaa.gov/emergencyresponse/
> >
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>



-- 
David Grant
http://www.davidgrant.ca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060801/68be9188/attachment-0001.html 


More information about the Numpy-discussion mailing list