# Polynomials over number fields

Below I define a polynomial ring K[s,t]. My goal is to compute the minors of a large matrix with entries in this ring.

var('x')
# K.<t> = NumberField(x^2-2)
K.<s,t> = NumberField([x^2-2,x^2-5])
R.<p0,p1,p2,p3,p4,p5> = K[]
M = Mat(R,10,10).random_element()
mins = M.minors(2)


This code works fine, but if I replace the last line with

mins = M.minors(7)


it fails with the error message

TypeError: no conversion to a Singular ring defined


Is it possible to avoid this error?

edit retag close merge delete

Sort by » oldest newest most voted

Thanks for your report, this is a bug in Sage. I opened the ticket #23535 to track the issue. Hopefully it will be corrected and fixed in later releases... In the mean time you can fallback to the generic algorithm with

sage: m = random_matrix(R,4)
sage: sage.matrix.matrix2.Matrix.determinant(m)

more

So this method only computes determinants? Is there an easy way to manually iterate over submatrices?

You can take submatrices using indices

sage: m = matrix(4, range(16))
sage: m
[ 0  1  2  3]
[ 4  5  6  7]
[ 8  9 10 11]
[12 13 14 15]
sage: m[1:3, 2:4]
[ 6  7]
[10 11]


(be careful indices starts at 0)

The error also shows for the one $4$-minor of a random $4\times 4$-matrix over R,

var('x')
K.<s,t> = NumberField([x^2-2,x^2-5])
R.<p0,p1,p2,p3,p4,p5> = K[]
M = Mat(R,4,4).random_element()
try:
mins = M.minors(4)
except TypeError:
print "...got TypeError"


This may be relevant for the tests to fix the bug.

I tried to change the base from R to its fraction field, got no error, but also had no time to wait for that one determinant computation...

@dan_fulea The determinant code has special cases for size 2 and 3 reason why you do not see the bug before size 4.

Yes, thanks, my intention was just to give a simple instance for the error, that may serve as test case for the opened ticket... (And also to mention that the 4x4 determinant of the random matrix could not be computed in real time, so computing all 7x7 minors of a 10x10 random matrix...)