#17319: Add a powers() method to monoid elements
--------------------------------+-------------------------------
Reporter: pbruin | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone: sage-6.4
Component: basic arithmetic | Keywords: power
Merged in: | Authors: Peter Bruin
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
--------------------------------+-------------------------------
The purpose of this ticket is to add a `powers()` method to
`MonoidElement` and `RingElement` such that `x.powers(n)` returns `[x^0,
x^1, ..., x^(n-1)]`. This only needs ''n'' - 1 multiplications and hence
is more efficient than calling `[x^i for i in xrange(n)]`. Examples:
{{{
sage: G = SymmetricGroup(4)
sage: g = G([2,3,4,1])
sage: g.powers(4)
[(), (1,2,3,4), (1,3)(2,4), (1,4,3,2)]
sage: 5.powers(3)
[1, 5, 25]
}}}
Inspired by the `powers()` function that was recently added to PARI.
--
Ticket URL: <http://trac.sagemath.org/ticket/17319>
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.
For more options, visit https://groups.google.com/d/optout.