Opened 10 years ago
Closed 20 months ago
#10978 closed defect (duplicate)
Resultant for polynomials over RDF and CDF not implemented
Reported by: | spice | Owned by: | AlexGhitza |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | algebra | Keywords: | polynomial, resultant |
Cc: | Merged in: | ||
Authors: | Reviewers: | Bruno Grenet | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Calling the resultant method for a polynomial defined over RDF or CDF returns a NotImplementedError?. It would appear that this results from it not being implemented in Singular.
sage: R.<x> = PolynomialRing(CDF) sage: f = R(1 - I*x + (0.5)*x^2 + (1.7)*x^3) sage: g = f.derivative() sage: f.resultant(g) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /Users/simonspicer/<ipython console> in <module>() /Users/simonspicer/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_singular_interface.pyc in resultant(self, other, variable) 351 return lcm_func(self, singular, have_ring) 352 def resultant(self, other, variable=None): --> 353 return resultant_func(self, other, variable) 354 355 def _singular_func(self, singular=singular_default, have_ring=False): /Users/simonspicer/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_singular_interface.pyc in resultant_func(self, other, variable) 499 if variable is None: 500 variable = self.parent().gen(0) --> 501 rt = self._singular_().resultant(other._singular_(), variable._singular_()) 502 r = rt.sage_poly(self.parent()) 503 if self.parent().ngens() <= 1 and r.degree() <= 0: /Users/simonspicer/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in __call__(self, *args, **kwds) 1481 1482 def __call__(self, *args, **kwds): -> 1483 return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds) 1484 1485 def help(self): /Users/simonspicer/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in function_call(self, function, args, kwds) 1380 [s.name() for s in args], 1381 ['%s=%s'%(key,value.name()) for key, value in kwds.items()]) -> 1382 return self.new(s) 1383 1384 def _function_call_string(self, function, args, kwds): /Users/simonspicer/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in new(self, code) 1161 1162 def new(self, code): -> 1163 return self(code) 1164 1165 ################################################################### /Users/simonspicer/sage/local/lib/python2.6/site-packages/sage/interfaces/singular.pyc in __call__(self, x, type) 659 x = str(x)[1:-1] 660 --> 661 return SingularElement(self, type, x, False) 662 663 def has_coerce_map_from_impl(self, S): /Users/simonspicer/sage/local/lib/python2.6/site-packages/sage/interfaces/singular.pyc in __init__(self, parent, type, value, is_name) 1122 except (RuntimeError, TypeError, KeyboardInterrupt), x: 1123 self._session_number = -1 -> 1124 raise TypeError, x 1125 else: 1126 self._name = value TypeError: Singular error: ? not implemented ? error occurred in or before STDIN line 94: `def sage19=resultant(sage17,sage18,sage15);`
Change History (9)
comment:1 follow-up: ↓ 4 Changed 10 years ago by
comment:2 Changed 8 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:3 Changed 7 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:4 in reply to: ↑ 1 Changed 7 years ago by
Replying to spice:
As such, this should be fixed in an upcoming version of Cython.
The issue is unchanged 3 years later.
comment:5 Changed 7 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:6 Changed 7 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:7 Changed 2 years ago by
- Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
- Status changed from new to needs_review
duplicate of #2693
comment:8 Changed 20 months ago by
- Reviewers set to Bruno Grenet
- Status changed from needs_review to positive_review
I confirm the duplication, and the described behavior changed after #2693.
comment:9 Changed 20 months ago by
- Resolution set to duplicate
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
I think I've tracked down the issue after some digging. From rings/polynomial/polynomial_singular_interface.py/, class Polynomial_singular_repr: "Due to the incompatibility of Python extension classes and multiple inheritance, this just defers to module-level functions."
This appears to be a Cython multiple inheritance issue - polynomials over RDF and CDF are examples of the Polynomial_generic_field, which are subclasses of Polynomial_singular_repr. The .resultant() method there fails for these objects but the .resultant() method of the Polynomial parent class (which does work) gets skipped overdue to the multiple inheritance issue.
As such, this should be fixed in an upcoming version of Cython.