wolfram-mathematicamathematica-8

How to get a list of elements from the lower triangular matrix


I am new to Mathematica.

I have a lower triangular matrix defined as follow

A = Table[If[i > j, Subscript[a, i, j], 0], {i, s}, {j, s}];

I would like to the lower triangular elements in a list. For example, when s = 2, the list would contain listOfElement = {a_{2,1}} and for s = 3, listOfElement = {a_{2,1},a_{3,1},a_{3,2}}

How can I do this in Mathematica?

Thank you so much in advance


Solution

  • for example this

    A = RandomReal[{0, 1}, {3, 3}];
    MatrixForm[A]
    M = First[Dimensions[A]];
    Flatten[A[[# + 1 ;;, #]] & /@ Range[M - 1]]
    

    produces:

    (0.586886   0.968229    0.543306
     0.107212   0.0492116   0.103052
     0.0569797  0.429895    0.70289
    )
    
    {0.107212,0.0569797,0.429895}