Related

genmatrix

a[i,j]:=i^2-j^2;

A: genmatrix(a,2,3);

Calculate

genmatrix-kill

kill(all);

a[i,j]:=i^2 + j^2;

genmatrix(a,3,2);

Calculate

genmatrix-random

a[i,j]:=random(10);

A:genmatrix(a,4,4);

B:genmatrix(a,4,4);

Calculate

genmatrix-lambda-log-matrix-plot2d-plot3d

plot2d((x^3+4)/(x^2),...

plot2d(['parametric, ...

plot3d(log(x^2+y^2-x*...

Calculate

genmatrix-makelist

n:11;

h[i,j]:= if mod(i-j,n...

M:genmatrix (h,n,n);

Calculate

genmatrix-random

random(9);

ran1[n,m]:=random(9);

ran2[n,m]:=random(9);

Calculate

genmatrix-make_random_state-permanent-random

a[i,j]:=random(15);

A:genmatrix(a,3,3);

make_random_state;

Calculate

genmatrix-lambda

a:genmatrix(lambda([i...

a+a^^2+a^^3;

Calculate

genmatrix-permanent-random

a[i,j]:=random(15);

A:genmatrix(a,3,3);

b[i,j]:=random(15);

Calculate

genmatrix-map

f[i,j]:=x^igcdex(i,j);

M:genmatrix(f,3,3);

map(factor,M);

Calculate

[genmatrix]

Run Example
```(%i1)A[i,j]:=i-j;
(%o1)                           A     := i - j
i, j
(%i2) A:genmatrix(A,6,6);
[ 0  - 1  - 2  - 3  - 4  - 5 ]
[                            ]
[ 1   0   - 1  - 2  - 3  - 4 ]
[                            ]
[ 2   1    0   - 1  - 2  - 3 ]
(%o2)                   [                            ]
[ 3   2    1    0   - 1  - 2 ]
[                            ]
[ 4   3    2    1    0   - 1 ]
[                            ]
[ 5   4    3    2    1    0  ]
(%i3) A;
[ 0  - 1  - 2  - 3  - 4  - 5 ]
[                            ]
[ 1   0   - 1  - 2  - 3  - 4 ]
[                            ]
[ 2   1    0   - 1  - 2  - 3 ]
(%o3)                   [                            ]
[ 3   2    1    0   - 1  - 2 ]
[                            ]
[ 4   3    2    1    0   - 1 ]
[                            ]
[ 5   4    3    2    1    0  ]
(%i4) B;
(%o4)                                  B
(%i5) C:transpose(A)-A;
[  0     2    4    6    8   10 ]
[                              ]
[ - 2    0    2    4    6   8  ]
[                              ]
[ - 4   - 2   0    2    4   6  ]
(%o5)                  [                              ]
[ - 6   - 4  - 2   0    2   4  ]
[                              ]
[ - 8   - 6  - 4  - 2   0   2  ]
[                              ]
[ - 10  - 8  - 6  - 4  - 2  0  ]
(%i6) D;
(%o6)                                  D
(%i7) transpose (A)+A;
[ 0  0  0  0  0  0 ]
[                  ]
[ 0  0  0  0  0  0 ]
[                  ]
[ 0  0  0  0  0  0 ]
(%o7)                        [                  ]
[ 0  0  0  0  0  0 ]
[                  ]
[ 0  0  0  0  0  0 ]
[                  ]
[ 0  0  0  0  0  0 ]
(%i8) A:matrix([1,5,-2],[-3,0,2]);
[  1   5  - 2 ]
(%o8)                           [             ]
[ - 3  0   2  ]
(%i9) B:matrix([-3,0,12],[21,1,0]);
[ - 3  0  12 ]
(%o9)                           [            ]
[ 21   1  0  ]
(%i10) C:matrix([10,8,5],[-7,-2,1]);
[ 10    8   5 ]
(%o10)                          [             ]
[ - 7  - 2  1 ]
(%i11) 2*A+(1/3)*B-C;
[ - 9  2  - 5 ]
[             ]
(%o11)                          [      7      ]
[  8   -   3  ]
[      3      ]
(%i12) A:matrix([1,2,1],[2,1,2],[1,2,3]);
[ 1  2  1 ]
[         ]
(%o12)                            [ 2  1  2 ]
[         ]
[ 1  2  3 ]
(%i13) B:matrix([4,1,1],[-4,2,0],[1,2,1]);
[  4   1  1 ]
[           ]
(%o13)                           [ - 4  2  0 ]
[           ]
[  1   2  1 ]
(%i14) C:matrix([-1,4,3],[11,2,-4],[4,2,3]);
[ - 1  4   3  ]
[             ]
(%o14)                          [ 11   2  - 4 ]
[             ]
[  4   2   3  ]
(%i15) D:A.B;
[ - 3  7   2 ]
[            ]
(%o15)                          [  6   8   4 ]
[            ]
[ - 1  11  4 ]
(%i16) E:B.A;
[ 7  11   9 ]
[           ]
(%o16)                           [ 0  - 6  0 ]
[           ]
[ 6   6   8 ]
(%i17) D-E;
[ - 10  - 4  - 7 ]
[                ]
(%o17)                        [  6    14    4  ]
[                ]
[ - 7    5   - 4 ]
(%i18) F:A.B;
[ - 3  7   2 ]
[            ]
(%o18)                          [  6   8   4 ]
[            ]
[ - 1  11  4 ]
(%i19) G:B.C;
[ 11   20    11  ]
[                ]
(%o19)                        [ 26  - 12  - 20 ]
[                ]
[ 25   10   - 2  ]
(%i20) F.C-A.G;
[ 0  0  0 ]
[         ]
(%o20)                            [ 0  0  0 ]
[         ]
[ 0  0  0 ]
(%i21) ```
Run Example
```for n:1 thru 10 do(kill(h),h[i,j]:=random(5)+1,A:genmatrix(h,3,3),X:[x,y,z],b:[random(5)+1,random(5)+1,random(5)+1],C:list_matrix_entries(A.X),R:linsolve([C[1]=b[1],C[2]=b[2],C[3]=b[3]], [x,y,z]),print(C[1]=b[1],C[2]=b[2],C[3]=b[3],R));
5 z + 3 y + 3 x = 4 2 z + 5 y + x = 1 4 z + y + 5 x = 1
23        5       3
[x = - --, y = - --, z = -]
24        24      2
5 z + 2 y + x = 5 5 z + 5 y + x = 4 5 z + 2 y + 3 x = 5
1      17
[x = 0, y = - -, z = --]
3      15
2 z + 2 y + 2 x = 4 2 z + y + 4 x = 2 5 z + 5 y + 3 x = 1
9                27
[x = -, y = 11, z = - --]
2                2
3 z + 4 y + 4 x = 2 2 z + 5 y + 4 x = 1 3 z + y + x = 5 [x = - 2, y = 1, z = 2]

4 z + 3 y + 3 x = 3 2 z + y + 4 x = 5 2 z + 2 y + 3 x = 2
3
[x = 1, y = - 2, z = -]
2
2 z + 2 y + 5 x = 4 z + 3 y + 4 x = 1 2 z + 3 y + 3 x = 3
2         7       24
[x = --, y = - --, z = --]
11        11      11
2 z + 5 y + 5 x = 4 z + 5 y + 2 x = 5 4 z + 4 y + 4 x = 1
1       43        11
[x = - --, y = --, z = - --]
36      36        12
3 z + 4 y + 2 x = 1 5 z + y + 4 x = 3 5 z + 5 y + 5 x = 2
1         6       17
[x = - --, y = - --, z = --]
25        25      25
z + 2 y + 3 x = 1 5 z + 2 y + 5 x = 2 3 z + y + 4 x = 4
23        5        9
[x = --, y = - -, z = - --]
10        2        10
2 z + 3 y + 2 x = 5 4 z + 3 y + 4 x = 4 3 z + 5 y + 2 x = 1
15
[x = --, y = 2, z = - 8]
2
(%o1)                                done
(%i2) ```
Run Example
```r:15;
(%o1)                                 15
(%i2)  n1:5;
(%o2)                                  5
(%i3)  n2:3;
(%o3)                                  3
(%i4) v:[1,1,1];
(%o4)                              [1, 1, 1]
(%i5) norm(x):=sqrt(x.x);
(%o5)                       norm(x) := sqrt(x . x)
(%i6) for i:1 thru n1 do  (a[i,j]:=random(r),   A:genmatrix(a,n2,n2),   c:[row(A,1).v], d:[transpose(col(A,1)).v], kill(a));
(%o6)                                done
(%i7)  c;
(%o7)                                [28]
(%i8) d;
(%o8)                                [21]
(%i9) ```

Related Help

Help for Genmatrix