![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
|
![]() |
#1 |
Gefallen Engel U-666
|
![]()
^
![]() ![]() ![]() ![]() ![]()
__________________
"Only two things are infinite; The Universe and human squirrelyness?!! |
![]() |
![]() |
![]() |
#2 |
Ocean Warrior
![]() |
![]()
Err you don't really need to create an object (class) for this, a simple function should do just fine.
|
![]() |
![]() |
![]() |
#3 |
GLOBAL MODDING TERRORIST
|
![]()
Yep. A new function is plenty good enuff. I don't like adding some monster package I'll never use.
|
![]() |
![]() |
![]() |
#4 |
Starte das Auto
|
![]()
Nothing worse than having a monster package and never using it.
|
![]() |
![]() |
![]() |
#5 |
Silent Hunter
![]() Join Date: Dec 2004
Location: AN9771
Posts: 4,904
Downloads: 304
Uploads: 0
|
![]()
I have never understood why it has to divide by N-1. Can anyone explain why it is less 1?
I mean, simple averages are simply the sum divided by N. That makes sense to spread the (sum of) differences accross all samples. |
![]() |
![]() |
![]() |
#6 | |
Still crazy as ever!
Join Date: Jan 2008
Location: A little south of sanity
Posts: 3,377
Downloads: 180
Uploads: 1
|
![]() Quote:
![]()
__________________
Hanging on in quiet desperation is the English way... |
|
![]() |
![]() |
![]() |
#7 |
Navy Seal
![]() |
![]()
You know, when I saw the title of this thread, I was a bit confused. I live in Hollywood, California; here, a standard deviation is anything that does not require above normal medical attention, a lengthy session in a confessional, or an excessive bail...
<O>
__________________
__________________________________________________ __ |
![]() |
![]() |
![]() |
#8 |
ACE
![]() Join Date: Sep 2002
Location: Kansas City
Posts: 1,274
Downloads: 60
Uploads: 0
|
![]()
I am a bit rusty on my C++, but maybe we can get you going in the right direction with some psuedo-code!
We know we will have a list of items with numeric values, for simplicity sake, let's assume these are doubles. So, let's pass that to stubbed method: Code:
public void CalculateStandardDev(double listOfDoubles) { } Code:
listOfDoubles.size(); Code:
public void CalculateStandardDev(double listOfDoubles) { int sizeOfList = listOfDoubles.size(); } ![]() Code:
public void CalculateStandardDev(double listOfDoubles) { int sizeOfList = listOfDoubles.size(); double temporarySum = 0; for(int i=0; i<sizeOfList; i++) { temporarySum += listOfDoubles[i]; } } |
![]() |
![]() |
![]() |
|
|