Question: Construction of a square matrix using 2-dimesional polynomials

Dear Users!
First, I define the following polynomial as:

restart; with(LinearAlgebra); nu := 1/2; M1 := 3; M2 := 3; #(any value of M1 and M2)
for k1 from 0 while k1 <= M1-1 do for k2 from 0 while k2 <= M2-1 do
SGP[M2*k1+k2+1] := simplify(sum((-1)^(k1-i1)*GAMMA(k1+i1+2*nu)*GAMMA(nu+1/2)*x^i1*(sum((-1)^(k2-i2)*GAMMA(k2+i2+2*nu)*GAMMA(nu+1/2)*t^i2/(GAMMA(i2+nu+1/2)*factorial(k2-i2)*factorial(i2)*GAMMA(2*nu)), i2 = 0 .. k2))/(GAMMA(i1+nu+1/2)*factorial(k1-i1)*factorial(i1)*GAMMA(2*nu)), i1 = 0 .. k1))
end do end do;
Lambda := `<,>`(seq(SGP[i], i = 1 .. M1*M2));

then, I want to define a square matrix A of order M1M2 by M1M2 after collocating SGP[k](x,y) at x=(i-1)/(M1-1) and y=(j-1)/(M2-1) for i=1,2,3,...M1, j=1,2,3,...M2.

For example, for M1=2 and M3=3 this matrix A is given as:

A:=Matrix(6, 6, {(1, 1) = SGP[1](0, 0), (1, 2) = SGP[2](0, 0), (1, 3) = SGP[3](0, 0), (1, 4) = SGP[4](0, 0), (1, 5) = SGP[5](0, 0), (1, 6) = SGP[6](0, 0), (2, 1) = SGP[1](0, 1), (2, 2) = SGP[2](0, 1), (2, 3) = SGP[3](0, 1), (2, 4) = SGP[4](0, 1), (2, 5) = SGP[5](0, 1), (2, 6) = SGP[6](0, 1), (3, 1) = SGP[1](1/2, 0), (3, 2) = SGP[2](1/2, 0), (3, 3) = SGP[3](1/2, 0), (3, 4) = SGP[4](1/2, 0), (3, 5) = SGP[5](1/2, 0), (3, 6) = SGP[6](1/2, 0), (4, 1) = SGP[1](1/2, 1), (4, 2) = SGP[2](1/2, 1), (4, 3) = SGP[3](1/2, 1), (4, 4) = SGP[4](1/2, 1), (4, 5) = SGP[5](1/2, 1), (4, 6) = SGP[6](1/2, 1), (5, 1) = SGP[1](1, 0), (5, 2) = SGP[2](1, 0), (5, 3) = SGP[3](1, 0), (5, 4) = SGP[4](1, 0), (5, 5) = SGP[5](1, 0), (5, 6) = SGP[6](1, 0), (6, 1) = SGP[1](1, 1), (6, 2) = SGP[2](1, 1), (6, 3) = SGP[3](1, 1), (6, 4) = SGP[4](1, 1), (6, 5) = SGP[5](1, 1), (6, 6) = SGP[6](1, 1)});

for M1=3 and M=2 the matrix A is given as:

A:=Matrix(6, 6, {(1, 1) = SGP[1](0, 0), (1, 2) = SGP[2](0, 0), (1, 3) = SGP[3](0, 0), (1, 4) = SGP[4](0, 0), (1, 5) = SGP[5](0, 0), (1, 6) = SGP[6](0, 0), (2, 1) = SGP[1](0, 1/2), (2, 2) = SGP[2](0, 1/2), (2, 3) = SGP[3](0, 1/2), (2, 4) = SGP[4](0, 1/2), (2, 5) = SGP[5](0, 1/2), (2, 6) = SGP[6](0, 1/2), (3, 1) = SGP[1](0, 1), (3, 2) = SGP[2](0, 1), (3, 3) = SGP[3](0, 1), (3, 4) = SGP[4](0, 1), (3, 5) = SGP[5](0, 1), (3, 6) = SGP[6](0, 1), (4, 1) = SGP[1](1, 0), (4, 2) = SGP[2](1, 0), (4, 3) = SGP[3](1, 0), (4, 4) = SGP[4](1, 0), (4, 5) = SGP[5](1, 0), (4, 6) = SGP[6](1, 0), (5, 1) = SGP[1](1, 1/2), (5, 2) = SGP[2](1, 1/2), (5, 3) = SGP[3](1, 1/2), (5, 4) = SGP[4](1, 1/2), (5, 5) = SGP[5](1, 1/2), (5, 6) = SGP[6](1, 1/2), (6, 1) = SGP[1](1, 1), (6, 2) = SGP[2](1, 1), (6, 3) = SGP[3](1, 1), (6, 4) = SGP[4](1, 1), (6, 5) = SGP[5](1, 1), (6, 6) = SGP[6](1, 1)});

and for M1=M2=3 the matrix A should be the following form:

A:=Matrix(9, 9, {(1, 1) = SGP[1](0, 0), (1, 2) = SGP[2](0, 0), (1, 3) = SGP[3](0, 0), (1, 4) = SGP[4](0, 0), (1, 5) = SGP[5](0, 0), (1, 6) = SGP[6](0, 0), (1, 7) = SGP[7](0, 0), (1, 8) = SGP[8](0, 0), (1, 9) = SGP[9](0, 0), (2, 1) = SGP[1](0, 1/2), (2, 2) = SGP[2](0, 1/2), (2, 3) = SGP[3](0, 1/2), (2, 4) = SGP[4](0, 1/2), (2, 5) = SGP[5](0, 1/2), (2, 6) = SGP[6](0, 1/2), (2, 7) = SGP[7](0, 1/2), (2, 8) = SGP[8](0, 1/2), (2, 9) = SGP[9](0, 1/2), (3, 1) = SGP[1](0, 1), (3, 2) = SGP[2](0, 1), (3, 3) = SGP[3](0, 1), (3, 4) = SGP[4](0, 1), (3, 5) = SGP[5](0, 1), (3, 6) = SGP[6](0, 1), (3, 7) = SGP[7](0, 1), (3, 8) = SGP[8](0, 1), (3, 9) = SGP[9](0, 1), (4, 1) = SGP[1](1/2, 0), (4, 2) = SGP[2](1/2, 0), (4, 3) = SGP[3](1/2, 0), (4, 4) = SGP[4](1/2, 0), (4, 5) = SGP[5](1/2, 0), (4, 6) = SGP[6](1/2, 0), (4, 7) = SGP[7](1/2, 0), (4, 8) = SGP[8](1/2, 0), (4, 9) = SGP[9](1/2, 0), (5, 1) = SGP[1](1/2, 1/2), (5, 2) = SGP[2](1/2, 1/2), (5, 3) = SGP[3](1/2, 1/2), (5, 4) = SGP[4](1/2, 1/2), (5, 5) = SGP[5](1/2, 1/2), (5, 6) = SGP[6](1/2, 1/2), (5, 7) = SGP[7](1/2, 1/2), (5, 8) = SGP[8](1/2, 1/2), (5, 9) = SGP[9](1/2, 1/2), (6, 1) = SGP[1](1/2, 1), (6, 2) = SGP[2](1/2, 1), (6, 3) = SGP[3](1/2, 1), (6, 4) = SGP[4](1/2, 1), (6, 5) = SGP[5](1/2, 1), (6, 6) = SGP[6](1/2, 1), (6, 7) = SGP[7](1/2, 1), (6, 8) = SGP[8](1/2, 1), (6, 9) = SGP[9](1/2, 1), (7, 1) = SGP[1](1, 0), (7, 2) = SGP[2](1, 0), (7, 3) = SGP[3](1, 0), (7, 4) = SGP[4](1, 0), (7, 5) = SGP[5](1, 0), (7, 6) = SGP[6](1, 0), (7, 7) = SGP[7](1, 0), (7, 8) = SGP[8](1, 0), (7, 9) = SGP[9](1, 0), (8, 1) = SGP[1](1, 1/2), (8, 2) = SGP[2](1, 1/2), (8, 3) = SGP[3](1, 1/2), (8, 4) = SGP[4](1, 1/2), (8, 5) = SGP[5](1, 1/2), (8, 6) = SGP[6](1, 1/2), (8, 7) = SGP[7](1, 1/2), (8, 8) = SGP[8](1, 1/2), (8, 9) = SGP[9](1, 1/2), (9, 1) = SGP[1](1, 1), (9, 2) = SGP[2](1, 1), (9, 3) = SGP[3](1, 1), (9, 4) = SGP[4](1, 1), (9, 5) = SGP[5](1, 1), (9, 6) = SGP[6](1, 1), (9, 7) = SGP[7](1, 1), (9, 8) = SGP[8](1, 1), (9, 9) = SGP[9](1, 1)});

Please help to define general matrix A for any values of M1 and M2. I will be very grateful for you. 

 

Please Wait...