# Wrong determinant of matrix based on multivariate polynomial ring

Hello everybody,

I have a problem with determinants of matrices based on multivariate polynomial rings. I have tried tor reduce the problem to the follwing small code snippet. When I input the following code:

```
n = 6
U = Matrix(RDF, n, n)
for i in range(0, n):
for j in range(0, n):
U[i,j]= sqrt(2)/sqrt(n+1)* sin((i+1)*(j+1)*pi/(n+1))
X = Matrix(RDF, n, n)
for i in range(0, n):
X[i,i] = cos((i+1)*pi/(n+1))
X = U*X*U
R.<x,y> = PolynomialRing(RDF)
M=X-x
p=M.determinant()
print p
```

The result is

```
x^6 - 2.2044751821*x^4 - 1.68101310152*x^3 - 1.49183182734e+14*x^2 - 3.3692293675e+15*x - 3.0080295919e+29
```

This is completely wrong. The matrix X contains small flouting point precision error, which however should not prodcue the above result. Due to my original problem I used a polynomial ring with two variables, which seems to be the source of the problem.

For example, when in the above code I use `R.<x> = PolynomialRing(RDF)`

, i.e. a polynomial ring with only one variable, the result is

```
x^6 - 6.138786581930816e-16*x^5 - 1.2499999999999987*x^4 + 4.1216962026573156e-16*x^3 + 0.37499999999999956*x^2 - 4.226292066148934e-17*x - 0.015624999999999944
```

which is the correct result (up to precision errors).

By the way, the correct result without precision errors is

```
1.0*x^6 - 1.25*x^4 + 0.375*x^2 - 0.015625
```

Anybody knows what is going wrong? Thank you in advance.

By the way, I am using the Standard Windows Sage 7.0 Binary: "sage-7.0.ova".

If I change the ring RDF to RR, the result is

which is also wrong (and interestingly differently wrong).

To me it seems that there is a bug in Sage. Should a "bug ticket" posted in another forum?