Opened 8 years ago
Last modified 6 years ago
#14914 needs_work enhancement
Stuffle algebra
Reported by: | deneufchatel | Owned by: | Matthieu Deneufchâtel |
---|---|---|---|
Priority: | minor | Milestone: | sage-6.10 |
Component: | combinatorics | Keywords: | stuffle quasi shuffle |
Cc: | Merged in: | ||
Authors: | Matthieu Deneufchâtel | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | public/ticket/14914 (Commits, GitHub, GitLab) | Commit: | 30cceb22a0d0d91ebbb2cf0aec61e0501bfe94c3 |
Dependencies: | Stopgaps: |
Description (last modified by )
The stuffle (or quasi shuffle) algebra with counit and coproduct.
Apply:
Attachments (3)
Change History (8)
Changed 8 years ago by
comment:1 Changed 8 years ago by
- Description modified (diff)
comment:2 Changed 8 years ago by
Hey Matthieu,
Is this patch ready for review (i.e. does it do everything you want it to)?
Best,
Travis
comment:3 Changed 8 years ago by
- Status changed from new to needs_review
Changed 8 years ago by
comment:4 Changed 6 years ago by
- Branch set to public/ticket/14914
- Commit set to 30cceb22a0d0d91ebbb2cf0aec61e0501bfe94c3
- Keywords stuffle quasi shuffle added
- Milestone set to sage-6.6
Changed 6 years ago by
comment:5 Changed 6 years ago by
- Milestone changed from sage-6.6 to sage-6.10
- Status changed from needs_review to needs_work
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 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
here is a first review patch, cleaning up and making sure that all tests pass
(check using sage -bt stuffle_algebra.py)
some somments:
TAB characters are forbidden in python, you should use 4 spaces. More generally one should avoid whitespaces at the end of the lines (trailing whitespaces) (check your text editor configuration)
the examples section should look like that:
namely, with a shift of 4 spaces
If you want to work further on this ticket now, you should rather use a third patch on top of the two existing ones.