Frank Delaglio, Ph.D.

19804 Maycrest Way
Germantown MD 20876 USA

301 806-0867
delaglio@nmrscience.com



NMRWish TCL Library Procedures
getAbsMax: Return the value with the greatest absolute value in a 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.

ProcedureReturn Value
getAbsMaxReturn the Value with the Maximum Absolute Value in the list.
getAbsMinReturn the Value with the Minimum Absolute Value in the list.
getAvgReturn the Average of Values the list.
getMaxReturn the Maximum Value in the list.
getMedianReturn the Median of the list.
getMinReturn the Minimum Value in the list.
getRMSReturn the Root Mean Square (RMS) of the list.
getSimpleMedianReturn the Simple Median of the list.
getStdDevReturn the Standard Deviation of the list.
getSumReturn the Sum of Values in the list.
getSumSqReturn 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