20
$\begingroup$

Both are ordered collections that can have repeated elements. Is there a difference? Are there other terms that are used for similar concepts, and how are these terms different?

$\endgroup$
26
$\begingroup$

A sequence requires each element to be of the same type.
A tuple can have elements with different types.

You can compare it with arrays and structs in C (respectively).

For example, let's consider the DFA $(Q,F,s,\delta,\Sigma)$ quintuple. It's a tuple with the full set of states $Q$; a set of final states $F$; a starting state $s$; the state transition function $\delta$ and the alphabet $\Sigma$.

$\endgroup$
  • $\begingroup$ Is this by definition, or by convention? $\endgroup$ – Andres Riofrio Mar 21 '12 at 2:59
  • 1
    $\begingroup$ One definition of an infinite sequence is as a function from $\mathbb N$ to some target space $X$, hence every element must live in the space $X$. $\endgroup$ – dls Mar 21 '12 at 3:37
  • $\begingroup$ This is customary usage, not part of a formal definition. But it's practically forced on us by the purposes for which tuples are used. I'm thinking of a statistical data set in which each data point is a tuple in which the first component is a person's height, the second his weight, the third his income, the fourth his SAT scores, etc. The components are not measured in the same units as each other. Each data point is a tuple. $\endgroup$ – Michael Hardy Mar 21 '12 at 17:41
  • $\begingroup$ dls, but couldn't you just expand space X to include all the kinds of elements you would put in any slot? $\endgroup$ – Andres Riofrio Mar 22 '12 at 6:13
  • 3
    $\begingroup$ @ratchetfreak: Your explanation with respect to types seems to be computer language centered. Do you also have a mathematical concept of the term type in mind when distinguishing between same type and different types? Maybe you could add a helpful statement in your answer. $\endgroup$ – Markus Scheuer Jun 15 '15 at 11:43
12
$\begingroup$

A tuple is usually finite, a sequence usually infinite, but these are not hard restrictions.

$\endgroup$
  • $\begingroup$ By convention, I assume. $\endgroup$ – Andres Riofrio Mar 21 '12 at 2:59
5
$\begingroup$

Using a basic set theoretic definition, a tuple (a, b, c, ..) represents an element of the Cartesian product of sets A x B x C ...

In a vector space the tuple represents the components of a vector in terms of basis vectors.

A sequence on the other hand represents a function (usually of the natural numbers) to some set A, and strictly speaking a sequence is then a subset of N x A.

For numeric sequences, It makes sense to consider whether they are convergent. One could add the elements of a numeric sequence to get a series and consider if the corresponding series is convergent. I can't think of any equivalent concept for tuples even when they comprise numeric values.

$\endgroup$
  • $\begingroup$ This explanation jibes well with how these concepts are taught at Ohio State. $\endgroup$ – StudentsTea Mar 20 '17 at 6:05
3
$\begingroup$

The difference seems to be:

  • A psychological difference: people often think about the concepts differently.
  • A difference in the way people encode these when reducing everything to set theory. This is probably never a useful thing to do except when what you're doing is set theory.

Revised version six years later: In a sequence, the linear order in which things appear is essential information. In a tuple, the roles played by the different components are what is essential.

Thus at tuple may specify: longitude, latitude, point in time, temperature, humidity, barometric pressure. You could list the numbers in a different order and correspondingly list the those labels in a different order, and you'd still have the same tuple, but not the same sequence.

$\endgroup$
  • $\begingroup$ Could you expand on both differences? How do people tend to think of tuples that is different than how they think of sequences (is ratchet freak's answer an example of that)? How do people encode tuples and sequences using sets (Wikipedia is silent about sequences)? $\endgroup$ – Andres Riofrio Mar 20 '12 at 20:31
  • 1
    $\begingroup$ I agree with ratchet freak. $\endgroup$ – Michael Hardy Mar 21 '12 at 1:58
  • $\begingroup$ What you are saying here is basically a verification that they indeed are different, and even though you give examples of in what cases they differ, you still don't explain how they differ, which is what I think the question aims at. If you would explain how they differ, that is, how people think about the two concepts (and why these differ), and how people encode them when reducing everything to set theory (and why these differ), your answer would be a lot more satisfying. $\endgroup$ – HelloGoodbye Jan 4 '14 at 15:31
  • $\begingroup$ This cannot be right. A tuple has an order too. $\endgroup$ – JJM Driessen Mar 12 at 16:14
2
$\begingroup$

To make your life easier...just use the widely accepted difference that tuples are finite sequences. So whenever your sequence has a finite number of elements, consider it a tuple! Otherwise it is just a sequence. For me that is the distinction that I have safely used over the years....and still use!

$\endgroup$
  • $\begingroup$ Velcome to the site! $\endgroup$ – kjetil b halvorsen May 13 '14 at 10:02
0
$\begingroup$

A sequence is a kind of tuple whose elements are all of the same type —http://christian.heinleins.net/apples/sequ

I think this is a nice answer, sequence and tuple are not exclusive.

$\endgroup$
0
$\begingroup$

There is no established convention. If you attribute a property to a sequence only, you might always find some authors in some book enlisting that property for the tuples too.

However, a sequence is any function whose domain, said the index set, is an ordered set and whose values, said terms, are denoted $f_n$ rather than $f(n)$. The index set is typically $\mathbb{N}$, but may be also $\mathbb{Z}$ or an interval of $\mathbb{Z}$.

A tuple can be thought as a sequence whose index set is finite. This set is often $\{1,\ldots,n\}$, but it can be $\{m,\ldots,n\}$ too, where $m,n\in \mathbb{Z}$ and $m<n$. Tuples are frequently denoted with angle brackets: $\langle x_m,\ldots,x_n\ \rangle$.

However, tuple definitions can also have structural differences with sequences. For example they can be thought in terms of nested ordered pairs rather than as a function.

If encoding tuples as finite sequences, you may write the triple: $$ \langle x_1,x_2,x_3 \rangle = \{(1, x_1),(2, x_2),(3, x_3)\} $$ where $(a,b)$ denotes an ordered pair. For a nested tuple (using left associativity), you have: $$ \langle x_1,x_2,x_3 \rangle = \big((x_1, x_2), x_3\big) $$ Note that there is no index set here. This form is strictly related to Cartesian products and you can think of it as an element of the set: $X_1\times X_2\times X_3=(X_1\times X_2)\times X_3$. The tuple itself can be represented in terms of a Cartesian product: $$ \langle x_1,x_2,x_3 \rangle = \{x_1\}\times \{x_2\}\times \{x_3\} $$

$\endgroup$
-3
$\begingroup$

Sequences' elements are indexed with natural numbers N.

Tuples' elements are indexed with positive integers N*.

Sequence is use to define relations in general
(i.e. where the cardinality of arbitrary sets is not clearly identified).

Tuple is use to define finitary relations in particular
(i.e. where the cardinality of finite sets can be directly identified).

"While the cardinality of a finite set is just the number of its elements, extending the notion to infinite sets usually starts with defining the notion of comparison of arbitrary (in particular infinite) sets." From Wikipedia, the free encyclopedia.

$\endgroup$
  • $\begingroup$ The first set of assertions is wrong in my experience. Most mathematical literature that I've seen starts indexing from $1$ for both "sequences" and "tuples". Those with a computer science bent and those who like to use the set-theoretic definition of the non-negative integers might prefer to start from $0$ for both, not just for sequences. I don't know what the second set of assertions is supposed to mean. And the Wiki quote is irrelevant. $\endgroup$ – epimorphic Jun 14 '15 at 19:32
  • $\begingroup$ Tuples are sequences starting from 1. $\endgroup$ – Jocelyn Jun 14 '15 at 19:42
  • $\begingroup$ Sequences starting at 0 are not Tuples but simply sequences. $\endgroup$ – Jocelyn Jun 14 '15 at 19:56
  • $\begingroup$ Here (go to Section 28, "K-Tuples; Finite Sequences"), here and here we have tuples starting from 0. And en.wikipedia.org/wiki/Sequence#Indexing states "Sequences can be indexed beginning and ending from any integer." $\endgroup$ – epimorphic Jun 14 '15 at 21:09
  • $\begingroup$ "Sequences can be indexed beginning and ending from any integer." This is true for Sequences not for Tuples. Starting Tuples from 0 or 1 is a user's choice - I prefer starting tuples from 1 since the "size" is directly given from the number k for a k-tuple. $\endgroup$ – Jocelyn Jun 14 '15 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.