Opened 7 years ago
Last modified 7 years ago
#17741 needs_work enhancement
Polynomial __div__ override redundant with coercion.
Reported by: | robertwb | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.9 |
Component: | coercion | Keywords: | |
Cc: | Merged in: | ||
Authors: | Robert Bradshaw | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | public/17741 (Commits, GitHub, GitLab) | Commit: | f5a59a3400508531d6d19803dc277c01e896f8d8 |
Dependencies: | #17740 | Stopgaps: |
Description
We no longer need to special case this now that #17740 is fixed.
Change History (10)
comment:1 Changed 7 years ago by
- Branch set to u/robertwb/poly-div
comment:2 Changed 7 years ago by
- Commit set to 69962b6b5428e1c7935c2c6becfa639d57246dc7
- Status changed from new to needs_review
comment:3 Changed 7 years ago by
- Status changed from needs_review to needs_work
comment:4 Changed 7 years ago by
- Commit changed from 69962b6b5428e1c7935c2c6becfa639d57246dc7 to 2372d53d149a02b6d421b5a469f573126eb52a11
comment:5 Changed 7 years ago by
- Status changed from needs_work to needs_review
comment:6 Changed 7 years ago by
- Commit changed from 2372d53d149a02b6d421b5a469f573126eb52a11 to b63e8f8d841a6386a822f8531ae9eb633c5fe3b5
Branch pushed to git repo; I updated commit sha1. New commits:
a60134c | trac #17740: review 1 (documentation)
|
728811d | trac #17740: review 2 (clean Errors)
|
96c1a03 | trac #17740: review 3 (less in try/except block)
|
2cb51c0 | Re-introduce action of fraction field as fallback for division action.
|
b63e8f8 | Merge branch 'coerce-div' into 17741-poly-div
|
comment:7 Changed 7 years ago by
- Commit changed from b63e8f8d841a6386a822f8531ae9eb633c5fe3b5 to 830460a4767e467087d0ed76d14232cdc7da635f
comment:8 Changed 7 years ago by
- Status changed from needs_review to needs_work
Got one doctest failing
sage -t --long src/sage/rings/finite_rings/integer_mod_ring.py ********************************************************************** File "src/sage/rings/finite_rings/integer_mod_ring.py", line 807, in sage.rings.finite_rings.integer_mod_ring.IntegerModRing_generic._pseudo_fraction_field Failed example: (x+5)/2 Exception raised: Traceback (most recent call last) ... sage.rings.finite_rings.integer_mod_ring.IntegerModRing_generic._pseudo_fraction_field[3]>", line 1, in <module> (x+Integer(5))/Integer(2) File "sage/structure/element.pyx", line 1973, in sage.structure.element.RingElement.__div__ (build/cythonized/sage/structure/element.c:18228) return coercion_model.bin_op(self, right, div) File "sage/structure/coerce.pyx", line 802, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:7201) raise File "sage/structure/coerce.pyx", line 798, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:7148) return PyObject_CallObject(op, xy) File "sage/structure/element.pyx", line 1971, in sage.structure.element.RingElement.__div__ (build/cythonized/sage/structure/element.c:18210) return (<RingElement>self)._div_(<RingElement>right) File "sage/structure/element.pyx", line 1981, in sage.structure.element.RingElement._div_ (build/cythonized/sage/structure/element.c:18365) return self._parent.fraction_field()(self, right) File "sage/rings/ring.pyx", line 1226, in sage.rings.ring.CommutativeRing.fraction_field (build/cythonized/sage/rings/ring.c:10158) TypeError: self must be an integral domain.
comment:9 Changed 7 years ago by
- Branch changed from u/robertwb/poly-div to public/17741
- Commit changed from 830460a4767e467087d0ed76d14232cdc7da635f to f5a59a3400508531d6d19803dc277c01e896f8d8
- Milestone changed from sage-6.5 to sage-6.9
- Status changed from needs_work to needs_review
comment:10 Changed 7 years ago by
- Status changed from needs_review to needs_work
I still get the error as in 8. Though the following works well
sage: R.<x> = Integers(15)[] sage: (x+5) / R.base_ring()(2) 8*x + 10
and one can check
sage: cm = get_coercion_model() sage: R.<x> = Integers(15)[] sage: a = cm.get_action(R, R.base_ring(), operator.div) sage: a(x+5,2) 8*x + 10
The problem is when we divide by an integer
sage: cm.get_action(R, ZZ, operator.div) <NOTHING>
The above fails because the following does
sage: cm = get_coercion_model() sage: R.<x> = Integers(15)[] sage: right_mul = cm.get_action(R, ZZ, operator.mul) sage: action = ~right_mul Traceback (most recent call last): ... CoercionException: x (=Ring of integers modulo 15) is not in Category of integral domains
Note: See
TracTickets for help on using
tickets.
(I didn't try #17740 separately.)