#2551: [fixed by #5508] `__getitem__` for relative number field elements is ...
now fixed
---------------------------+------------------------------------------------
Reporter: craigcitro | Owner: was
Type: defect | Status: new
Priority: minor | Milestone: sage-3.4.1
Component: number theory | Keywords:
---------------------------+------------------------------------------------
Comment(by fwclarke):
Replying to [comment:2 mabshoff]:
> To close this we would need a doctest.
See lines 2421 to 2445 of sage/rings/number_field/number_field_element.pyx
as patched by #5508:
{{{
EXAMPLES::
sage: K.<a, b> = NumberField([x^3 - 5, x^2 + 3])
sage: c = (a + b)^3; c
3*b*a^2 - 9*a - 3*b + 5
sage: c[0]
-3*b + 5
We illustrate bounds checking::
sage: c[-1]
Traceback (most recent call last):
...
IndexError: index must be between 0 and the relative degree
minus 1.
sage: c[4]
Traceback (most recent call last):
...
IndexError: index must be between 0 and the relative degree
minus 1.
The list method implicitly calls ``__getitem__``::
sage: list(c)
[-3*b + 5, -9, 3*b]
sage: K(list(c)) == c
True
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2551#comment:4>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---