[Numpy-tickets] [NumPy] #388: Doc error for std in http://scipy.org/Numpy_Example_List#std

NumPy numpy-tickets at scipy.net
Wed Nov 22 11:30:50 CST 2006

```#388: Doc error for std in http://scipy.org/Numpy_Example_List#std
----------------------+-----------------------------------------------------
Reporter:  g2boojum  |        Owner:  somebody
Type:  defect    |       Status:  closed
Priority:  normal    |    Milestone:
Component:  Other     |      Version:
Severity:  normal    |   Resolution:  fixed
Keywords:            |
----------------------+-----------------------------------------------------
Changes (by rkern):

* status:  new => closed
* resolution:  => fixed

Old description:

> According to the example in http://scipy.org/Numpy_Example_List#std,
> array.std() uses an N-1 normalization
> (and that's what the example shows).  With numpy-1.0 on my machine:
>
> In [22]: a = array([1., 2., 7.])
>
> In [23]: a.std()
> Out[23]: 2.62466929134
>
> In [24]: sqrt(((1.-a.mean())**2 + (2.-a.mean())**2 + (7.-a.mean())**2)/3)
> Out[24]: 2.6246692913372702
>
> In [25]: sqrt(((1.-a.mean())**2 + (2.-a.mean())**2 + (7.-a.mean())**2)/2)
> Out[25]: 3.214550253664318 <-- That's the result in the example
>

New description:

According to the example in http://scipy.org/Numpy_Example_List#std,
array.std() uses an N-1 normalization
(and that's what the example shows).  With numpy-1.0 on my machine:

{{{

In [22]: a = array([1., 2., 7.])

In [23]: a.std()
Out[23]: 2.62466929134

In [24]: sqrt(((1.-a.mean())**2 + (2.-a.mean())**2 + (7.-a.mean())**2)/3)
Out[24]: 2.6246692913372702

In [25]: sqrt(((1.-a.mean())**2 + (2.-a.mean())**2 + (7.-a.mean())**2)/2)
Out[25]: 3.214550253664318 <-- That's the result in the example

}}}

Comment:

Note that that page is a wiki page and can be edited by anyone after
creating an account for themselves. If you see an error there, you can fix
it yourself.

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