Difference between revisions of "Array Cumulative Functions"

From ZCubes Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
== Array Accumulation Functions ==
 
== Array Accumulation Functions ==
  
== Array.accumulate(FromTotal) {{anchor | Array.accumulate}} ==
+
== Array.accumulate(FromTotal) ==
  
 
Each element is accumulated using SUM with each element.
 
Each element is accumulated using SUM with each element.
 +
 +
MAGICSQUARE(3) is
 +
 +
2 7 6
 +
 +
9 5 1
 +
 +
4 3 8
 +
 +
  
 
MAGICSQUARE(3).accumulate()
 
MAGICSQUARE(3).accumulate()
Line 19: Line 29:
 
| 49 || 52 || 60  
 
| 49 || 52 || 60  
 
|}
 
|}
 
  
 
==Array.cumcolumns(Columns|empty)==
 
==Array.cumcolumns(Columns|empty)==
Line 27: Line 36:
 
MAGICSQUARE(3).cumcolumns()
 
MAGICSQUARE(3).cumcolumns()
  
{| class="wikitable"|-
+
{| class="wikitable"  
 +
|-
 
| 2 || 7 || 6  
 
| 2 || 7 || 6  
 
|-
 
|-
Line 36: Line 46:
  
 
MAGICSQUARE(3).cumcolumns(2)
 
MAGICSQUARE(3).cumcolumns(2)
 +
 +
(Cumulate only column with index 2)
  
 
{| class="wikitable"|-
 
{| class="wikitable"|-
Line 48: Line 60:
  
 
Each element is accumulated by rows for the specified rows, or all if none is specified) using SUM with each element. Initial Value of 0 is assumed.
 
Each element is accumulated by rows for the specified rows, or all if none is specified) using SUM with each element. Initial Value of 0 is assumed.
 +
 +
c=[[1,2,3],[4,5,6],[7,8,9]];
 +
 +
c.cumrows();
 +
 +
{| class="wikitable"
 +
|-
 +
| 1 || 3 || 6
 +
|-
 +
| 4 || 9 || 15
 +
|-
 +
| 7 || 15 || 24
 +
|}
 +
 +
 +
c=[[1,2,3],[4,5,6],[7,8,9]];
 +
c.cumrows(2);
 +
 +
7  15    24
  
 
==Array.cumcolumn(Columns|empty)==
 
==Array.cumcolumn(Columns|empty)==
Same as [[Array.cumcolumns]]
+
Same as [[Array.cumcolumns()]]
  
 
==Array.cumrow(Row|empty)==
 
==Array.cumrow(Row|empty)==
Same as [[Array.cumrows]]
+
Same as [[Array.cumrows()]]
  
 
==Array.accumulatewith(SomeFunction, SomeStartingValue or Parameter List)==
 
==Array.accumulatewith(SomeFunction, SomeStartingValue or Parameter List)==
Line 61: Line 92:
 
==Array.cumcolumnswith(SomeFunction, SomeColumns ...)==
 
==Array.cumcolumnswith(SomeFunction, SomeColumns ...)==
  
[[Array.accumulatewith]] for each column.
+
[[Array.accumulatewith()]] for each column.
  
 
==Array.cumrowswith(SomeFunction, SomeRows ...)==
 
==Array.cumrowswith(SomeFunction, SomeRows ...)==
  
[[Array.accumulatewith]] for each row
+
[[Array.accumulatewith()]] for each row
  
 
==Array.cumcolumnwith(SomeFunction, SomeStartingValue or Parameter List)==
 
==Array.cumcolumnwith(SomeFunction, SomeStartingValue or Parameter List)==
  
Same as [[Array.accumulatewith]] for each column
+
Same as [[Array.accumulatewith()]] for each column
  
 
==Array.cumrowwith==
 
==Array.cumrowwith==
  
Same as [[Array.cumrowswith]] for each column
+
Same as [[Array.cumrowswith()]] for each column
  
 
==Array.cumulate==
 
==Array.cumulate==
  
[[Array.accumulatewith]] with function as NUMSUM
+
[[Array.accumulatewith()]] with function as NUMSUM

Latest revision as of 04:02, 30 April 2020

Array Accumulation Functions

Array.accumulate(FromTotal)

Each element is accumulated using SUM with each element.

MAGICSQUARE(3) is

2 7 6

9 5 1

4 3 8


MAGICSQUARE(3).accumulate()

2 9 15
24 29 30
49 52 60

Array.cumcolumns(Columns|empty)

Each element is accumulated by columns (for the specified columns,or all if none is specified) using SUM with each element. Initial Value of 0 is assumed.

MAGICSQUARE(3).cumcolumns()

2 7 6
11 12 7
15 15 15

MAGICSQUARE(3).cumcolumns(2)

(Cumulate only column with index 2)

6
7
15

Array.cumrows(Rows|empty)

Each element is accumulated by rows for the specified rows, or all if none is specified) using SUM with each element. Initial Value of 0 is assumed.

c=[[1,2,3],[4,5,6],[7,8,9]];

c.cumrows();

1 3 6
4 9 15
7 15 24


c=[[1,2,3],[4,5,6],[7,8,9]]; c.cumrows(2);

7 15 24

Array.cumcolumn(Columns|empty)

Same as Array.cumcolumns()

Array.cumrow(Row|empty)

Same as Array.cumrows()

Array.accumulatewith(SomeFunction, SomeStartingValue or Parameter List)

Each element is accumulated using given function with each element, and with the starting array as first input (if given).

Array.cumcolumnswith(SomeFunction, SomeColumns ...)

Array.accumulatewith() for each column.

Array.cumrowswith(SomeFunction, SomeRows ...)

Array.accumulatewith() for each row

Array.cumcolumnwith(SomeFunction, SomeStartingValue or Parameter List)

Same as Array.accumulatewith() for each column

Array.cumrowwith

Same as Array.cumrowswith() for each column

Array.cumulate

Array.accumulatewith() with function as NUMSUM