#14914: Stuffle algebra
-------------------------------------+-------------------------------------
Reporter: deneufchatel | Owner: Matthieu Deneufchâtel
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-6.10
Component: combinatorics | Resolution:
Keywords: stuffle quasi | Merged in:
shuffle | Reviewers:
Authors: Matthieu | Work issues:
Deneufchâtel | Commit:
Report Upstream: N/A | 30cceb22a0d0d91ebbb2cf0aec61e0501bfe94c3
Branch: | Stopgaps:
public/ticket/14914 |
Dependencies: |
-------------------------------------+-------------------------------------
Changes (by vdelecroix):
* status: needs_review => needs_work
* milestone: sage-6.6 => sage-6.10
Comment:
The latex command `\stuffle` is not interpreted in the reference manual.
The `(see above)` is not appropriate. In this case it makes reference to
another function. And indeed, in the reference manual, the class appears
first. You can use the syntax {{{:func:`the_name_of_my_function`}}} to
refer to a function. But in that case I would actually move the definition
from the function to the class (since the entry point for the users is the
class).
The first line of `stuffle` is `W = Words(indexed_letters(40, names))`.
Why the hardcoded 40? Whatever number you put it will fail for some input!
What you actually want to do is to work over the infinite alphabet `a1,
a2, ...`. You can find a draft of the kind of set you want in the attached
file [http://trac.sagemath.org/attachment/ticket/14914/indexed_alphabet.py
indexed_alphabet.py]. With it you have
{{{
sage: A = IndexedAlphabet('a', 0, Infinity)
sage: A
Indexed alphabet {a0, a1, a2...}
sage: A[19]
'a19'
sage: A.cardinality()
+Infinity
sage: W = Words(A)
sage: W(['a0','a1','a19'])
word: a0,a1,a19
}}}
Once the above integrated, there is no need for an argument `names` in the
function stuffle.
To test emptyness of a word you can do faster
{{{
sage: w = Word()
sage: if not w: print "I am empty"
I am empty
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/14914#comment:5>
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.