kill(all)$

maxima : simple way to construct 3D matrix,version 1.0
peter.vlasschaert@gmail.com,26/01/2021.

used : finite differences

ref :https://stackoverflow.com/questions/51633346
/how-to-generate-a-multidimensional-array-of-indexed-variables-in-maxima

Why : 3D matrix , used for simulation of the time step.
→ every xy data @ every time step. (= 'xy data change' )

example select data x,y : 2 by 2 matrix

list structure :

k1:[[1,2],[3,4]];
k2:[[5,6],[7,8]];

list : list inside a list.

k:[k1,k2];

k[1];

Menu : Algebra:Generate Matrix
-------------------------------------------
Array      :  z
Rows      : 3
Columns :  3
Name      :  v1

v1: genmatrix(z, 3, 3);

z[1,1]:k[1];

ev(v1,nouns);

make 2 by 2 matrix : fill with x,y data from the simulation

z[ii,jj]:=makelist(makelist(0,ii,1,2),jj,1,2);

m:ev(v1,nouns);

m[1,2]:k2;

ev(m,nouns);

x,y data @ first time step 

m[1,1];

x,y data @ second time step 

m[1,2];

? How many time steps.

1e) step :dimension of matrix.
---------------------------------------

matsize(A):=[length(A),length(transpose(A))];

2e) step : number of time steps.
------------------------------------------

numbertimestep: matsize(m)[1]*matsize(m)[2];

other example : random matrix

1e step : v2 ,matrix   (3 by 3), elements : zz[i,j]
-------------------------------------------------------------
i = 1,2,3
j = 1,2,3
see : Menu algebra

v2:genmatrix(zz,3,3);

2e step : random values inside  v2, p1 by p2 :matrix
---------------------------------------------------------------------

fpprintprec : 2;

p1:2$ /* number of rows */
p2:3$ /* number of columns */

zz[ii,jj]:=ev(makelist(makelist((random(1.0)),ii,1,p2),jj,1,p1),float);

3e step : fill matrix v2
-----------------------------

mm:ev(v2,nouns);

q1:apply(matrix,mm[1,1]);                                            /*first entry of mm, first time step */

q2:apply(matrix,mm[matsize(mm)[1],matsize(mm)[2]]);/*last entry of mm,last time step */

4e step : numbertimesteps
------------------------------------

numbertimesteps:matsize(mm)[1]*matsize(mm)[2];