Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Given a list of vectors v = {v1, ..., vn}, which is the fastest way to find a maximal sublist of linearly independent vectors? I could add the vectors one by one to a list and check for the rank of the resulting matrix, but I would like to know if there's a better solution.

Thanks in advance.

share|improve this question
    
Check RowReduce...this will reduce matrix to basis. –  Rorschach Oct 16 '13 at 17:30
    
I tried RowReduce, but that doesn't output a sublist of the original list. –  Oliver Miller Oct 16 '13 at 17:32
    
you need to implement these steps..math.stackexchange.com/questions/164016/… –  Rorschach Oct 16 '13 at 17:39
    
did u get time to check if any of these solution is working ? –  Rorschach Oct 31 '13 at 9:55

2 Answers 2

MatrixRank[m =
{{1, 2, 0, -3, 1, 0},
 {1, 2, 2, -3, 1, 2},
 {1, 2, 1, -3, 1, 1},
 {3, 6, 1, -9, 4, 3}}]

3

m[[ Flatten[ Position[#, Except[0, _?NumericQ], 1, 1]& /@
    Last @ QRDecomposition @ Transpose @ m ] ]]

{{1, 2, 0, -3, 1, 0},
{1, 2, 2, -3, 1, 2},
{3, 6, 1, -9, 4, 3}}

share|improve this answer

Taking http://www.math4all.in/public_html/linear%20algebra/chapter3.3.html as reference I have tried to do it, I have tried to follow the steps that I suggested you,

   MinimalSublist[x_List] := 
 Module[{tm, ntm, ytm, mm = x}, {tm = RowReduce[mm] // Transpose, 
   ntm = MapIndexed[{#1, #2, Total[#1]} &, tm, {1}], 
   ytm = Cases[ntm, {___, ___, d_ /; d == 1}]};
  Cases[ytm, {b_, {a_}, c_} :> mm[[All, a]]] // Transpose]

For

m1 = {{1, 2, 0, -3, 1, 0}, {1, 2, 1, -3, 1, 2}, {1, 2, 0, -3, 2, 
    1}, {3, 6, 1, -9, 4, 3}};
MinimalSublist[m1]

{{1, 0, 1}, {1, 1, 1}, {1, 0, 2}, {3, 1, 4}}

In M you see 1 row and n columns together,so you can transpose it to see it as {{1, 1, 1, 3}, {0, 1, 0, 1}, {1, 1, 2, 4}} column specific data.

Their count is always equal to rank of a matrix which you can check with MatrixRank[m1] as 3. To verify this result use this applet link, http://www.math4all.in/public_html/linear%20algebra/example3.7/index.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.