Opened 15 years ago
Closed 8 years ago
#1210 closed defect (fixed)
[with patch, needs work] Cannot create distinct polynomial rings over p-adic rings with different print_modes
Reported by: | ncalexan | Owned by: | roed |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | commutative algebra | Keywords: | polynomial p-adic print mode cache caching |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The issue is in the caching:
sage: R = Qp(7, print_mode='val-unit') sage: S = Qp(7) sage: R(7^2 + 1) 7^2 * 1 + O(7^22) sage: S(7^2) 7^2 + O(7^22) sage: R(7^2 + 1) 50 + O(7^20) sage: S(7^2 + 1) 1 + 7^2 + O(7^20) sage: R is S False sage: R['x'] is S['x'] True
The issue manifests itself in polynomial_ring_constructor, which fails because the cache is keyed by ==, not identity, and
sage: R == S True
Attachments (2)
Change History (9)
Changed 13 years ago by
comment:1 Changed 13 years ago by
- Summary changed from Cannot create distinct polynomial rings over p-adic rings with different print_modes to [with patch, needs review] Cannot create distinct polynomial rings over p-adic rings with different print_modes
Changed 13 years ago by
comment:2 Changed 13 years ago by
- Summary changed from [with patch, needs review] Cannot create distinct polynomial rings over p-adic rings with different print_modes to [with patch, needs work] Cannot create distinct polynomial rings over p-adic rings with different print_modes
I have lots of doctest failures... wrong versions? The argument "print_pos" does not appear anywhere in my sage/rings/padics directory, btw.
---------------------------------------------------------------------- | Sage Version 3.3.alpha0, Release Date: 2009-01-19 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- Loading Sage library. Current Mercurial branch is: nca sage: import sage_emacs as emacs sage: R = Qp(7, print_mode='digits', print_pos=True) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/ncalexan/.sage/temp/sage.math.washington.edu/16970/_home_ncalexan__sage_init_sage_0.py in <module>() ----> 1 2 3 4 5 /scratch/nca/sage-3.3.alpha1-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/factory.so in sage.structure.factory.UniqueFactory.__call__ (sage/structure/factory.c:579)() 106 107 --> 108 109 110 /scratch/nca/sage-3.3.alpha1-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/factory.so in sage.structure.factory.UniqueFactory.create_key_and_extra_args (sage/structure/factory.c:1373)() 193 194 --> 195 196 197 TypeError: create_key() got an unexpected keyword argument 'print_pos' sage: S = Qp(7, print_mode='digits', print_pos=False) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/ncalexan/.sage/temp/sage.math.washington.edu/16970/_home_ncalexan__sage_init_sage_0.py in <module>() ----> 1 2 3 4 5 /scratch/nca/sage-3.3.alpha1-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/factory.so in sage.structure.factory.UniqueFactory.__call__ (sage/structure/factory.c:579)() 106 107 --> 108 109 110 /scratch/nca/sage-3.3.alpha1-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/factory.so in sage.structure.factory.UniqueFactory.create_key_and_extra_args (sage/structure/factory.c:1373)() 193 194 --> 195 196 197 TypeError: create_key() got an unexpected keyword argument 'print_pos' sage:
comment:3 follow-up: ↓ 4 Changed 13 years ago by
David, Nick: Has this problem been fixed due to the work by David merged in 3.4.1.rc3?
Cheers,
Michael
comment:4 in reply to: ↑ 3 Changed 13 years ago by
Replying to mabshoff:
David, Nick: Has this problem been fixed due to the work by David merged in 3.4.1.rc3?
Cheers,
Michael
It would appear so. Consider:
sage: R = Qp(7, print_mode='val-unit') sage: S = Qp(7) sage: R(7^2 + 1) 7^2 * 1 + O(7^22) sage: S(7^2) 7^2 + O(7^22) sage: R(7^2 + 1) 50 + O(7^20) sage: S(7^2 + 1) 1 + 7^2 + O(7^20) sage: R is S False sage: R['x'] is S['x'] False # this is now fixed sage: R['x'](7^2) (7^2 * 1 + O(7^22)) sage: S['x'](7^2) (7^2 + O(7^22)) sage: R['x'](7^2+1) (50 + O(7^20)) sage: S['x'](7^2+1) (1 + 7^2 + O(7^20))
However, this is still puzzling:
sage: R['x'] == S['x'] False
comment:5 follow-up: ↓ 6 Changed 9 years ago by
- Milestone changed from sage-5.9 to sage-duplicate/invalid/wontfix
- Report Upstream set to N/A
- Status changed from needs_work to needs_review
I get with 5.9.beta1
:
sage: sage: R = Qp(7, print_mode='val-unit') sage: sage: S = Qp(7) sage: R is S False sage: R == S False sage: R['x'] == S['x'] False sage: R['x'] is S['x'] False
which is the expected behavior due to UniqueRepresentation
parents.
comment:6 in reply to: ↑ 5 Changed 8 years ago by
- Status changed from needs_review to positive_review
Replying to tscrim:
I get with
5.9.beta1
:sage: sage: R = Qp(7, print_mode='val-unit') sage: sage: S = Qp(7) sage: R is S False sage: R == S False sage: R['x'] == S['x'] False sage: R['x'] is S['x'] Falsewhich is the expected behavior due to
UniqueRepresentation
parents.
It should be due to UniqueFactory
(in 6.2.beta3
). But anyway, documentation of Qp
says
PRINTING: There are many different ways to print `p`-adic elements. ... Note that the printing options affect whether different `p`-adic fields are considered equal.
comment:7 Changed 8 years ago by
- Resolution set to fixed
- Status changed from positive_review to closed
Use this one instead