Difference between revisions of "CumMin and CumMax"

(created)
(No difference)

Revision as of 17:56, 14 June 2019

New to Analytica 5.3

CumMin(x, I)

CumMax(x, I)

Returns an array with each element being the minimum or maximum of all preceding elements of «X» along dimension «I» up to, and including, the corresponding element of «X».

Examples

I :=
1..7
X :=
Array(I, [5, 2, 1, 8, -3, 0, 4])
CumMin(X, I) →
[5, 2, 1, 1, -3, -3, -3] {indexed by I}
CumMax(X, I) →
[5, 5, 5, 8, 8, 8, 8] {indexed by I}

Library

Array functions

Optional Parameters

PassNull

«PassNull» is an optional boolean parameter that defaults to False. When it is omitted or explicitly set to False, CumProduct ignores Null values. In that case they have essentially the same effect as a one, unless they happen to be the first value in «X», in which case they are passed since no numeric values are yet obtained.

When «passNull» is explicitly set to true, then Null values are passed through as Null in the result.

J := 1..11
X2 :=
Array(J, [Null, Null, 4, 2, Null, Null, 2, -1, 3, 2, Null])
CumMin(x2, J) →
[Null, Null, 4, 2, 2, 2, 2, -1, -1, -1, -1] { Indexed by J }
CumMin(X, I, passNull: false) →
[Null, Null, 4, 2, 2, 2, 2, -1, -1, -1, -1] { Indexed by J }
CumMin(X, I, passNull: true) →
[Null, Null, 4, 2, Null, Null, 2, -1, -1, -1, Null] { Indexed by J }
CumMax(X, I, passNull: true) →
[Null, Null, 4, 4, Null, Null, 4, 4, 4, 4, Null] { Indexed by J }

Reset

The optional «reset» parameter accepts an array of boolean values indexed by «I». At the positions where «reset» is true, CumMin or CumMax starts over.

I :=
[1, 2, 3, 4, 5, 6, 7]
X :=
Array(I, [5, 2, 1, 8, -3, 7, 5])
R :=
Array(I, [0, 0, 1, 0, 0, 1, 0])
CumMin(X, I, reset: R) →
[5, 2, 1, 1, -3, 7, 5] { Indexed by I }
CumMax(X, I, reset: R) →
[5, 5, 1, 8, 8, 7, 7] { Indexed by I }

«Reset» can be used to restart the progressive min or max each time some state change occurs. In such a scenario, the «reset» parameter is set to True at the first instant (along «I») that the system is in the new state.

See Also

Comments


You are not allowed to post comments.