ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 15 Nov 2017 08:38:29 -0600Calculation Kernel of a matrixhttp://ask.sagemath.org/question/39575/calculation-kernel-of-a-matrix/I'm trying to write a program in which one part is related to calculation of kernel of a matrix. Its output and expected output are different. For example,
A = [[1, 0, 1], [1, 0, 0], [0, 1, 1], [0, 1, 0], [0, 0, 1], [-1, 0, 0], [0, 0, -1], [0, -1, 1], [0, -1, 0], [-1, 0, 1]]
A is the matrix whose kernel is wanted.
When I calculate its kernel with some programs they give output different, my program is as well. But, when I try to calculate its kernel some others, like SAGE, give output,
1 0 0 0 0 0 0 -2 2 1
0 1 0 0 0 0 0 -1 1 1
0 0 1 0 0 0 0 -1 2 0
0 0 0 1 0 0 0 0 1 0
0 0 0 0 1 0 0 -1 1 0
0 0 0 0 0 1 0 1 -1 -1
0 0 0 0 0 0 1 1 -1 0
The above one is what I expect as output. What is the point that I may overlook?
Here is my procedure to calculate the kernel in my program,
A.transposeInPlace();
FullPivLU<MatrixXf> lu(A);
MatrixXf A_null_space = lu.kernel();
A_null_space.transposeInPlace();
But in that way, I get different then expected one, but SAGE gives the above matrix that actually I expect.
0.5 0 -1 1 0 0 0 0 0 0.5
-0.5 0 -0 0 1 0 0 0 0 -0.5
0.5 0 -0 0 0 1 0 0 0 -0.5
0.5 0 -0 0 0 0 1 0 0 0.5
-1 0 1 0 0 0 0 1 0 -1
-0.5 0 1 0 0 0 0 0 1 -0.5
-0.5 1 -0 0 0 0 0 0 0 0.5
**I'm really but really confused because both matrix seem right! How come?**
Sage's output proof,
https://i.stack.imgur.com/F3ryq.png
My program's output proof,
https://i.stack.imgur.com/7Mw8y.pngstudentboyWed, 15 Nov 2017 08:38:29 -0600http://ask.sagemath.org/question/39575/