#13299: Fix slice and __getitem__ methods of padics
--------------------------------+-------------------------------------------
Reporter: saraedum | Owner: roed
Type: defect | Status: needs_review
Priority: minor | Milestone: sage-5.9
Component: padics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Julian Rueth | Merged in:
Dependencies: | Stopgaps:
--------------------------------+-------------------------------------------
Description changed by roed:
Old description:
> There are a few surprises/bugs in the way that slices and
> {{{__getitem__}}} works for padics.
>
> * Slices are not supported in some cases:
> {{{
> sage: R = Zp(5, 6, 'capped-rel')
> sage: a = R(1/2); a
> 3 + 2*5 + 2*5^2 + 2*5^3 + 2*5^4 + 2*5^5 + O(5^6)
> sage: a[0:5]
> ValueError: due to limitations in Python 2.5, you must call the slice()
> function rather than using the [:] syntax in this case
> }}}
> * The precision is sometimes wrong over fields:
> {{{
> sage: K = Qp(5, 6)
> sage: a = K(1/25); a
> 5^-2 + O(5^4)
> sage: a.slice(2, 4)
> O(5^6)
> }}}
> * Over fields, the coefficients are sometimes wrong:
> {{{
> sage: a.slice(-5, -1)
> 5^-5 + O(5)
> }}}
> * Some indices produce an error, even though they are inside the
> precision:
> {{{
> sage: a.precision_absolute()
> 4
> sage: a[0]
> IndexError: list index out of range
> }}}
> * The returned values are sometimes padics
> {{{
> sage: a = K(1/5 + 5); a
> 5^-1 + 5 + O(5^5)
> sage: a[-2].parent()
> 5-adic Field with capped relative precision 6
> sage: a[-1].parent()
> Integer Ring
> }}}
> * They do not seem to work over unramified extensions. This is the topic
> of #13300.
New description:
There are a few surprises/bugs in the way that slices and
{{{__getitem__}}} works for padics.
* Slices are not supported in some cases:
{{{
sage: R = Zp(5, 6, 'capped-rel')
sage: a = R(1/2); a
3 + 2*5 + 2*5^2 + 2*5^3 + 2*5^4 + 2*5^5 + O(5^6)
sage: a[0:5]
ValueError: due to limitations in Python 2.5, you must call the slice()
function rather than using the [:] syntax in this case
}}}
* The precision is sometimes wrong over fields:
{{{
sage: K = Qp(5, 6)
sage: a = K(1/25); a
5^-2 + O(5^4)
sage: a.slice(2, 4)
O(5^6)
}}}
* Over fields, the coefficients are sometimes wrong:
{{{
sage: a.slice(-5, -1)
5^-5 + O(5)
}}}
* Some indices produce an error, even though they are inside the
precision:
{{{
sage: a.precision_absolute()
4
sage: a[0]
IndexError: list index out of range
}}}
* The returned values are sometimes padics
{{{
sage: a = K(1/5 + 5); a
5^-1 + 5 + O(5^5)
sage: a[-2].parent()
5-adic Field with capped relative precision 6
sage: a[-1].parent()
Integer Ring
}}}
* They do not seem to work over unramified extensions. This is the topic
of #13300.
'''Apply''' [attachment:trac_13299.patch], [attachment:13299_review.patch]
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13299#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.