std

Function std 

Source
pub fn std(args: &[Value]) -> Result<Value, RuntimeError>
Expand description

计算标准差

§功能

计算数字数组的样本标准差(方差的平方根)。

§参数

  • array: Array - 数字数组

§返回值

Number - 样本标准差

§公式

std = √variance = √[Σ(xᵢ - mean)² / (n - 1)]

§错误

  • 少于 2 个元素时抛出错误

§示例

Set data [2, 4, 6, 8, 10]
Set sd Std(data)            # 3.162...
Set scores [85, 90, 78]
Set sd Std(scores)          # 6.0