#12996: Support for one-dimensional shifts of finite type
--------------------------------------+-------------------------------------
Reporter: mhs | Owner: sage-combinat
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.4
Component: combinatorics | Resolution:
Keywords: symbolic dynamics | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Michael Schraudner | Merged in:
Dependencies: | Stopgaps:
--------------------------------------+-------------------------------------
Comment (by vdelecroix):
Hi Michael,
> - renamed method "__repr__" to "_repr_". (although I still dont see the
difference - I looked at the documentation of SageObject, but did not get
the point - can you explain this, maybe in a private email)
> Your first comment is not yet addressed, as I dont know what you would
like to see as output. If the SFT has a name this name is returned, but if
it does not? The method could just return "An SFT", but what is the point
of this, you could just check "isinstance" - it is not very informative,
so I thought having at least the alphabet would be helpful. Any
suggestions on this from your side would be very welcome.
The SageObject implements custom names and it is not needed to reimplement
it
{{{
sage: class A(SageObject):
....: pass
sage: a = A()
sage: a
<class '__main__.A'>
sage: a.rename('toto')
sage: a
toto
sage: a.reset_name()
sage: a
<class '__main__.A'>
}}}
The method __repr__ of SageObject precisely choose whether to use the
custom name or the method _repr_ that are implemented in derived classes.
> - renamed option "alph" to "alphabet"
> - the option "alphabet" accepts as input both a list and an alphabet (as
defined in the word class), so externally there is no difference.
Internally I prefer the standard type list - it has less overhead,
especially as it is accessed a lot in building admissible words etc.
Cool! I hope that in a next future it would be simpler and faster to use
alphabet.
> - changed documentation of "an_element". Your comment seems to be based
on a misunderstanding as the method already DID return an element of the
SFT in form of an iterator - how else would you represent an infinite
sequence of symbols? Comments welcome.
I agree that mathematically the sequence belongs to the SFT but as a
Python object it is an iterator and not an element of the subshift. What
I mean by an element is something that knows what its parent is. In other
words with the following behavior
{{{
sage: S = MySFT()
sage: S
My SFT
sage: s = S.an_element()
sage: s in S
True
sage: s.parent()
My SFT
}}}
(the notion of element/parent is explained in the Sage reference
http://www.sagemath.org/doc/reference/coercion.html)
In your case you may use infinite which can be initialized from iterators.
A basic example is as follows
{{{
sage: W = Words('ab')
sage: from itertools import count
sage: W('a' if (n%5+1)%3 else 'b' for n in count())
word: aabaaaabaaaabaaaabaaaabaaaabaaaabaaaabaa...
}}}
Anyway, the issue about element/parent will be solved with the
"categorification" of shifts and languages (ticket #12224).
>> * the output is too verbose. When I print a number I do not want to see
"Number 3112. It is not prime and its divisors are 1, 2, 4, 8, 389, 778,
1556 and 3112." but only "3112". The same for shifts. Methods are here to
get more informations.
My comment about the output is no more than a comment. I find it too
verbose but I do not know what is better. For graphs the ouptut is simply
"Graph on 12 vertices". You may choose "SFT over {a, b, c}" where {a, b,
c} is replaced by whatever is the alphabet but you may prefer as well to
keep the old version.
Hoping that the definitive version is not far away.
Best,
Vincent
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12996#comment:26>
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 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.