Difference between revisions of "CumMin and CumMax"

(created)
 
m (Optional Parameters)
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
[[Category:Transforming functions]]
 
[[Category:Transforming functions]]
  
== CumMin(x, I) ==
+
== CumMin(x, I'', passNull, reset'') ==
== CumMax(x, I) ==
+
== CumMax(x, I '', passNull, reset'') ==
  
 
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».
 
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».
Line 17: Line 17:
 
:<code>CumMax(X, I) &rarr;</code>  
 
:<code>CumMax(X, I) &rarr;</code>  
 
::<code>[5, 5, 5, 8, 8, 8, 8]</code>  {indexed by <code>I</code>}
 
::<code>[5, 5, 5, 8, 8, 8, 8]</code>  {indexed by <code>I</code>}
 
== Library ==
 
Array functions
 
  
 
== Optional Parameters ==
 
== Optional Parameters ==
Line 32: Line 29:
 
:<code>CumMin(x2, J) &rarr;</code>
 
:<code>CumMin(x2, J) &rarr;</code>
 
::<code>[Null, Null, 4, 2, 2, 2, 2, -1, -1, -1, -1]</code>    { Indexed by <code>J</code> }
 
::<code>[Null, Null, 4, 2, 2, 2, 2, -1, -1, -1, -1]</code>    { Indexed by <code>J</code> }
:<code>CumMin(X, I, passNull: false) &rarr;</code>
+
:<code>CumMin(X, J, passNull: false) &rarr;</code>
 
::<code>[Null, Null, 4, 2, 2, 2, 2, -1, -1, -1, -1]</code>    { Indexed by <code>J</code> }
 
::<code>[Null, Null, 4, 2, 2, 2, 2, -1, -1, -1, -1]</code>    { Indexed by <code>J</code> }
:<code>CumMin(X, I, passNull: true) &rarr;</code>
+
:<code>CumMin(X, J, passNull: true) &rarr;</code>
 
::<code>[Null, Null, 4, 2, Null, Null, 2, -1, -1, -1, Null]</code>    { Indexed by <code>J</code> }
 
::<code>[Null, Null, 4, 2, Null, Null, 2, -1, -1, -1, Null]</code>    { Indexed by <code>J</code> }
:<code>CumMax(X, I, passNull: true) &rarr;</code>
+
:<code>CumMax(X, J, passNull: true) &rarr;</code>
 
::<code>[Null, Null, 4, 4, Null, Null, 4, 4, 4, 4, Null]</code>    { Indexed by <code>J</code> }
 
::<code>[Null, Null, 4, 4, Null, Null, 4, 4, 4, 4, Null]</code>    { Indexed by <code>J</code> }
  
Line 53: Line 50:
 
::<code>[5, 5, 1, 8, 8, 7, 7]</code>                { Indexed by <code>I</code> }
 
::<code>[5, 5, 1, 8, 8, 7, 7]</code>                { Indexed by <code>I</code> }
  
«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 <code>True</code> at the first instant (along «I») that the system is in the new state.  
+
«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 <code>True</code> at the first instant (along «I») that the system is in the new state.
  
 
== See Also ==
 
== See Also ==

Revision as of 17:57, 14 June 2019

New to Analytica 5.3

CumMin(x, I, passNull, reset)

CumMax(x, I , passNull, reset)

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}

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, J, passNull: false) →
[Null, Null, 4, 2, 2, 2, 2, -1, -1, -1, -1] { Indexed by J }
CumMin(X, J, passNull: true) →
[Null, Null, 4, 2, Null, Null, 2, -1, -1, -1, Null] { Indexed by J }
CumMax(X, J, 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.