• https://me.yahoo.com
COST (GBP)
0.20
1.00
0

# Standard Deviation

Calculates the standard deviation of a given population.
Controller: CodeCogs
Contents

C++

## Stdev

 template doublestdev( int n T* data bool total = false )
The standard deviation $\inline&space;&space;\sigma$ is defined by the square root of the bias-corrected variance

$\sigma&space;=&space;\sqrt{&space;\frac&space;{1}{N-1}&space;\sum_{i=1}^N&space;(x_i&space;-&space;\overline{x})^2&space;}$

Physical scientists often use the term root-mean-square as a synonym for standard deviation when they refer to the square root of the mean squared deviation of a quantity from a given baseline. The standard deviation arises naturally in mathematical statistics through its definition in terms of the second central moment. However, a more natural but much less frequently encountered measure of average deviation from the mean that is used in descriptive statistics is the so-called mean deviation.

If the value of the boolean argument total is true, then the standard deviation is computed using the following formula:
$\sigma&space;=&space;\sqrt{&space;\frac&space;{1}{N}&space;\sum_{i=1}^N&space;(x_i&space;-&space;\overline{x})^2&space;}$

## References

MathWorld, http:mathworld.wolfram.com/StandardDeviation.html

### Example 1

#include <codecogs/statistics/moments/standard_deviation.h>
#include <iostream>
int main()
{
double x[5] = {2.5 , 6.2 , 8.0 , 9.6 , 3.8};
double dev = Stats::Moments::stdev<double>(5, x);
std::cout << "The population standard deviation is: " << dev << std::endl;
return 0;
}
Output:
The population standard deviation is: 2.9192

### Parameters

 n the size of the population data the actual population data given as an array total Default value = false

### Returns

the standard deviation mean of a given population

### Authors

Anca Filibiu (August 2005)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.