Libraryless. Click here for Pure Java version (9219L/50K).
static double standardDeviation(int... a) { if (empty(a)) ret 0; double avg = doubleAverage(a), sum = 0; for i over a: sum += sqr(a[i]-avg); ret sqrt(sum/l(a)); } static double standardDeviation(double... a) { if (empty(a)) ret 0; double avg = doubleAverage(a), sum = 0; for i over a: sum += sqr(a[i]-avg); ret sqrt(sum/l(a)); } static double standardDeviation(Collection<Double> a) { if (empty(a)) ret 0; double avg = doubleAverage(a), sum = 0; for (double d : a) sum += sqr(d-avg); ret sqrt(sum/l(a)); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1010189 |
| Snippet name: | standardDeviation |
| Eternal ID of this version: | #1010189/6 |
| Text MD5: | 231fd4fa17f45a2735662e50f05f87ea |
| Transpilation MD5: | c18fb900855169400225fb2848a18ee0 |
| Author: | stefan |
| Category: | javax / maths |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-06-01 18:18:33 |
| Source code size: | 550 bytes / 20 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 804 / 982 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |