I have a list of int values:
Listhistogram;
How do I normalize all values so that the max value in the
To normalize a set of numbers that may contain negative values,
and to define the normalized scale's range:
List list = new List{-5,-4,-3,-2,-1,0,1,2,3,4,5};
double scaleMin = -1; //the normalized minimum desired
double scaleMax = 1; //the normalized maximum desired
double valueMax = list.Max();
double valueMin = list.Min();
double valueRange = valueMax - valueMin;
double scaleRange = scaleMax - scaleMin;
IEnumerable normalized =
list.Select (i =>
((scaleRange * (i - valueMin))
/ valueRange)
+ scaleMin);