Opened 6 years ago
Last modified 5 years ago
#18565 new enhancement
catalog of sequences in SageMath
Reported by:  dkrenn  Owned by:  

Priority:  major  Milestone:  sage6.8 
Component:  combinatorics  Keywords:  
Cc:  mantepse  Merged in:  
Authors:  Daniel Krenn  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  u/dkrenn/sequences/base (Commits, GitHub, GitLab)  Commit:  b0bb4fa7a2a17ed74d25402a29fd4143473f3580 
Dependencies:  #19896  Stopgaps: 
Description (last modified by )
similar to
graphs.some_graph
or to
codes.some_code
(and similar), I propose to introduce
sequences.some_sequence
which should provide a unified access point to all possible sequences in SageMath. For example, there is fibonacci_sequence
in sage.combinat.combinat
, binary_recurring_sequence
(somewhere in combinat) and various other code.
This will use homogenous sequences (#19896), which themself use lazy lists.
See also the metaticket #16107.
 Old: See the discussion on sagedevel
Change History (15)
comment:1 Changed 6 years ago by
 Description modified (diff)
comment:2 followup: ↓ 3 Changed 6 years ago by
comment:3 in reply to: ↑ 2 ; followup: ↓ 4 Changed 6 years ago by
Dear Vincent,
Replying to vdelecroix:
Could you define what you mean by sequence. Is it sequence of numbers? Rational numbers? Real numbers? An element of an infinite cartesian power? Because there also are
sage: words.FibonacciWord('ab') word: abaababaabaababaababaabaababaabaababaaba...which is an infinite sequence of elements in
{a,b}
.
What I head in mind is a sequence of numbers (usually intergers, rationals, maybe reals). But of course words are very much related to it. So any ideas/suggestions are very welcome.
comment:4 in reply to: ↑ 3 ; followup: ↓ 7 Changed 6 years ago by
Replying to dkrenn:
Replying to vdelecroix:
Could you define what you mean by sequence. Is it sequence of numbers? Rational numbers? Real numbers? An element of an infinite cartesian power? Because there also are
sage: words.FibonacciWord('ab') word: abaababaabaababaababaabaababaabaababaaba...which is an infinite sequence of elements in
{a,b}
.What I head in mind is a sequence of numbers (usually intergers, rationals, maybe reals). But of course words are very much related to it. So any ideas/suggestions are very welcome.
Then you are more restrictive than wikipedia in which a sequence is even allowed to be finite. I do not have suggestion beyond having precise specifications. You can perhaps even be explicit in the names by using number_sequences.*
or sequences.numbers.*
? But those two looks a bit too much.
Vincent
comment:5 Changed 6 years ago by
And you also have orthogonal polynomials, orbit of a dynamical system, permutations (i.e. image of the letters), ... Depending on who you are talking to a sequence can be many things!
comment:6 followup: ↓ 8 Changed 6 years ago by
What about 'integer sequences', like for Sloane? Words are already stored in word.<tab>
comment:7 in reply to: ↑ 4 Changed 6 years ago by
Replying to vdelecroix:
Replying to dkrenn:
Replying to vdelecroix:
Could you define what you mean by sequence. Is it sequence of numbers? Rational numbers? Real numbers? An element of an infinite cartesian power?
What I head in mind is a sequence of numbers (usually intergers, rationals, maybe reals). [...]
Then you are more restrictive than wikipedia in which a sequence is even allowed to be finite.
I am happy to make it as general as needed.
I do not have suggestion beyond having precise specifications.
Like: Finite and infinite sequences where the elements can be any sage objects (but all of the same type/parent)?
Best,
Daniel
comment:8 in reply to: ↑ 6 ; followup: ↓ 9 Changed 6 years ago by
Replying to ncohen:
What about 'integer sequences', like for Sloane? Words are already stored in
word.<tab>
Ok. Do you think here of a parametrisation (parameter ZZ
for integer sequences; like the base for some parent)? I ask, because maybe someone wants to have a sequence of rationals (e.g. Bernoulli numbers) or polynomials (again e.g. Bernoulli). This would then be similar to words with an infinite alphabet...
comment:9 in reply to: ↑ 8 Changed 6 years ago by
Ok. Do you think here of a parametrisation (parameter
ZZ
for integer sequences; like the base for some parent)?
No idea. But I do not think that it is related to what this ticket is about. It seems that you want to create a catalog of some sorts, and we just have to figure out a sensible name for it. I do not think that there is any reason to define any kind of interface for the object that it contains.
I also expect that you will find in the (many) combinat class something which can already handle sequences. In this case, it would be better to use it rather than build a new one.
Nathann
comment:10 Changed 6 years ago by
 Cc mantepse added
comment:11 Changed 6 years ago by
Let me try to summarize the two apparently orthogonal issues here:
 provide an interface for playing with sequences. My favorite ticket attempting this is #16137, together with #16107. This is for sequences indexed by natural numbers, although possibly finite. If I recall correctly, a generalization might be provided by
Family
.
 provide a catalogue of named ("famous") sequences. I believe that #16137 should be general enough to be able to deal with just about any sequence. Is there any need to restrict to a certain type of sequence?
If the scope of this ticket is the second item, there is no conflict. However, a backend would need to be chosen...
comment:12 Changed 5 years ago by
 Dependencies set to #19896
 Description modified (diff)
comment:13 Changed 5 years ago by
 Summary changed from sequences in SageMath to catalog of sequences in SageMath
comment:14 Changed 5 years ago by
 Commit changed from fa5c40a727f7149fee86e893fc52f27455622929 to d29cbcd24b28c5bf4ababc8ff5e7b17993e28bd7
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
cc6d05c  move old sequences file to new place

1136a64  fit start on iteration

8e4a562  add a doctest in dropwhile

a544d6d  correct nasty bug in takewhile (complete rewrite of method)

3b63c47  simplify __repr__ code

8354beb  Merge branch 'extend_lazy_lists' into t/19896/sequences/homogenousseq

0330c78  Merge branch 'u/dkrenn/sequences/homogenousseq' of trac.sagemath.org:sage into u/dakrenn/sequencescatalog

d8f6707  rewrite sequence generators to new code

74f4c4a  sequences in global name space (lazy import)

d29cbcd  use new code for fibonacci and catalan and deprecate fibonacci_sequence and fibonacci_xrange

comment:15 Changed 5 years ago by
 Commit changed from d29cbcd24b28c5bf4ababc8ff5e7b17993e28bd7 to b0bb4fa7a2a17ed74d25402a29fd4143473f3580
Hello Daniel,
Could you define what you mean by sequence. Is it sequence of numbers? Rational numbers? Real numbers? An element of an infinite cartesian power? Because there also are
which is an infinite sequence of elements in
{a,b}
.Vincent