|
The SUM Function |
Top Previous Next |
|
The SUM function produces the sum of repetitive terms. The form is:
value = SUM( name, initial, final, expression )
The expression argument is evaluated and summed for name = 0,1,2,...final.
For example, the statement:
source = SUM(i,1,10,exp(-i))
forms the sum of the exponentials exp(-1)+exp(-2)+...+exp(-10).
The SUM function may be used with data ARRAYs, as in
DEFINITIONS A = ARRAY(1,2,3,4,5,6,7,8,9,10) source = SUM(i,1,10,A[i])
Example: |