Opened 22 months ago

Last modified 4 weeks ago

#28827 new defect

Intermittent failures with symbolic gcd computation

Reported by: klee Owned by:
Priority: minor Milestone: sage-9.5
Component: symbolics Keywords:
Cc: gh-DaveWitteMorris, jhpalmieri, slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by slelievre)

On macOS, the following:

sage: gcd(x, QQbar(I))

correctly returns 1 in most Sage sessions, but raises an error in a tenth to a third of sessions:

TypeError: unsupported operand parent(s) for +:
'Algebraic Real Field' and 'Number Field in I
with defining polynomial x^2 + 1 with I = 1*I'

That issue was discussed at #28489, but covered up hastily because it was blocking Sage on Python 3.

The solution there by flagging the problematic doctests with "known bugs" is a bad solution, since the problem of the doctests is not wrong answers but intermittent failures.

This ticket would welcome a real solution. The aim is not to get correct answers for all cases in symbolic gcd computation, but to avoid uncontrolled failures.

See the discussion at #28489 and the upstream issue:

Change History (9)

comment:1 Changed 22 months ago by jhpalmieri

  • Cc jhpalmieri added

comment:2 Changed 21 months ago by embray

  • Milestone changed from sage-9.0 to sage-9.1

Ticket retargeted after milestone closed

comment:3 Changed 17 months ago by mkoeppe

  • Milestone changed from sage-9.1 to sage-9.2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

comment:4 Changed 11 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3

comment:5 Changed 6 months ago by slelievre

  • Cc gh-DaveWitteMorris slelievre added
  • Description modified (diff)

comment:6 Changed 5 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

comment:7 Changed 3 months ago by chapoton

Investigating, one finds

sage: N, i_neg, emb = QQbar(-I).as_number_field_element()                       
sage: from sage.categories.pushout import pushout                               
sage: pushout(AA,K)                                                             
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
~/sage/local/lib/python3.9/site-packages/sage/categories/pushout.py in pushout(R, S)
   4190 
-> 4191         return all(Z)
   4192 

~/sage/local/lib/python3.9/site-packages/sage/categories/functor.pyx in sage.categories.functor.Functor.__call__ (build/cythonized/sage/categories/functor.c:3145)()
    382             return self._apply_functor_to_morphism(x)
--> 383         y = self._apply_functor(self._coerce_into_domain(x))
    384         if not ((y in self.__codomain) or (y in self.__codomain.Homsets())):

~/sage/local/lib/python3.9/site-packages/sage/categories/pushout.py in _apply_functor(self, R)
   3164         if len(self.polys) == 1:
-> 3165             return R.extension(self.polys[0], names=self.names[0], embedding=self.embeddings[0],
   3166                                structure=self.structures[0], prec=self.precs[0],

~/sage/local/lib/python3.9/site-packages/sage/rings/ring.pyx in sage.rings.ring.CommutativeRing.extension (build/cythonized/sage/rings/ring.c:13751)()
   1519             if not (val is None or isinstance(val, list) and all(c is None for c in val)):
-> 1520                 raise NotImplementedError("ring extension with prescripted %s is not implemented"%key)
   1521         R = self[name]

NotImplementedError: ring extension with prescripted embedding is not implemented

During handling of the above exception, another exception occurred:

CoercionException                         Traceback (most recent call last)
<ipython-input-84-de427d8f7020> in <module>
----> 1 pushout(AA,K)

~/sage/local/lib/python3.9/site-packages/sage/categories/pushout.py in pushout(R, S)
   4197         # make sense, and in this case simply want to return that a pushout
   4198         # couldn't be found.
-> 4199         raise CoercionException(ex)
   4200 
   4201 

CoercionException: ring extension with prescripted embedding is not implemented

comment:8 Changed 3 months ago by slelievre

Side-ticket: #31917 to fix the typo prescripted -> prescribed.

comment:9 Changed 4 weeks ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5
Note: See TracTickets for help on using tickets.