.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Standard Deviation Calculation

Posted By: Kshitish     Posted Date: September 17, 2008    Points:2   Category :C#
Hi,
I want code for calculating Standard deviation value using c#.

Thanks

Responses
Author: Faizal             
Posted Date: September 17, 2008     Points: 5   

Hi,
Use this code to Get Standard Deviation


public static double GetStandardDeviation(double[] num)
{
double Sum = 0.0, SumOfSqrs = 0.0;
for (int count = 0; count < num.Length; count++)
{
Sum += num[count];
SumOfSqrs += Math.Pow(num[count], 2);
}
double topSum = (num.Length * SumOfSqrs) - (Math.Pow(Sum, 2));
double val = (double)num.Length;
return Math.Sqrt(topSum / (val * (val - 1)));
}





Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend