Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Unexpected result from Nullspace Calculation

Hi, I'm still quite inexperienced with Sage at the moment, so forgive me if this is a basic issue. I am trying to produce an orthonormal basis, I have created the orthogonal complement to my original basis by taking its left nullspace using kernel() I now want to use gram_schmidt() to produce a normalised version. I am unsure however what ring my input matrix should be over. QQbar won't work for me, but I am worried that the RDF result I get will not retain the linear independence that I need, as it says in the documentation for gram_schmidt() that under RDF, "no attempt is made to recognize linear dependence with approximate calculations" My input matrix is the following;

[   0   -1    0    0    1    0    0    0    0    0    0    0]
[-1/2    0    0 -1/2    0    0    1    0    0    0    0    0]
[-1/2   -1    0  1/2    0    0    0    1    0    0    0    0]
[-1/2    0    0 -1/2    0    0    0    0    0    1    0    0]
[ 1/2   -1    0 -1/2    0    0    0    0    0    0    1    0]
[   0    0   -1    0    0   -1    0    0    1    0    0    1]

if I change the ring of this matrix to RDF, gram_schmidt() runs but the inexact entries of -0.0 and what is clearly 1/sqrt(2) are not so useful.

    [               0.0    -0.408248290464     0.353553390593
-0.288675134595     0.353553390593 -1.32686526214e-17]
[    0.707106781187 -8.67632788532e-17     0.353553390593
-1.40946282423e-17    -0.353553390593 -1.72861506093e-17]
[              -0.0                0.0                0.0  
1.9952420559e-17  3.41114374126e-17               -0.5]
[              -0.0    -0.408248290464    -0.353553390593   
-0.288675134595    -0.353553390593  4.70626515093e-17]
[   -0.707106781187  3.12521276219e-17     0.353553390593 
6.96057794736e-17    -0.353553390593 -1.72861506093e-17]
[              -0.0                0.0               -0.0               
0.0                0.0               -0.5]
[              -0.0     0.816496580928  5.51587855252e-17   
-0.288675134595 -7.45998857306e-17  1.68969994439e-17]
[              -0.0                0.0    -0.707106781187 
9.67672224796e-18  5.13672629661e-18                0.0]
[              -0.0                0.0               -0.0               
0.0                0.0                0.5]
[              -0.0                0.0               -0.0    
0.866025403784 -2.24700900248e-17  -1.5111067779e-17]
[              -0.0                0.0               -0.0               
0.0     0.707106781187  1.24852656425e-17]
[              -0.0                0.0               -0.0               
0.0                0.0                0.5]

Does anybody know where I've gone wrong here? Is there another more reliable method for computing an orthonormal basis that I could use? Thanks again for putting up with a newbie!

best regards

Brian

Unexpected result from Nullspace CalculationCalculating an Orthonormal Basis

Hi, I'm still quite inexperienced with Sage at the moment, so forgive me if this is a basic issue. I am trying to produce an orthonormal basis, I have created the orthogonal complement to my original basis by taking its left nullspace using kernel() I now want to use gram_schmidt() to produce a normalised version. I am unsure however what ring my input matrix should be over. QQbar won't work for me, but I am worried that the RDF result I get will not retain the linear independence that I need, as it says in the documentation for gram_schmidt() that under RDF, "no attempt is made to recognize linear dependence with approximate calculations" My input matrix is the following;

[   0   -1    0    0    1    0    0    0    0    0    0    0]
[-1/2    0    0 -1/2    0    0    1    0    0    0    0    0]
[-1/2   -1    0  1/2    0    0    0    1    0    0    0    0]
[-1/2    0    0 -1/2    0    0    0    0    0    1    0    0]
[ 1/2   -1    0 -1/2    0    0    0    0    0    0    1    0]
[   0    0   -1    0    0   -1    0    0    1    0    0    1]

if I change the ring of this matrix to RDF, gram_schmidt() runs but the inexact entries of -0.0 and what is clearly 1/sqrt(2) are not so useful.

    [               0.0    -0.408248290464     0.353553390593
-0.288675134595     0.353553390593 -1.32686526214e-17]
[    0.707106781187 -8.67632788532e-17     0.353553390593
-1.40946282423e-17    -0.353553390593 -1.72861506093e-17]
[              -0.0                0.0                0.0  
1.9952420559e-17  3.41114374126e-17               -0.5]
[              -0.0    -0.408248290464    -0.353553390593   
-0.288675134595    -0.353553390593  4.70626515093e-17]
[   -0.707106781187  3.12521276219e-17     0.353553390593 
6.96057794736e-17    -0.353553390593 -1.72861506093e-17]
[              -0.0                0.0               -0.0               
0.0                0.0               -0.5]
[              -0.0     0.816496580928  5.51587855252e-17   
-0.288675134595 -7.45998857306e-17  1.68969994439e-17]
[              -0.0                0.0    -0.707106781187 
9.67672224796e-18  5.13672629661e-18                0.0]
[              -0.0                0.0               -0.0               
0.0                0.0                0.5]
[              -0.0                0.0               -0.0    
0.866025403784 -2.24700900248e-17  -1.5111067779e-17]
[              -0.0                0.0               -0.0               
0.0     0.707106781187  1.24852656425e-17]
[              -0.0                0.0               -0.0               
0.0                0.0                0.5]

Does anybody know where I've gone wrong here? Is there another more reliable method for computing an orthonormal basis that I could use? Thanks again for putting up with a newbie!

best regards

Brian