There are five predefined Vensim functions that have been designed to make common subscript operations easy to perform. These functions are:
SUM, which takes a sum over the indicated subscript values.
PROD, which takes a product over the subscript values.
VMIN, which takes a minimum over all subscript values.
VMAX, which takes a maximum over all subscript values.
VECTOR SELECT, which performs sum, product, min, max and average operations on sparse matrices with improved speed and causal tracing.
ELMCOUNT, which returns the number of elements in a Subscript Range.
The ELMCOUNT function takes a single Subscript Range as its argument. For the others an exclamation point ! is used to denote on which Subscript Ranges the function should operate. You can take sums, products, minimums and maximums over any number of subscripts, and arithmetic expressions are allowed within the functions.
efficiency = PROD( factor efficiency[types!] )
|~||Production efficiency derived from several|
|efficiency = factor efficiency[TYPE 1]|
|* factor efficiency[TYPE 2]|
|* factor efficiency[TYPE 3]|
|* factor efficiency[TYPE N]|
US population = SUM( population[state!, county!] )
|~||US population built up from the county level, i.e.|
|sum over all counties of all states.|
Revenue[country,brand] = SUM(
|`||~ Revenue by country and brand.|
The last of these is equivalent to an inner product and is a very common way to use the SUM function.