Standard deviation... I have this random variable $X = \{-1, 0, 1\}$ with uniform repartition $p(X = -1) = p(X = 0) = p(X = 1) = \frac{1}{3}$.
Expected value is $$E[X] = \sum_{i\in\{-1,0,1\}} x_ip_i = 0$$
Then variance should be : $$Var[X] = \sigma_{_X}^2 = \sum_{i\in\{-1,0,1\}}(x_i-E[X])^2p_i = (-1-0)^2\times\frac{1}{3} + (0-0)^2\times\frac{1}{3} + (1-0)^2\times \frac{1}{3} = \frac{2}{3}$$
And the standard deviation : $$\sigma_{_X} = \sqrt{\frac{2}{3}} \simeq 0.82$$
But according to Scilab and my phone, the standard deviation is actually $1$...
So what am I doing wrong ?
 A: It looks correct and I get the same results as your calculation with numpy.

import numpy as np
x = [-1,0,1]
np.std(x)
0.81649658092772603

So it is probably the way you calculate it.
A: Note $$\operatorname{Var}[X] = \operatorname{E}[X^2] - \operatorname{E}[X]^2 = \operatorname{E}[X^2] = \Pr[X^2 = 1] = \frac{2}{3}.$$  The first equality comes from the calculation $$\begin{align*} \operatorname{Var}[X] &= \operatorname{E}[(X-\operatorname{E}[X])^2] \\ &= \operatorname{E}[X^2 - 2\operatorname{E}[X]X + \operatorname{E}[X]^2] \\ &= \operatorname{E}[X^2] - 2 \operatorname{E}[X]\operatorname{E}[X] +\operatorname{E}[X]^2 \\ &= \operatorname{E}[X^2] - \operatorname{E}[X]^2. \end{align*}$$  The second equality holds because $\operatorname{E}[X] = 0$ as you calculated.  The third equality arises because of the definition of expectation, and observing that if $X \in \{-1, 0, 1\}$, then $X^2 \in \{0,1\}$, and the final equality is because $\Pr[X^2 = 1] = \Pr[X = 1] + \Pr[X = -1]$.
A: Apparently there are two types of standard deviation:
sample standard deviation :
and  
population standard deviation :
which is confusing because it was never introduced in textbooks...
