Tip 80. Three-dimension matrix

 

Fig. 80. Three-dimension matrix

There are two types of union the variables in Mathcad vector and matrix. Their analogues are one-dimensional and two-dimensional arrays in traditional computer languages. It is possible to create three-dimensional (and more) arrays in computer languages but we can not do the same in Mathcad. Point is that there are no problems[1] to reflect on display or paper of a printer a vector («line») or matrix («square»). But it is (visualization of output) advantage of Mathcad. Three-dimensional matrix is a «volume». So the reflection of it on a display is problematical. But in Mathcad three-dimensional matrix may be deprived of its volume and presented as the vector, which elements are matrixes. Such vector (array) is possible and it has the name Nested Array in Mathcad: embedded (packaged) array.

Soft formation of such array is showed in the fig. 80. If for formation a vector or matrix is required one or two cycles with parameter then for formation our three-dimensional array (tensor) is required already three cycles with parameter. They are reflected in the fig. 80. As a result of scan the program the array with the name A is formed (it was better to write 3D-M three-dimensional array (3D-array), but a name of a variable can not start with a number see tip 15). This array is the three-dimension matrix with lines, columns and layers. This matrix was «stretched» so that it was reflected on a surface[2]. As well it is showed in the fig. 80how it is possible to extract necessary element with coordinates i-j-k from the embedded array and to award it to the variable Ai, j, k. This variable is not the element of the three-dimensional array but the simple variable with textual index i, j, k: A.i, j, k.

Packaged array of the structure A can be the element of new array (four-dimensional matrix) and etc. The main thing is a computer has enough memory.

Too all tips >>>>>>>



[1] Without peculiar problemsee tip 8.

[2] Students make similar structure for examscrib- pleats.