Difference between revisions of "Cumulate"
m (adding doc status category) |
(Added recumulate example, from Brian Parsonnet) |
||
Line 7: | Line 7: | ||
Cumulate(X:Array[I] ; I : Index) | Cumulate(X:Array[I] ; I : Index) | ||
+ | |||
+ | = Library = | ||
+ | |||
+ | Array Functions | ||
+ | |||
+ | = Notes = | ||
+ | |||
+ | == Recumulate == | ||
+ | |||
+ | A useful variation is the ''Recumulate'' function, which resets the total to zero at selected points. This usage is: | ||
+ | Recumulate(x,b,I) | ||
+ | where b is an array of booleans indexed by I, having 1 at each point where the cumulation is to be reset to zero. Recumulate is implemented as a [[User-Defined Function]] in the example [[media:Recumulate example.ana|Recumulate example.ana]]. A clever usage of this function computes the number of time steps that the system has been in the same state (see the example). | ||
+ | |||
+ | = See Also = |
Revision as of 07:34, 7 August 2008
Returns an array with each element being the sum of all of the elements of X along dimension I up to, and including, the corresponding element of X.
Declaration
Cumulate(X:Array[I] ; I : Index)
Library
Array Functions
Notes
Recumulate
A useful variation is the Recumulate function, which resets the total to zero at selected points. This usage is:
Recumulate(x,b,I)
where b is an array of booleans indexed by I, having 1 at each point where the cumulation is to be reset to zero. Recumulate is implemented as a User-Defined Function in the example Recumulate example.ana. A clever usage of this function computes the number of time steps that the system has been in the same state (see the example).
See Also
Comments
Enable comment auto-refresher