Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Recursive calculation of a characteristic polynomial

Hello everyone! I am trying to calculate the characteristic polynomial of a complex arrangement of dimension 3 using recursion. But I am getting a return that doesn't make any sense to me. The code looks like this:

def threeDimChaPol(Matroid):

if Matroid.rank()<=2:
    MatGS=len(Matroid.groundset_list())-1
    return x*(x-MatGS)*(x-1)
HE=Matroid.groundset_list()[-1]
print HE
MatD=Matroid.delete(HE)
MatR=Matroid.contract(HE).simplify()
R=len(MatR.groundset_list())-1
return threeDimChaPol(MatD)- (x-1)*(x-R)

I am feeding the function with the Matroid that comes out when I use the normalvectors of the hyperplanes of the G32 and trim it down to 4 specific hyperplanes. I use Matroid(Matrix(NF3,G32Normals).transpose()) , where I prepared a list of the G32 normalvectors in which I use a numberfield instead of a cyclotomic field for the complex numbers (the vectors are in the same order as when you get them through ReflectionGroups). I then use deletion on everything, but 0,1,2,12 and get a Matroid of rank 4 with 4 elements. If I now use the function above it responds 12,2 as it should, because they are the things chosen out of the groundset, but instead of returning the polynomial it just writes 53466 after that.
So the return is just a number, which does not make any sense to me. Before I wrote this into a new file, double attaching the file, where this function is in, to sage solved the problem and gave the right result. When I restarted sage and attached in only once the bug would appear again. But writing the function alone with the neccessary information (Matroid and Vectors) into a new file and attaching it just gives me the 53466 return, no matter how often I attach it to sage. Since the code is working sometimes and other times not it really confuses me where the mistake could be. Any kind of help would be greatly appreciated!

Recursive calculation of a characteristic polynomial

Hello everyone! I am trying to calculate the characteristic polynomial of a complex arrangement of dimension 3 using recursion. But I am getting a return that doesn't make any sense to me. The code looks like this:

def threeDimChaPol(Matroid):

def threeDimChaPol(Matroid):
    if Matroid.rank()<=2:
    MatGS=len(Matroid.groundset_list())-1
Matroid.rank() <= 2:
        MatGS = len(Matroid.groundset_list()) - 1
        return x*(x-MatGS)*(x-1)
HE=Matroid.groundset_list()[-1]
x * (x - MatGS) * (x - 1)
    HE = Matroid.groundset_list()[-1]
    print HE
MatD=Matroid.delete(HE)
MatR=Matroid.contract(HE).simplify()
R=len(MatR.groundset_list())-1
    MatD = Matroid.delete(HE)
    MatR = Matroid.contract(HE).simplify()
    R = len(MatR.groundset_list()) - 1
    return threeDimChaPol(MatD)- (x-1)*(x-R)
threeDimChaPol(MatD) - (x - 1) * (x - R)

I am feeding the function with the Matroid that comes out when I use the normalvectors of the hyperplanes of the G32 and trim it down to 4 specific hyperplanes. I use Matroid(Matrix(NF3,G32Normals).transpose()) Matroid(Matrix(NF3, G32Normals).transpose()), where I prepared a list of the G32 normalvectors in which I use a numberfield instead of a cyclotomic field for the complex numbers (the vectors are in the same order as when you get them through ReflectionGroups). I then use deletion on everything, but 0,1,2,12 and get a Matroid of rank 4 with 4 elements. If I now use the function above it responds 12,2 as it should, because they are the things chosen out of the groundset, but instead of returning the polynomial it just writes 53466 after that.
So the return is just a number, which does not make any sense to me. Before I wrote this into a new file, double attaching the file, where this function is in, to sage solved the problem and gave the right result. When I restarted sage and attached in only once the bug would appear again. But writing the function alone with the neccessary information (Matroid and Vectors) into a new file and attaching it just gives me the 53466 return, no matter how often I attach it to sage. Since the code is working sometimes and other times not it really confuses me where the mistake could be. Any kind of help would be greatly appreciated!

Recursive calculation of a characteristic polynomial

Hello everyone! I am trying to calculate the characteristic polynomial of a complex arrangement of dimension 3 using recursion. But I am getting a return that doesn't make any sense to me. The code looks like this:

def threeDimChaPol(Matroid):
    if Matroid.rank() <= 2:
        MatGS = len(Matroid.groundset_list()) - 1
        return x * (x - MatGS) * (x - 1)
    HE = Matroid.groundset_list()[-1]
    print HE
    MatD = Matroid.delete(HE)
    MatR = Matroid.contract(HE).simplify()
    R = len(MatR.groundset_list()) - 1
    return threeDimChaPol(MatD) - (x - 1) * (x - R)

I am feeding the function with the Matroid that comes out when I use the normalvectors of the hyperplanes of the G32 and trim it down to 4 specific hyperplanes. hyperplanes.

I use Matroid(Matrix(NF3, G32Normals).transpose()), where I prepared a list of the G32 normalvectors in which I use a numberfield instead of a cyclotomic field for the complex numbers (the vectors are in the same order as when you get them through ReflectionGroups). I then use deletion on everything, but 0,1,2,12 and get a Matroid of rank 4 with 4 elements. elements.

If I now use the function above it responds 12,2 as it should, because they are the things chosen out of the groundset, but instead of returning the polynomial it just writes 53466 after that.
that.

So the return is just a number, which does not make any sense to me. Before I wrote this into a new file, double attaching the file, where this function is in, to sage solved the problem and gave the right result. When I restarted sage and attached in only once the bug would appear again. But writing the function alone with the neccessary information (Matroid and Vectors) into a new file and attaching it just gives me the 53466 return, no matter how often I attach it to sage. sage.

Since the code is working sometimes and other times not it really confuses me where the mistake could be. Any kind of help would be greatly appreciated!