Sum (FPScript)
Calculates the sum or square sum of all values in a data set.
Syntax
Sum(DataSet, [ Mode = SUM_VAL + PROCESS_COLUMNS ] [ , IntervalWidth ])
The syntax of the Sum function consists of the following parts:
Part |
Description |
||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DataSet |
The data set to be evaluated. All data structures are allowed. All numeric data types are permitted. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||||
Mode |
Determines the type of sum. Specifies how data matrices and signal series are to be processed and whether individual, floating or block sums are to be determined. The argument Mode can have the following values:
...plus a constant, which determines the processing of data matrices and signal series....
...plus an optional constant that determines the calculation method:
If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. If this argument is omitted, it will be set to the default value SUM_VAL + PROCESS_COLUMNS. |
||||||||||||||||||||
IntervalWidth |
This argument is required for determining floating and block sums. The interval width then specifies the number of values to be examined. The width should be an odd number. Otherwise, the interval is asymmetrical, and one more value is included in the calculation to the right of the center as opposed to the left. Permitted data structures are scalar value. All integral data types are permitted. The value must be greater or equal to 1. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
Remarks
The result always has the data type 64-bit floating point.
A scalar value is returned without modification. For signals and signal series, the Y component is processed and the X or Z component is copied, if possible. For the calculation of floating and block mean values, the data structure of the result corresponds to that of the argument. If, on the other hand, DataSet is a data series or a signal, the result is a scalar value with the sum searched for; otherwise, the result is a data series or a signal with one sum per column or row.
If DataSet is complex, a complex sum is calculated. The data type of the result is always a real or complex 64-bit floating point value.
Available in
FlexPro View, Basic, Professional, Developer Suite
Examples
Sum({1, 3, 7, 4}) |
Results in 15. |
Sum({1, 3, 7, 4}, SUM_SQUARE) |
Results in 75. |