ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 07 Dec 2018 19:40:24 +0100Number of linear independent subsets with cardinality 4https://ask.sagemath.org/question/44543/number-of-linear-independent-subsets-with-cardinality-4/ I have a list of vectors in the vector space Q with a dimension of 5, which I want to order in a list and use Combinations(list, 4) to get all sublists with 4 elements. I then want to check how many of those sublists are linear independent in the Vector Space with V.linear dependence(vs) == [].
I'm running into an error when running my code:
V = VectorSpace(QQ,5)
V.list = ([2, 2, 2,-3,-3],[2, 2,-3,2,-3],[2,2,-3,-3,2],[2,-3,2,2,-3],[2,-3,2,-3,2],[2,-3,-3,2,2],[-3,2,2,2,-3],[-3,2,2,-3,2],[-3,2,-3,2,2],[-3,-3,2,2,2])
C = Combinations(list, 4)
V.linear_dependence(C) == []
"ValueError: vector [[2, 2, 2, -3, -3], [2, 2, -3, 2, -3], [2, 2, -3, -3, 2], [2, -3, 2, 2, -3]] is not an element of Vector space of dimension 5 over Rational Field"
Anyone got any clues as to what im missing?Mon, 03 Dec 2018 04:19:05 +0100https://ask.sagemath.org/question/44543/number-of-linear-independent-subsets-with-cardinality-4/Comment by slelievre for <p>I have a list of vectors in the vector space Q with a dimension of 5, which I want to order in a list and use Combinations(list, 4) to get all sublists with 4 elements. I then want to check how many of those sublists are linear independent in the Vector Space with V.linear dependence(vs) == [].</p>
<p>I'm running into an error when running my code:</p>
<p>V = VectorSpace(QQ,5)</p>
<p>V.list = ([2, 2, 2,-3,-3],[2, 2,-3,2,-3],[2,2,-3,-3,2],[2,-3,2,2,-3],[2,-3,2,-3,2],[2,-3,-3,2,2],[-3,2,2,2,-3],[-3,2,2,-3,2],[-3,2,-3,2,2],[-3,-3,2,2,2])</p>
<p>C = Combinations(list, 4)</p>
<p>V.linear_dependence(C) == []</p>
<p>"ValueError: vector [[2, 2, 2, -3, -3], [2, 2, -3, 2, -3], [2, 2, -3, -3, 2], [2, -3, 2, 2, -3]] is not an element of Vector space of dimension 5 over Rational Field"</p>
<p>Anyone got any clues as to what im missing?</p>
https://ask.sagemath.org/question/44543/number-of-linear-independent-subsets-with-cardinality-4/?comment=44552#post-id-44552To display blocks of code or error messages, skip a line above and below,
and do one of the following (all give the same result):
- indent all code lines with 4 spaces
- select all code lines and click the "code" button (the icon with '101 010')
- select all code lines and hit ctrl-K
For instance, typing
> If we define `f` by
>
> def f(x, y, z):
> return x * y * z
>
> then `f(2, 3, 5)` returns `30` but `f(2*3*5)` gives:
>
> TypeError: f() takes exactly 3 arguments (1 given)
produces:
> If we define `f` by
>
> def f(x, y, z):
> return x * y * z
>
> then `f(2, 3, 5)` returns `30` but `f(2*3*5)` gives:
>
> TypeError: f() takes exactly 3 arguments (1 given)
Please edit your question to do that.Mon, 03 Dec 2018 15:08:36 +0100https://ask.sagemath.org/question/44543/number-of-linear-independent-subsets-with-cardinality-4/?comment=44552#post-id-44552Comment by kcrisman for <p>I have a list of vectors in the vector space Q with a dimension of 5, which I want to order in a list and use Combinations(list, 4) to get all sublists with 4 elements. I then want to check how many of those sublists are linear independent in the Vector Space with V.linear dependence(vs) == [].</p>
<p>I'm running into an error when running my code:</p>
<p>V = VectorSpace(QQ,5)</p>
<p>V.list = ([2, 2, 2,-3,-3],[2, 2,-3,2,-3],[2,2,-3,-3,2],[2,-3,2,2,-3],[2,-3,2,-3,2],[2,-3,-3,2,2],[-3,2,2,2,-3],[-3,2,2,-3,2],[-3,2,-3,2,2],[-3,-3,2,2,2])</p>
<p>C = Combinations(list, 4)</p>
<p>V.linear_dependence(C) == []</p>
<p>"ValueError: vector [[2, 2, 2, -3, -3], [2, 2, -3, 2, -3], [2, 2, -3, -3, 2], [2, -3, 2, 2, -3]] is not an element of Vector space of dimension 5 over Rational Field"</p>
<p>Anyone got any clues as to what im missing?</p>
https://ask.sagemath.org/question/44543/number-of-linear-independent-subsets-with-cardinality-4/?comment=44613#post-id-44613Also posted at https://stackoverflow.com/questions/53586859/number-of-linear-independent-subsets-with-cardinality-4Fri, 07 Dec 2018 19:40:24 +0100https://ask.sagemath.org/question/44543/number-of-linear-independent-subsets-with-cardinality-4/?comment=44613#post-id-44613