What's the difference between list and sequence (as mathematical concepts not programming point of view)?
What distinguishes between set, multiset and list is whether the order is important or not, and whether repetitions of elements is allowed:
- List: order is important and repetition is allowed
- Multiset: order is not important but repetition is allowed
- Set: order is not important and repetition is not allowed
My question is: What's exactly the difference between list and sequence? A sequence is also a collection of elements that their order is important and repetition is allowed. These two terms (list and sequence) are usually used in different domains, but I wanted to know if there is any conceptual difference between them.
I got this question when I saw the Wikipedia entry on sequence. It says: "In mathematics, a sequence is an ordered list." Since by definition, lists are ordered, the word "ordered" is redundant in "ordered list" and may be misleading for some people because they may conclude that there exist unordered lists. I wanted to correct this and write "a sequence is a list", but first wanted to make sure if there is any difference other than the domains where these terms are used.
P.S. These terms (list and sequence) may have different meanings in some programming languages, but that's not what I'm looking for here.
P.S.2 Some may say the difference is that a list is a data structure while a sequence is not. But that's just the definition of a list in Data Structures, here I'm referring to the mathematical concept of list (i.e. a collection of objects whose orders are important and repetition is allowed).
Solution 1:
Generally, I wouldn't say there's a difference, other than one term being favored over the other, in certain fields.
Mathematically, a sequence/list of elements of a set $A$ is just a function from some subset of the natural numbers, to the set $A$. Symbolically, a sequence/list is just a function $f: D \to A$, where $D \subseteq \mathbb{N}$.
Generally sequences are infinitely long; they map all of the natural numbers to elements of $A$. Most lists I encounter are finite, but there's no reason they need to be. The term sequence is almost always referring to the kind of sequence that analysts use (where the items in our sequence are points/subsets of some topological space), while everyone else has to refer to an ordered collection as a list, so people don't think we're talking about analysis.