Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error computing kernel of matrix over symbolic ring

I am trying to compute the kernel of the Laplacian of the hypercube graph where all nonzero entries are symbolic variables. The below code works for N=2

N = 3 #dimension of hypercube graph
G = graphs.CubeGraph(N).to_directed()

#Assign edge labels as symbolic variables
for u,v,l in G.edges(sort=False):
    this_label = 'e' + str(u) + 'e' + str(v)
    G.set_edge_label(u, v, this_label)
    var(this_label)

#relabel vertices to facilitate conversion to matrix
G.relabel()

#Create edge dictionary to facilitate conversion to matrix
edge_dict = {(u,v):k for u,v,k in G.edges()}

#Construct Laplacian matrix
temp = matrix(SR, G.order(), G.order(), edge_dict)
L = temp - diagonal_matrix(sum(temp))

#compute Laplacian kernel
ker = transpose(L).kernel();

but gives the below error for N=3 at the last line:

TypeError: ECL says: THROW: The catch RAT-ERR is undefined.

During handling of the above exception, another exception occurred:

...

TypeError: Multiplying row by Symbolic Ring element cannot be done over Symbolic Ring, use change_ring or with_added_multiple_of_row instead.

Any ideas as to the cause of the error? Can SAGE handle computing kernels of symbolic matrices of this size?

Thanks!