C# 标准差计算
2024-10-19 18:43:07
if (numberList.Any())
{
exEntity.MinValue = numberList.First().NumberValue.ToString();
exEntity.MaxValue = numberList.Last().NumberValue.ToString();
exEntity.AvgValue = Math.Round((decimal)numberList.Average(p => p.NumberValue), ).ToString();
//标准差
if (numberList.Count > )
{
double sumOfSquare = ; //平方总和
foreach (var item in numberList)
{
double numberValue = double.Parse(item.NumberValue.ToString());
sumOfSquare += Math.Pow((numberValue - double.Parse(exEntity.AvgValue)), );
}
double stdDeviation = Math.Sqrt(sumOfSquare / (numberList.Count - ));
stdDeviation = Math.Round(stdDeviation, );
exEntity.StdDeviation = stdDeviation.ToString();
}
}
最新文章
- ABP理论学习之领域服务
- stunnel-client
- JS的基础知识
- meclipse中project facet问题
- Java栈与堆一篇好文
- springMVC配置freemarker
- Combox控件初始化项的技巧
- hbm2ddl
- Sumsets(3sum问题,枚举d,c二分a+b)
- win10安装sqlserver2016准备
- 2018-2019-2 20165221 【网络对抗技术】-- Exp6 信息搜集与漏洞扫描
- zabbix3.0监控Windows服务器
- IEEE754浮点数的表示方法
- Mac中selenium使用出现错误
- PHP中$_POST和$_GET的用法
- Chrome disable cache &; clear memory cache
- 序列操作bzoj2962(未完成)
- php算法,冒泡排序
- java学习笔记17(Calendarl类)
- SharePoint BDC(Business Data Connectivity)服务-PowerShell