Credits Overview Plotting Styles Commands Terminals

summation

A summation expression has the form

      sum [<var> = <start> : <end>] <expression>

<var> is treated as an integer variable that takes on successive integral values from <start> to <end>. For each of these, the current value of <expression> is added to a running total whose final value becomes the value of the summation expression. Examples:

      print sum [i=1:10] i
          55.
      # Equivalent to plot 'data' using 1:($2+$3+$4+$5+$6+...)
      plot 'data' using 1 : (sum [col=2:MAXCOL] column(col))

It is not necessary that <expression> contain the variable <var>. Although <start> and <end> can be specified as variables or expressions, their value cannot be changed dynamically as a side-effect of carrying out the summation. If <end> is less than <start> then the value of the summation is zero.