19804 Maycrest Way
Germantown MD 20876 USA
301 806-0867
delaglio@nmrscience.com
NMRWish TCL Library Procedures
getSimpleMedian: Return the median of values in a list; return value is always an element from the list.
This is one of a series of TCL procedures that provide simple utilities for extracting statistics from a list of numbers. Each one of these procedures take a single argument which is assumed to be a list of valid numbers. Each procedure performs a calculation on the values in the list, and returns a single number from the computed result. The return value will be zero if the input list is empty. Depending on the calculation and the input, the value returned might be an integer or floating point. Therefore, if a particular type of value is required, the return value should be adjusted by the caller.
Procedure | Return Value |
getAbsMax | Return the Value with the Maximum Absolute Value in the list. |
getAbsMin | Return the Value with the Minimum Absolute Value in the list. |
getAvg | Return the Average of Values the list. |
getMax | Return the Maximum Value in the list. |
getMedian | Return the Median of the list. |
getMin | Return the Minimum Value in the list. |
getRMS | Return the Root Mean Square (RMS) of the list. |
getSimpleMedian | Return the Simple Median of the list. |
getStdDev | Return the Standard Deviation of the list. |
getSum | Return the Sum of Values in the list. |
getSumSq | Return the Sum of Squares of Values in the list. |
Notes: The procedure getMedian will return the average of two central values if the input list has an even number of items, while the procedure getSimpleMedian will always return an exact value from the input list.
Examples
% getSum "1 2 3 4" 10.0 % getMedian "1 2 3 4" 2.5 % getSimpleMedian "1 2 3 4" 3 % getMax "1 2 3 4" 4 % getAbsMax "-1 -2 0 1" -2