Opened 6 years ago
Closed 5 years ago
#15059 closed defect (fixed)
Morphisms cannot be applied to too-simple elements of a multivariate power series ring
Reported by: | darij | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.3 |
Component: | algebra | Keywords: | rings, power series, polynomials |
Cc: | SimonKing, niles | Merged in: | |
Authors: | Darij Grinberg | Reviewers: | Peter Bruin |
Report Upstream: | N/A | Work issues: | |
Branch: | 99a7fb6 (Commits) | Commit: | 99a7fb62fcabcf9babb5839df3c144f68cb918c8 |
Dependencies: | Stopgaps: |
Description
sage: M.<u,v> = PowerSeriesRing(GF(5)) sage: s = M.hom([u, u+v]) sage: s(M.one()) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-4-754f257583fc> in <module>() ----> 1 s(M.one()) /home/darij/sage-5.11.beta3/local/lib/python2.7/site-packages/sage/categories/map.so in sage.categories.map.Map.__call__ (sage/categories/map.c:4018)() /home/darij/sage-5.11.beta3/local/lib/python2.7/site-packages/sage/rings/morphism.so in sage.rings.morphism.RingHomomorphism_im_gens._call_ (sage/rings/morphism.c:7481)() /home/darij/sage-5.11.beta3/local/lib/python2.7/site-packages/sage/rings/multi_power_series_ring_element.pyc in _im_gens_(self, codomain, im_gens) 611 x + 2*y + 12*x*y^2 + O(x, y)^5 612 """ --> 613 return codomain(self(*im_gens)) 614 615 def __getitem__(self,n): /home/darij/sage-5.11.beta3/local/lib/python2.7/site-packages/sage/rings/multi_power_series_ring_element.pyc in __call__(self, *x, **kwds) 462 else: 463 newprec = self.prec()*min(valn_list) --> 464 return self._value().subs(sub_dict).add_bigoh(newprec) 465 466 def _subs_formal(self, *x, **kwds): /home/darij/sage-5.11.beta3/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.Element.__getattr__ (sage/structure/element.c:3871)() /home/darij/sage-5.11.beta3/local/lib/python2.7/site-packages/sage/structure/misc.so in sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1696)() AttributeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int' object has no attribute 'add_bigoh'
(Alternatively, the same error can be caught by calling M.one()._im_gens_(M, [u,u+v])
without ever defining s
.)
Note that s(u)
and s(v)
work fine.
Attachments (2)
Change History (11)
Changed 6 years ago by
Changed 6 years ago by
comment:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
- Keywords polynomials added
- Status changed from new to needs_review
comment:3 Changed 6 years ago by
- Cc SimonKing nilesj added
comment:4 Changed 6 years ago by
- Cc niles added; nilesj removed
comment:5 Changed 6 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:6 Changed 5 years ago by
- Branch set to u/pbruin/15059-MPowerSeries_call
- Commit set to 99a7fb62fcabcf9babb5839df3c144f68cb918c8
- Reviewers set to Peter Bruin
- Status changed from needs_review to positive_review
Looks good; the patch applied without conflicts, I only converted it into a Git branch to delete trailing whitespace. It fixes the bug and passes all tests. I don't want to think about deciding where the result of subs()
should live in general...
comment:7 Changed 5 years ago by
Thank you! I'm just hoping it doesn't conflict with the ongoing category revamp...
comment:8 Changed 5 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:9 Changed 5 years ago by
- Branch changed from u/pbruin/15059-MPowerSeries_call to 99a7fb62fcabcf9babb5839df3c144f68cb918c8
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Fixed. The patch was uploaded twice due to connection issues; it's one and the same file nevertheless.
The issue at hand was that the
__call__
method of classMPowerSeries
(elements of multivariate power series rings) calls thesubs
method of polynomials, but this method behaves somewhat unpredictably as concerning the parent of its output: If the input is a constant polynomial, it does not change the base ring (even if the substitution should send polynomials from ZZ to polynomials from ZZ/5ZZ):Note that this issue only appears with multivariate polynomials. Univariate ones substitute fine.
Is my fix misguided in that it fixes the symptom rather than the cause?
patchbot:
apply trac_15059-multivariate_fix-dg.patch