StandardDeviation¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
Examples¶
All examples below are verified against the current Mathilda build.
Implementation notes¶
builtin_standard_deviation is essentially Sqrt[Variance[data]]. It reduces matrices column-wise via apply_columnwise. For an all-real numeric vector (n > 1) it evaluates Variance[data] and, if that returns an EXPR_REAL, returns expr_new_real(sqrt(...)) directly. Otherwise it evaluates Variance[data] and raises it to the 1/2 power via a Power[var, Rational[1,2]] node, letting the evaluator produce an exact or symbolic radical. ATTR_PROTECTED. Inherits Variance's sample (n-1) convention.
Protected.- Equivalent to
Sqrt[Variance[data]]. - For matrices, computes standard deviations of elements in each column.
Attributes: Protected.
Implementation status¶
Stable — documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
References¶
- Source:
src/stats.c - Specification:
docs/spec/builtins/statistics.md
Notes & additional examples¶
Worked examples¶
Results are kept exact; here the (unbiased, n − 1) estimate of a small sample:
Numericalize the same estimate to 40 digits:
In[1]:= N[StandardDeviation[{2, 4, 4, 4, 5, 5, 7, 9}], 40]
Out[1]= 2.1380899352993950774764278470380281724321
It relates to Variance as its square root:
A constant sample has zero spread:
Notes¶
StandardDeviation[data] returns the sample (unbiased, divide-by-n - 1)
standard deviation, i.e. Sqrt[Variance[data]]. Exact inputs give exact
radical output, which N[..., d] evaluates to arbitrary precision. A list of
length 1 or a constant list yields 0.