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.Wed, 02 Jan 2019 19:22:40 +0100Kernel not found?https://ask.sagemath.org/question/44831/kernel-not-found/Hi. Why is no kernel found for the 2x3 matrix A=[2,3,5];[-4,2,3] ?
sage: A = matrix([[2,3,5],[-4,2,3]])
sage: A
[ 2 3 5]
[-4 2 3]
sage: A.kernel()
Free module of degree 2 and rank 0 over Integer Ring
Echelon basis matrix:
[]
However we know that the kernel should be given by:
`x=-z/16` and `y=-13z/8`Wed, 02 Jan 2019 11:24:02 +0100https://ask.sagemath.org/question/44831/kernel-not-found/Answer by rburing for <p>Hi. Why is no kernel found for the 2x3 matrix A=[2,3,5];[-4,2,3] ?</p>
<pre><code>sage: A = matrix([[2,3,5],[-4,2,3]])
sage: A
[ 2 3 5]
[-4 2 3]
sage: A.kernel()
Free module of degree 2 and rank 0 over Integer Ring
Echelon basis matrix:
[]
</code></pre>
<p>However we know that the kernel should be given by:
<code>x=-z/16</code> and <code>y=-13z/8</code></p>
https://ask.sagemath.org/question/44831/kernel-not-found/?answer=44832#post-id-44832Sage returns the left kernel. This is written in the documentation that you can access by
sage: A.kernel?
You want the right kernel:
sage: A.right_kernel()Wed, 02 Jan 2019 11:32:39 +0100https://ask.sagemath.org/question/44831/kernel-not-found/?answer=44832#post-id-44832Comment by rijndaelxyz for <p>Sage returns the left kernel. This is written in the documentation that you can access by</p>
<pre><code>sage: A.kernel?
</code></pre>
<p>You want the right kernel:</p>
<pre><code>sage: A.right_kernel()
</code></pre>
https://ask.sagemath.org/question/44831/kernel-not-found/?comment=44842#post-id-44842While `A.right_kernel()` returns `[ 1 26 -16]`, it's only one possible solution from the solution set. Instead, I expect it to return `c * [ 1 26 -16 ]`. Any idea how to not miss out all the solutions?Wed, 02 Jan 2019 19:02:42 +0100https://ask.sagemath.org/question/44831/kernel-not-found/?comment=44842#post-id-44842Comment by rburing for <p>Sage returns the left kernel. This is written in the documentation that you can access by</p>
<pre><code>sage: A.kernel?
</code></pre>
<p>You want the right kernel:</p>
<pre><code>sage: A.right_kernel()
</code></pre>
https://ask.sagemath.org/question/44831/kernel-not-found/?comment=44844#post-id-44844What `A.right_kernel()` returns is not a vector but a module with basis. (If you create a matrix over a field like `A = matrix(QQ, [[2,3,5],[-4,2,3]])` it returns a vector space with basis.) You can obtain the basis (which is a sequence of vectors) by `b = A.right_kernel().basis()`. The set of solutions to $Ax = 0$ is *spanned* by this basis, i.e. all solutions are linear combinations of those basis vectors. If you insist, you can introduce the appropriate number of symbolic variables `c = [var('c_%d' % i) for i in range(len(b))]` and create such a linear combination: `sum([c[i]*b[i] for i in range(len(b))])`; this is a vector over the Symbolic Ring `SR`.Wed, 02 Jan 2019 19:16:17 +0100https://ask.sagemath.org/question/44831/kernel-not-found/?comment=44844#post-id-44844Comment by rburing for <p>Sage returns the left kernel. This is written in the documentation that you can access by</p>
<pre><code>sage: A.kernel?
</code></pre>
<p>You want the right kernel:</p>
<pre><code>sage: A.right_kernel()
</code></pre>
https://ask.sagemath.org/question/44831/kernel-not-found/?comment=44845#post-id-44845If you want to display the linear combination in the way you wrote, you can do it like this: `FormalSum([(c[i], b[i]) for i in range(len(b))], parent=FormalSums(SR))`, or even the fancy display `show(FormalSum([(c[i], b[i].column()) for i in range(len(b))], parent=FormalSums(SR)))`.Wed, 02 Jan 2019 19:22:40 +0100https://ask.sagemath.org/question/44831/kernel-not-found/?comment=44845#post-id-44845