自动创建大型符号矩阵

Automate creation of large symbolic matrix

能否以较少手动方式生成此矩阵? 4 x 4 没问题,但我需要更大的东西。谢谢

 -->    L : matrix([L11,L12,L13,L14],[L21,L22,L23,L24],[L31,L32,L33,L34],[L41,L42,L43,L44]);
(L) matrix(
        [L11,   L12,    L13,    L14],
        [L21,   L22,    L23,    L24],
        [L31,   L32,    L33,    L34],
        [L41,   L42,    L43,    L44]
    )

回答问题并注意连接函数 ('L) 中 L 的名词形式

L:genmatrix(lambda([i,j], concat('L,i,j)), 3, 3);
    (L) matrix(
            [L11,   L12,    L13],
            [L21,   L22,    L23],
            [L31,   L32,    L33]
        )

对于对角矩阵

R:genmatrix(lambda([i,j], if i=j then concat('R,i) else 0), 3, 3);

    (R) matrix(
            [R1, 0, 0],
            [0, R2, 0],
            [0, 0, R3]
        )