Closed videlec closed 7 years ago
Description changed:
---
+++
@@ -50,4 +50,17 @@
TypeError: no conversion to a Singular ring defined
+The function can_convert_to_singular
is to blame
+
+ +sage: from sage.rings.polynomial.polynomial_singular_interface import can_convert_to_singular +sage: K.<s,t> = NumberField([x^2-2,x^2-5]) +sage: can_convert_to_singular(K) +True +sage: K._singular_() +** BOOM ** +
+
+---
+
Original report on this question on ask.
Description changed:
---
+++
@@ -54,7 +54,7 @@
sage: from sage.rings.polynomial.polynomial_singular_interface import can_convert_to_singular -sage: K.<s,t> = NumberField([x^2-2,x^2-5]) +sage: K.<a,b> = NumberField([x^2-2,x^2-5]) sage: can_convert_to_singular(K) True sage: K.singular()
Branch: u/vdelecroix/23535
Author: Vincent Delecroix
LGTM. Have you considered going to an absolute number field and calling Singular? Do you know if that could be better in practice?
Reviewer: Marc Mezzarobba
I believe it would be better. Everything is there (except that you have to chose an explicit name!)
sage: K.<a,b> = NumberField([x^2-2, x^2-5])
sage: L = K.absolute_field('c')
sage: L
Number Field in c with defining polynomial x^4 - 14*x^2 + 9
sage: L.convert_map_from(K)
Isomorphism map:
From: Number Field in a with defining polynomial x^2 - 2 over its base field
To: Number Field in c with defining polynomial x^4 - 14*x^2 + 9
sage: K.convert_map_from(L)
Isomorphism map:
From: Number Field in c with defining polynomial x^4 - 14*x^2 + 9
To: Number Field in a with defining polynomial x^2 - 2 over its base field
and then the following works
sage: K(random_matrix(K,4).change_ring(L).det()) # random
42
However I do not want to repeat this trick at every place singular is called in Sage! One possible way to do it is to enrich the ._singular_()
method of elements. If we had a ._singular_morphisms_()
on parent returning a pair (ToSingular, FromSingular)
we could do
class MultiPolyMatrix:
def determinant(self):
try:
to, from = self._singular_morphisms_()
except ValueError:
# no Singular
# find something else
else:
return from(to(self).determinant())
Changed branch from u/vdelecroix/23535 to 5e23e17
The function
can_convert_to_singular
is to blameOriginal report on this question on ask.
Component: algebra
Keywords: bug
Author: Vincent Delecroix
Branch/Commit:
5e23e17
Reviewer: Marc Mezzarobba
Issue created by migration from https://trac.sagemath.org/ticket/23535