Skip to content

fix(Mpolynomial_libsingular): support division over transcendental ex… #40076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/pkgs/singular/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.4.1
4.4.1.p0
287 changes: 287 additions & 0 deletions build/pkgs/singular/patches/0001-fix-1269.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
From f319ccff8d39114cd1404cb7631f4399678c7269 Mon Sep 17 00:00:00 2001
From: Hans Schoenemann <[email protected]>
Date: Fri, 2 May 2025 11:35:37 +0200
Subject: [PATCH] fix #1269

---
kernel/ideals.cc | 83 ++++++++++++++++----------------
kernel/polys.cc | 120 ++++++++++++++++++++++++++++-------------------
2 files changed, 116 insertions(+), 87 deletions(-)

diff --git a/kernel/ideals.cc b/kernel/ideals.cc
index 148f4878b..cfc523c8a 100644
--- a/kernel/ideals.cc
+++ b/kernel/ideals.cc
@@ -3487,54 +3487,57 @@ ideal idSaturate_intern(ideal I, ideal J, int &k, BOOLEAN isIdeal, BOOLEAN isSB)
// return id_Sat_principal(I,J,currRing);
//}
//---------------------------------------------------
- BOOLEAN only_vars=TRUE; // enabled for I:x_i
- if (idElem(J)==1)
+ if (!rField_is_Ring(currRing))
{
- for(int j=IDELEMS(J)-1;j>=0;j--)
+ BOOLEAN only_vars=TRUE; // enabled for I:x_i
+ if (idElem(J)==1)
{
- poly p=J->m[j];
- if (p!=NULL)
+ for(int j=IDELEMS(J)-1;j>=0;j--)
{
- if (pVar(p)==0)
+ poly p=J->m[j];
+ if (p!=NULL)
{
- only_vars=FALSE;
- break;
+ if (pVar(p)==0)
+ {
+ only_vars=FALSE;
+ break;
+ }
}
}
}
- }
- if (only_vars && isIdeal && rOrd_is_Totaldegree_Ordering(currRing)
- && (idElem(J)==1))
- {
- ideal Iquot,Istd;
- intvec *w=NULL;
- Istd=id_Satstd(I,J,currRing);
- si_opt_2|=Sy_bit(V_PURE_GB);
- k=0;
- loop
+ if (only_vars && isIdeal && rOrd_is_Totaldegree_Ordering(currRing)
+ && (idElem(J)==1))
{
- k++;
- Iquot=idQuot(Istd,J,TRUE,isIdeal);
- ideal tmp=kNF(Istd,currRing->qideal,Iquot,5);
- int elem=idElem(tmp);
- id_Delete(&tmp,currRing);
- id_Delete(&Istd,currRing);
- Istd=Iquot;
- w=NULL;
- Istd=kStd2(Iquot,currRing->qideal,testHomog,&w,(bigintmat*)NULL);
- if (w!=NULL) delete w;
- id_Delete(&Iquot,currRing);
- if (elem==0) break;
- }
- k--;
- idSkipZeroes(Istd);
- //PrintS("\nSatstd:\n");
- //iiWriteMatrix((matrix)I,"I",1,currRing,0); PrintLn();
- //iiWriteMatrix((matrix)J,"J",1,currRing,0); PrintLn();
- //iiWriteMatrix((matrix)Istd,"res",1,currRing,0);PrintLn();
- //id_Delete(&Istd,currRing);
- SI_RESTORE_OPT2(save_opt);
- return Istd;
+ ideal Iquot,Istd;
+ intvec *w=NULL;
+ Istd=id_Satstd(I,J,currRing);
+ si_opt_2|=Sy_bit(V_PURE_GB);
+ k=0;
+ loop
+ {
+ k++;
+ Iquot=idQuot(Istd,J,TRUE,isIdeal);
+ ideal tmp=kNF(Istd,currRing->qideal,Iquot,5);
+ int elem=idElem(tmp);
+ id_Delete(&tmp,currRing);
+ id_Delete(&Istd,currRing);
+ Istd=Iquot;
+ w=NULL;
+ Istd=kStd2(Iquot,currRing->qideal,testHomog,&w,(bigintmat*)NULL);
+ if (w!=NULL) delete w;
+ id_Delete(&Iquot,currRing);
+ if (elem==0) break;
+ }
+ k--;
+ idSkipZeroes(Istd);
+ //PrintS("\nSatstd:\n");
+ //iiWriteMatrix((matrix)I,"I",1,currRing,0); PrintLn();
+ //iiWriteMatrix((matrix)J,"J",1,currRing,0); PrintLn();
+ //iiWriteMatrix((matrix)Istd,"res",1,currRing,0);PrintLn();
+ //id_Delete(&Istd,currRing);
+ SI_RESTORE_OPT2(save_opt);
+ return Istd;
+ }
}
//--------------------------------------------------
ideal Iquot,Istd;
diff --git a/kernel/polys.cc b/kernel/polys.cc
index 841a02cfa..9417bf7c9 100644
--- a/kernel/polys.cc
+++ b/kernel/polys.cc
@@ -48,26 +48,27 @@ poly p_Divide(poly p, poly q, const ring r)
{ /* This means that q != 0 consists of at least two terms*/
if(p_GetComp(p,r)==0)
{
- if((rFieldType(r)==n_transExt)
- &&(convSingTrP(p,r))
- &&(convSingTrP(q,r))
- &&(!rIsNCRing(r)))
+ if (!rIsNCRing(r))
{
- poly res=singclap_pdivide(p, q, r);
- p_Delete(&p,r);
- p_Delete(&q,r);
- return res;
- }
- else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
- &&(!rField_is_Ring(r))
- &&(!rIsNCRing(r)))
- {
- poly res=singclap_pdivide(p, q, r);
- p_Delete(&p,r);
- p_Delete(&q,r);
- return res;
+ if((rFieldType(r)==n_transExt)
+ &&(convSingTrP(p,r))
+ &&(convSingTrP(q,r)))
+ {
+ poly res=singclap_pdivide(p, q, r);
+ p_Delete(&p,r);
+ p_Delete(&q,r);
+ return res;
+ }
+ if ((rFieldType(r)==n_Q)
+ ||(rFieldType(r)==n_Zp))
+ {
+ poly res=singclap_pdivide(p, q, r);
+ p_Delete(&p,r);
+ p_Delete(&q,r);
+ return res;
+ }
}
- else
+ // generic division for poly
{
ideal vi=idInit(1,1); vi->m[0]=q;
ideal ui=idInit(1,1); ui->m[0]=p;
@@ -80,9 +81,9 @@ poly p_Divide(poly p, poly q, const ring r)
ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
SI_RESTORE_OPT1(save_opt);
if (r!=save_ring) rChangeCurrRing(save_ring);
- p=m->m[0]; m->m[0]=NULL;
- id_Delete(&m,r);
- p_SetCompP(p,0,r);
+ matrix T = id_Module2formatedMatrix(m,1,1,r);
+ p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
+ id_Delete((ideal *)&T,r);
id_Delete((ideal *)&U,r);
id_Delete(&R,r);
//vi->m[0]=NULL; ui->m[0]=NULL;
@@ -121,8 +122,7 @@ poly p_Divide(poly p, poly q, const ring r)
{
h=singclap_pdivide(I->m[i],q,r);
}
- else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
- &&(!rField_is_Ring(r))
+ else if (((rFieldType(r)==n_Q)||(rFieldType(r)==n_Zp))
&&(!rIsNCRing(r)))
h=singclap_pdivide(I->m[i],q,r);
else
@@ -189,22 +189,23 @@ poly pp_Divide(poly p, poly q, const ring r)
{ /* This means that q != 0 consists of at least two terms*/
if(p_GetComp(p,r)==0)
{
- if((rFieldType(r)==n_transExt)
- &&(convSingTrP(p,r))
- &&(convSingTrP(q,r))
- &&(!rIsNCRing(r)))
- {
- poly res=singclap_pdivide(p, q, r);
- return res;
- }
- else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
- &&(!rField_is_Ring(r))
- &&(!rIsNCRing(r)))
+ if (!rIsNCRing(r))
{
- poly res=singclap_pdivide(p, q, r);
- return res;
+ if((rFieldType(r)==n_transExt)
+ &&(convSingTrP(p,r))
+ &&(convSingTrP(q,r)))
+ {
+ poly res=singclap_pdivide(p, q, r);
+ return res;
+ }
+ if ((rFieldType(r)==n_Q)
+ ||(rFieldType(r)==n_Zp))
+ {
+ poly res=singclap_pdivide(p, q, r);
+ return res;
+ }
}
- else
+ // generic division for poly
{
ideal vi=idInit(1,1); vi->m[0]=p_Copy(q,r);
ideal ui=idInit(1,1); ui->m[0]=p_Copy(p,r);
@@ -253,17 +254,43 @@ poly pp_Divide(poly p, poly q, const ring r)
{
if (I->m[i]!=NULL)
{
- if((rFieldType(r)==n_transExt)
- &&(convSingTrP(I->m[i],r))
- &&(convSingTrP(q,r))
- &&(!rIsNCRing(r)))
+ if(!rIsNCRing(r))
{
- h=singclap_pdivide(I->m[i],q,r);
+ if((rFieldType(r)==n_transExt)
+ &&(convSingTrP(I->m[i],r))
+ &&(convSingTrP(q,r)))
+ {
+ h=singclap_pdivide(I->m[i],q,r);
+ }
+ else if ((rFieldType(r)==n_Q)
+ ||(rFieldType(r)==n_Zp))
+ h=singclap_pdivide(I->m[i],q,r);
+ else
+ {
+ ideal vi=idInit(1,1); vi->m[0]=q;
+ ideal ui=idInit(1,1); ui->m[0]=I->m[i];
+ ideal R; matrix U;
+ ring save_ring=currRing;
+ if (r!=currRing) rChangeCurrRing(r);
+ BITSET save_opt;
+ SI_SAVE_OPT1(save_opt);
+ si_opt_1 &= ~(Sy_bit(OPT_PROT));
+ ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
+ SI_RESTORE_OPT1(save_opt);
+ if (r!=save_ring) rChangeCurrRing(save_ring);
+ if (idIs0(R))
+ {
+ matrix T = id_Module2formatedMatrix(m,1,1,r);
+ p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
+ id_Delete((ideal *)&T,r);
+ }
+ id_Delete((ideal*)&U,r);
+ id_Delete(&R,r);
+ vi->m[0]=NULL; ui->m[0]=NULL;
+ id_Delete(&vi,r);
+ id_Delete(&ui,r);
+ }
}
- else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
- &&(!rField_is_Ring(r))
- &&(!rIsNCRing(r)))
- h=singclap_pdivide(I->m[i],q,r);
else
{
ideal vi=idInit(1,1); vi->m[0]=q;
@@ -283,7 +310,6 @@ poly pp_Divide(poly p, poly q, const ring r)
p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
id_Delete((ideal *)&T,r);
}
- else p=NULL;
id_Delete((ideal*)&U,r);
id_Delete(&R,r);
vi->m[0]=NULL; ui->m[0]=NULL;
--
2.39.5

7 changes: 7 additions & 0 deletions build/pkgs/singular/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ SAGE_SPKG_CONFIGURE([singular], [
AC_MSG_RESULT(no)
sage_spkg_install_singular=yes
])
AC_MSG_CHECKING([that polynomial division over transcendental extensions is working])
AS_IF([test x`printf "ring r = (0,x),(u,v),dp; \n ((1/x)*(u-1))/(u-1);" | Singular 2>&1 | grep "error occurred"` = x], [
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
sage_spkg_install_singular=yes
])
], [
AC_MSG_RESULT([no])
sage_spkg_install_singular=yes
Expand Down
20 changes: 19 additions & 1 deletion src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2341,6 +2341,15 @@
sage: h = f/g
sage: h*g == f
True

Ensure that :issue:`39801` is fixed::

sage: R.<x> = PolynomialRing(QQ)
sage: S.<u,v> = PolynomialRing(R)
sage: d = u - 1
sage: f = 1 / x * d
sage: f / d

Check failure on line 2351 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 730, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1154, in compile_and_execute exec(compiled, globs) File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_[29]>", line 1, in <module> f / d ~~^~~ File "element.pyx", line 1736, in sage.structure.element.Element.__truediv__ File "coerce.pyx", line 1238, in sage.structure.coerce.CoercionModel.bin_op File "element.pyx", line 1734, in sage.structure.element.Element.__truediv__ File "multi_polynomial_libsingular.pyx", line 2364, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_ File "parent.pyx", line 902, in sage.structure.parent.Parent.__call__ File "coerce_maps.pyx", line 183, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "coerce_maps.pyx", line 176, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/rings/fraction_field.py", line 783, in _element_constructor_ return self._element_class(self, x, y, coerce=coerce) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "fraction_field_element.pyx", line 130, in sage.rings.fraction_field_element.FractionFieldElement.__init__ ZeroDivisionError: fraction field element division by zero

Check failure on line 2351 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/forker.py", line 730, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/forker.py", line 1154, in compile_and_execute exec(compiled, globs) File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_[29]>", line 1, in <module> f / d ~~^~~ File "element.pyx", line 1736, in sage.structure.element.Element.__truediv__ File "coerce.pyx", line 1238, in sage.structure.coerce.CoercionModel.bin_op File "element.pyx", line 1734, in sage.structure.element.Element.__truediv__ File "multi_polynomial_libsingular.pyx", line 2364, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_ File "parent.pyx", line 902, in sage.structure.parent.Parent.__call__ File "coerce_maps.pyx", line 183, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "coerce_maps.pyx", line 176, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.11/site-packages/sage/rings/fraction_field.py", line 783, in _element_constructor_ return self._element_class(self, x, y, coerce=coerce) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "fraction_field_element.pyx", line 130, in sage.rings.fraction_field_element.FractionFieldElement.__init__ ZeroDivisionError: fraction field element division by zero

Check failure on line 2351 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/usr/share/miniconda/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/forker.py", line 730, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/share/miniconda/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/forker.py", line 1154, in compile_and_execute exec(compiled, globs) File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_[29]>", line 1, in <module> f / d ~~^~~ File "element.pyx", line 1736, in sage.structure.element.Element.__truediv__ File "coerce.pyx", line 1238, in sage.structure.coerce.CoercionModel.bin_op File "element.pyx", line 1734, in sage.structure.element.Element.__truediv__ File "multi_polynomial_libsingular.pyx", line 2364, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_ File "parent.pyx", line 902, in sage.structure.parent.Parent.__call__ File "coerce_maps.pyx", line 183, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "coerce_maps.pyx", line 176, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "/usr/share/miniconda/envs/sage-dev/lib/python3.11/site-packages/sage/rings/fraction_field.py", line 783, in _element_constructor_ return self._element_class(self, x, y, coerce=coerce) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "fraction_field_element.pyx", line 130, in sage.rings.fraction_field_element.FractionFieldElement.__init__ ZeroDivisionError: fraction field element division by zero

Check failure on line 2351 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 730, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1154, in compile_and_execute exec(compiled, globs) File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_[29]>", line 1, in <module> f / d ~~^~~ File "element.pyx", line 1736, in sage.structure.element.Element.__truediv__ File "coerce.pyx", line 1238, in sage.structure.coerce.CoercionModel.bin_op File "element.pyx", line 1734, in sage.structure.element.Element.__truediv__ File "multi_polynomial_libsingular.pyx", line 2364, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_ File "parent.pyx", line 902, in sage.structure.parent.Parent.__call__ File "coerce_maps.pyx", line 183, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "coerce_maps.pyx", line 176, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/rings/fraction_field.py", line 783, in _element_constructor_ return self._element_class(self, x, y, coerce=coerce) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "fraction_field_element.pyx", line 130, in sage.rings.fraction_field_element.FractionFieldElement.__init__ ZeroDivisionError: fraction field element division by zero

Check failure on line 2351 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/home/runner/work/sage/sage/src/sage/doctest/forker.py", line 730, in _run self.compile_and_execute(example, compiler, test.globs) File "/home/runner/work/sage/sage/src/sage/doctest/forker.py", line 1154, in compile_and_execute exec(compiled, globs) File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_[29]>", line 1, in <module> f / d ~~^~~ File "element.pyx", line 1736, in sage.structure.element.Element.__truediv__ File "coerce.pyx", line 1238, in sage.structure.coerce.CoercionModel.bin_op File "element.pyx", line 1734, in sage.structure.element.Element.__truediv__ File "multi_polynomial_libsingular.pyx", line 2364, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_ File "parent.pyx", line 902, in sage.structure.parent.Parent.__call__ File "coerce_maps.pyx", line 183, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "coerce_maps.pyx", line 176, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "/home/runner/work/sage/sage/src/sage/rings/fraction_field.py", line 783, in _element_constructor_ return self._element_class(self, x, y, coerce=coerce) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "fraction_field_element.pyx", line 130, in sage.rings.fraction_field_element.FractionFieldElement.__init__ ZeroDivisionError: fraction field element division by zero

Check failure on line 2351 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 730, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1154, in compile_and_execute exec(compiled, globs) File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_[29]>", line 1, in <module> f / d ~~^~~ File "element.pyx", line 1736, in sage.structure.element.Element.__truediv__ File "coerce.pyx", line 1238, in sage.structure.coerce.CoercionModel.bin_op File "element.pyx", line 1734, in sage.structure.element.Element.__truediv__ File "multi_polynomial_libsingular.pyx", line 2364, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular._div_ File "parent.pyx", line 902, in sage.structure.parent.Parent.__call__ File "coerce_maps.pyx", line 183, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "coerce_maps.pyx", line 176, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.12/site-packages/sage/rings/fraction_field.py", line 783, in _element_constructor_ return self._element_class(self, x, y, coerce=coerce) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "fraction_field_element.pyx", line 130, in sage.rings.fraction_field_element.FractionFieldElement.__init__ ZeroDivisionError: fraction field element division by zero
1/x
"""
cdef poly *p
cdef MPolynomial_libsingular right = <MPolynomial_libsingular>right_ringelement
Expand Down Expand Up @@ -4190,13 +4199,22 @@
...
NotImplementedError: Division of multivariate polynomials over prime fields with characteristic > 2^29 is not implemented.
sage: R.<x,y,z> = GF((2^29-3)^2)[]
sage: ((x+y)^3+x+z)//(x+y)

Check failure on line 4202 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Failed example:

Failed example:: Got: x^2 + 2*x*y + y^2

Check failure on line 4202 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Failed example:

Failed example:: Got: x^2 + 2*x*y + y^2

Check failure on line 4202 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Failed example:

Failed example:: Got: x^2 + 2*x*y + y^2

Check failure on line 4202 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Failed example:

Failed example:: Got: x^2 + 2*x*y + y^2

Check failure on line 4202 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Failed example:

Failed example:: Got: x^2 + 2*x*y + y^2

Check failure on line 4202 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Failed example:

Failed example:: Got: x^2 + 2*x*y + y^2
x^2 + 2*x*y + y^2
x^2 + 2*x*y + y^2 + 1
sage: R.<x,y,z> = Zmod(7^2)[]
sage: ((x+y)^3+x+z)//(x+y)
Traceback (most recent call last):
...
NotImplementedError: Division of multivariate polynomials over non fields by non-monomials not implemented.

Ensure that :issue:`39801` is fixed::

sage: R.<a> = PolynomialRing(QQ)
sage: S.<x,y> = PolynomialRing(R)
sage: f = 1/a * (x^2 + y^2)
sage: g = x^2 + y^2
sage: f // g

Check failure on line 4216 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Failed example:

Failed example:: Got: 0

Check failure on line 4216 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Failed example:

Failed example:: Got: 0

Check failure on line 4216 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Failed example:

Failed example:: Got: 0

Check failure on line 4216 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Failed example:

Failed example:: Got: 0

Check failure on line 4216 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Failed example:

Failed example:: Got: 0

Check failure on line 4216 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Failed example:

Failed example:: Got: 0
1/a
"""
cdef MPolynomialRing_libsingular parent = self._parent
cdef MPolynomial_libsingular _right = <MPolynomial_libsingular>right
Expand Down Expand Up @@ -4262,7 +4280,7 @@
sage: R.<x, y> = QQ[]
sage: f = (x^3 + 2*y^2*x) * (x^2 + x + 1); f
x^5 + 2*x^3*y^2 + x^4 + 2*x^2*y^2 + x^3 + 2*x*y^2
sage: F = f.factor(); F

Check failure on line 4283 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Failed example:

Failed example:: Got: doctest:warning File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.factor[2]>", line 1, in <module> F = f.factor(); F File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/warnings.py", line 112, in _showwarnmsg sw(msg.message, msg.category, msg.filename, msg.lineno, : UserWarning: error in Singular ignored: x * (x^2 + x + 1) * (x^2 + 2*y^2)

Check failure on line 4283 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Failed example:

Failed example:: Got: doctest:warning File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.factor[2]>", line 1, in <module> F = f.factor(); F File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.11/warnings.py", line 110, in _showwarnmsg sw(msg.message, msg.category, msg.filename, msg.lineno, : UserWarning: error in Singular ignored: x * (x^2 + x + 1) * (x^2 + 2*y^2)

Check failure on line 4283 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Failed example:

Failed example:: Got: doctest:warning File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.factor[2]>", line 1, in <module> F = f.factor(); F File "/usr/share/miniconda/envs/sage-dev/lib/python3.11/warnings.py", line 110, in _showwarnmsg sw(msg.message, msg.category, msg.filename, msg.lineno, : UserWarning: error in Singular ignored: x * (x^2 + x + 1) * (x^2 + 2*y^2)

Check failure on line 4283 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Failed example:

Failed example:: Got: doctest:warning File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.factor[2]>", line 1, in <module> F = f.factor(); F File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/warnings.py", line 112, in _showwarnmsg sw(msg.message, msg.category, msg.filename, msg.lineno, : UserWarning: error in Singular ignored: x * (x^2 + x + 1) * (x^2 + 2*y^2)

Check failure on line 4283 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Failed example:

Failed example:: Got: doctest:warning File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.factor[2]>", line 1, in <module> F = f.factor(); F File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/warnings.py", line 112, in _showwarnmsg sw(msg.message, msg.category, msg.filename, msg.lineno, : UserWarning: error in Singular ignored: x * (x^2 + x + 1) * (x^2 + 2*y^2)

Check failure on line 4283 in src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Failed example:

Failed example:: Got: doctest:warning File "<doctest sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.factor[2]>", line 1, in <module> F = f.factor(); F File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.12/warnings.py", line 112, in _showwarnmsg sw(msg.message, msg.category, msg.filename, msg.lineno, : UserWarning: error in Singular ignored: x * (x^2 + x + 1) * (x^2 + 2*y^2)
x * (x^2 + x + 1) * (x^2 + 2*y^2)

Next we factor the same polynomial, but over the finite field
Expand Down
Loading