/// <summary>Calculation Function Deviation in List </summary> /// <param name="lstData">List Type as Integer 10 Item , passed by reference, that contains all the data as Type Integer >/param> /// <param name="_pow">Deviation Function Math pow</param> /// <param name="avg"> Average in List </param> /// <param name="_deviat">Calculation result Deviation</param> ///<example>lstData[0] =10 ; </example> ///<permission cref="THANAWAT_20170222"/> public static List <DeviationEntity> getDeviation(List <DeviationEntity> lstDeviation, double avg) { int i = 0; foreach (DeviationEntity dEntity in lstDeviation) { DeviationEntity dENtityTemp = new DeviationEntity(); dENtityTemp.NumDeviation = Math.Pow((dEntity.NumX - avg), 2); lstDeviation[i].NumDeviation = dENtityTemp.NumDeviation; i++; } return(lstDeviation); //double _deviat = (_pow) / (_cnt - 1); //return Math.Sqrt(_deviat); }
/// <summary>getInput for random integer and Save to List</summary> /// <param name="lstData">List Type as Integer 10 Item </param> ///<example>lstData =(186,699,132,272); </example> /// <paramref name="lstdata">Integer</paramref> public static List <DeviationEntity> getInput() { //List Data Random Integer 10 Item int[] dNum = { 186, 699, 132, 272, 291, 331, 199, 1890, 788, 1601 }; int i = 0; List <DeviationEntity> lstDeviationEntity = new List <DeviationEntity>(); foreach (int item in dNum) { i++; DeviationEntity entity = new DeviationEntity(); entity.NumSeq = i; entity.NumX = item; lstDeviationEntity.Add(entity); } return(lstDeviationEntity); }