p.resultant(...) returning a TypeError: Singular error:
Hello,
I use sage version 10.1 with Python 3.11.5 and defining :
R.<x,y> = PolynomialRing(GF(7638232120454925879231554234011842347641017888219021175304217358715878636183252433454896490677496516149889316745664606749499241420160898019203925115292257))
p = 1248584106087402595477681320858727452289191586714068127466093787322393958970615519501540939950821145331097471572650068393396104715311314384273622090226805*x*y + 6301575753614857991211769750378449007667075596100476570337558067946302353293601222091674403918269358011024750913561075015421264212999484268980847673978813
and
h = 4650946249801866066910436638190186338607744241962669626937592850318968131015918545028801001474136212788530699903320130403821860925881354770152189482843019*x*y + 3254637135520494253965948417397836071966401978255448258204473055057827529818385623117332595137326811980506963079615552452219222461622129628018805872217494
leads to p.resultant(h,y)
returning an error (see below).
Could you help me understanding why I have this and how I can fix it?
Thanks :)
---------------------------------------------------------------------------
SingularError Traceback (most recent call last)
File /usr/lib/python3.11/site-packages/sage/interfaces/singular.py:1358, in SingularElement.__init__(self, parent, type, value, is_name)
1357 try:
-> 1358 self._name = parent._create(value, type)
1359 # Convert SingularError to TypeError for
1360 # coercion to work properly.
File /usr/lib/python3.11/site-packages/sage/interfaces/singular.py:766, in Singular._create(self, value, type)
765 name = self._next_var_name()
--> 766 self.set(type, name, value)
767 return name
File /usr/lib/python3.11/site-packages/sage/interfaces/singular.py:709, in Singular.set(self, type, name, value)
708 self.__to_clear = []
--> 709 self.eval(cmd)
File /usr/lib/python3.11/site-packages/sage/interfaces/singular.py:667, in Singular.eval(self, x, allow_semicolon, strip, **kwds)
666 if s.find("error occurred") != -1 or s.find("Segment fault") != -1:
--> 667 raise SingularError('Singular error:\n%s'%s)
669 if get_verbose() > 0:
SingularError: Singular error:
? not implemented
? error occurred in or before STDIN line 23: `def sage11=resultant(sage8,sage9,sage10);`
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[4], line 1
----> 1 p.resultant(h,y)
File /usr/lib/python3.11/site-packages/sage/rings/qqbar_decorators.py:96, in handle_AA_and_QQbar.<locals>.wrapper(*args, **kwds)
90 from sage.rings.abc import AlgebraicField_common
92 if not any(isinstance(a, (Polynomial, MPolynomial, Ideal_generic))
93 and isinstance(a.base_ring(), AlgebraicField_common)
94 or is_PolynomialSequence(a)
95 and isinstance(a.ring().base_ring(), AlgebraicField_common) for a in args):
---> 96 return func(*args, **kwds)
98 polynomials = []
100 for a in flatten(args, ltypes=(list, tuple, set)):
File /usr/lib/python3.11/site-packages/sage/rings/polynomial/multi_polynomial_element.py:2355, in MPolynomial_polydict.resultant(self, other, variable)
2353 variable = R.gen(0)
2354 if R._has_singular and R.is_exact():
-> 2355 rt = self._singular_().resultant(other._singular_(), variable._singular_())
2356 r = rt.sage_poly(R)
2357 else:
File /usr/lib/python3.11/site-packages/sage/interfaces/interface.py:696, in InterfaceFunctionElement.__call__(self, *args, **kwds)
695 def __call__(self, *args, **kwds):
--> 696 return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds)
File /usr/lib/python3.11/site-packages/sage/interfaces/interface.py:616, in Interface.function_call(self, function, args, kwds)
612 self._check_valid_function_name(function)
613 s = self._function_call_string(function,
614 [s.name() for s in args],
615 ['%s=%s'%(key,value.name()) for key, value in kwds.items()])
--> 616 return self.new(s)
File /usr/lib/python3.11/site-packages/sage/interfaces/interface.py:385, in Interface.new(self, code)
384 def new(self, code):
--> 385 return self(code)
File /usr/lib/python3.11/site-packages/sage/interfaces/singular.py:805, in Singular.__call__(self, x, type)
802 if type in ("module","list") and isinstance(x,(list,tuple,Sequence_generic)):
803 x = str(x)[1:-1]
--> 805 return SingularElement(self, type, x, False)
File /usr/lib/python3.11/site-packages/sage/interfaces/singular.py:1363, in SingularElement.__init__(self, parent, type, value, is_name)
1361 except SingularError as x:
1362 self._session_number = -1
-> 1363 raise TypeError(x)
1364 except BaseException:
1365 self._session_number = -1
TypeError: Singular error:
? not implemented
? error occurred in or before STDIN line 23: `def sage11=resultant(sage8,sage9,sage10);`
The reason may be very large characteristic of the field. If I remember correctly Singular wants it be bounded by 2**64 or so.
Oh, thanks for the comment. Maybe I should point out the unclear error with an issue git 🤔
It seems that p.sylvester_matrix(h,y).determinant() works, should it be pointed out in a git issue?