![]() |
Quote:
http://i298.photobucket.com/albums/m...drums-K5UJ.gif |
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> |
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) Code:
public void CalculateStandardDev(double listOfDoubles) |
Sorry, was scared I was going to lose progress.. Anyways, now we have the sum of all of our items and our 'n' variable. But we still don't have the mean, or the average. So.. to find the average we divide the sum of all of our numbers by 'n', our size of our list:
Code:
public void CalculateStandardDev(double listOfDoubles) :up: Done with Step 1! So now we go into Step 2, which has this equation: http://www.mathsisfun.com/data/image...tion-part1.gif We look at each value and subtract the mean and square the result. Sounds easy enough: Code:
public void CalculateStandardDev(double listOfDoubles) Code:
pow(number, exponentValue) Code:
public void CalculateStandardDev(double listOfDoubles) |
Now that we have our variance, the last step is extremely easy. We simply take the square root of variance to give us the Standard Deviation value!!!
Code:
public double CalculateStandardDev(double listOfDoubles) |
Brrr, take it away, it hurts our eyes! Last time I did stuff like that, was in GFA 3.0 on an Amiga, 25 years ago. :D
|
I'm gonna go with C++ Mathematical Expression Toolkit Library (ExprTk).
It's a neat header file I can use then throw away along with those old Dewalt side cuts. :D |
Quote:
|
I had a deviated septum once.
|
Quote:
|
You all got it wrong. Standard deviation is...
a) how far off you are from your target in darts. b) how many drinks you've got left before you pass out. c) how far the 'fire for effect' barrage is from hitting the obvious target. d) completely irrevelant to anything we REALLY want to talk about (C'mon: Conversation about math or the next FIFA champs, which hopefully be Germany again) |
I hate math. I work with visual geometry mostly.
If I cut this post and let it fall will it miss all the stuff I don't want to break? That kind of thing. :O: Imagine the surprise on faces the day I was not at work. Some cables were cut that no one bothered to look at closely. Results were a building that shifted and leaned 2" in a Northernly direction! |
The eyeball is a wonderful thing.:up:
|
All times are GMT -5. The time now is 05:27 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.