CumMin and CumMax
New to Analytica 5.3
Release: |
4.6 • 5.0 • 5.1 • 5.2 • 5.3 • 5.4 • 6.0 • 6.1 • 6.2 • 6.3 • 6.4 • 6.5 |
---|
CumMin(x, I, passNull, reset, window)
CumMax(x, I , passNull, reset, window)
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 byI
}
CumMax(X, I) →
[5, 5, 5, 8, 8, 8, 8]
{indexed byI
}
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 byJ
}
CumMin(X, J, passNull: false) →
[Null, Null, 4, 2, 2, 2, 2, -1, -1, -1, -1]
{ Indexed byJ
}
CumMin(X, J, passNull: true) →
[Null, Null, 4, 2, Null, Null, 2, -1, -1, -1, Null]
{ Indexed byJ
}
CumMax(X, J, passNull: true) →
[Null, Null, 4, 4, Null, Null, 4, 4, 4, 4, Null]
{ Indexed byJ
}
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 byI
}
CumMax(X, I, reset: R) →
[5, 5, 1, 8, 8, 7, 7]
{ Indexed byI
}
«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.
Window
New to Analytica 6.0
When «window» is specified as a positive integer, does a windowed cum min or cum max. In other words, returns the minimum (or maximum) value among the most recent «window» points.
Enable comment auto-refresher