Multidimensional array
Multidimensional arrays are arrays with two or more dimensions, i.e. tables with values for "rows", "columns" and possibly for additional "axes" or "coordinates".
3-dimensional arrays can be used to give positions of things in a 3-dimensional space (length, width, height), 4-dimensional arrays for positions in space-time (length, width, height, time), etc.
Because papers and computer screens are 2-dimensional, arrays with higher number of dimensions are hard to visualize. The following 3-dimensional array A
indexed by three indexes, Index_a
, Index_b
and Index_c
, serves as an example of a simple multi-dimensional array:
Variable A :=
Index_c = 'displayed value'
Index_b ▶ Index_a ▼ a b c x value value value y value value value z value value value
As another example of a 3D array, consider the array Colors
indexed by Number
, Letter
, and Hue
:
Variable Colors :=
Number ▶ Letter ▼ 1 2 3 A 45 19 92 B 13 21 81 C 12 43 47 Hue = 'Red'
Number ▶ Letter ▼ 1 2 3 A 34 25 45 B 11 62 19 C 84 45 53 Hue = 'Green'
Number ▶ Letter ▼ 1 2 3 A 21 65 95 B 48 33 12 C 57 56 23 Hue = 'Blue'
Compare these multi-dimensional arrays to the following arrays with fewer dimensions:
An index or list and its values:
Index N :=
1 2 3 4 5
A one-dimensional array:
Variable Squares :=
Squares ▶ 1 2 3 4 5 1 4 9 16 25
A two-dimensional array:
Index_b ▶ Index_a ▼ a b c x value value value y value value value z value value value
See Also
Enable comment auto-refresher