From efe7ee0ffccc8ce8bc54c8dc65cf27b058876014 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Mon, 30 May 2022 10:07:52 +0200 Subject: [PATCH] fix(curriculum): external deviation wiki link in CIP (#46226) --- .../cumulative-standard-deviation.md | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md b/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md index c3eac32fe97..f8d927c5ac6 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md +++ b/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/cumulative-standard-deviation.md @@ -8,7 +8,32 @@ dashedName: cumulative-standard-deviation # --description-- -Write a function that takes an array of numbers as parameter and returns the [standard deviation]() of the series. +Suppose that the entire population of interest is eight students in a particular class. For a finite set of numbers, the population standard deviation is found by taking the square root of the average of the squared deviations of the values subtracted from their average value. The marks of a class of eight students (that is, a statistical population) are the following eight values: + +$2, 4, 4, 4, 5, 5, 7, 9$ + +These eight data points have the mean (average) of 5: + +$$\mu ={\frac {2+4+4+4+5+5+7+9}{8}}={\frac {40}{8}}=5$$ + +First, calculate the deviations of each data point from the mean, and square the result of each: + +| Deviations of each data| Square the result | +| ---------------------- | --------------------| +| $(2-5)^{2}=(-3)^{2}=9$ | $(5-5)^{2}=0^{2}=0$ | +| $(4-5)^{2}=(-1)^{2}=1$ | $(5-5)^{2}=0^{2}=0$ | +| $(4-5)^{2}=(-1)^{2}=1$ | $(7-5)^{2}=2^{2}=4$ | +| $(4-5)^{2}=(-1)^{2}=1$ | $(9-5)^{2}=4^{2}=16$| + +The variance is the mean of these values: + +$$\sigma ^{2}={\frac {9+1+1+1+0+0+4+16}{8}}={\frac {32}{8}}=4$$ + +and the population standard deviation is equal to the square root of the variance: + +$$\sigma ={\sqrt {4}}=2$$ + +Write a function that takes an array of numbers as parameter and returns the standard deviation of the series. # --hints--