# Recursive calculation of a characteristic polynomial

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!