Ask Your Question

jn21's profile - activity

2021-11-11 00:22:13 +0200 marked best answer 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!

2021-11-11 00:22:13 +0200 received badge  Scholar (source)
2021-11-10 22:21:29 +0200 commented answer Error computing kernel of matrix over symbolic ring

Wow, this is fantastic! Thank you! I am using Sage 9.3 and making your changes does indeed solve this quickly for N=3. M

2021-11-09 16:00:24 +0200 asked a question Error computing kernel of matrix over symbolic ring

Error computing kernel of matrix over symbolic ring I am trying to compute the kernel of the Laplacian of the hypercube