Editing Sequence

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 4: Line 4:
 
Precisely, we may wish to define a ''sequence'' as ''an ordered collection of objects from a set <math>S</math>, not necessarily distinct, indexed by natural numbers beginning from one.'' We may also choose to represent a sequence as a function whose domain is either the subset of natural numbers <math>[1,2,...,N]</math>, or the entire set <math>\mathbb{N}</math>. The restriction that the objects be indexed by natural numbers is somewhat artificial; the requirement is really that the elements can, informally be speaking, "lined up", one after another, so that by starting somewhere and going to the next element and the next and so on, any element can eventually be reached. Thus, while sequences may be infinite, they may not be uncountably infinite, so there is no sequence that contains all the real numbers, because the real numbers are uncountable.  (Mathematically speaking, a sequence can be assigned an ordinal number from the set <math>\{0, 1, 2, ..., \omega\}</math>.) For this reason we may just as well choose to index a sequence by integers starting from zero when it is convenient to do so. The requirement that the elements belong to the same set <math>S</math> is somewhat artificial in mathematics, where we can just take <math>S</math> so that it contains all elements of our sequence anyway. But it is useful in statically typed programming languages to take <math>S</math> to be the set of all objects of a particular type, so that sequences can be uniformly processed using functions that expect or produce a certain type.
 
Precisely, we may wish to define a ''sequence'' as ''an ordered collection of objects from a set <math>S</math>, not necessarily distinct, indexed by natural numbers beginning from one.'' We may also choose to represent a sequence as a function whose domain is either the subset of natural numbers <math>[1,2,...,N]</math>, or the entire set <math>\mathbb{N}</math>. The restriction that the objects be indexed by natural numbers is somewhat artificial; the requirement is really that the elements can, informally be speaking, "lined up", one after another, so that by starting somewhere and going to the next element and the next and so on, any element can eventually be reached. Thus, while sequences may be infinite, they may not be uncountably infinite, so there is no sequence that contains all the real numbers, because the real numbers are uncountable.  (Mathematically speaking, a sequence can be assigned an ordinal number from the set <math>\{0, 1, 2, ..., \omega\}</math>.) For this reason we may just as well choose to index a sequence by integers starting from zero when it is convenient to do so. The requirement that the elements belong to the same set <math>S</math> is somewhat artificial in mathematics, where we can just take <math>S</math> so that it contains all elements of our sequence anyway. But it is useful in statically typed programming languages to take <math>S</math> to be the set of all objects of a particular type, so that sequences can be uniformly processed using functions that expect or produce a certain type.
  
The set of sequences of length <math>n</math> over the set <math>S</math> is denoted by <math>S^n</math>. The set of infinite sequences taken from the set <math>S</math> may be denoted as <math>S^{\infty}</math>, <math>S^{\mathbb{N}}</math>, or <math>S^{\omega}</math>. We shall use the notation <math>S^*</math> for <math>S^0 \cup S^1 \cup S^2 \cup ...</math>, the set of all finite sequences over the set <math>S</math>.
+
The set of sequences of length <math>n</math> over the set <math>S</math> is denoted by <math>S^n</math>. The set of infinite sequences taken from the set <math>S</math> may be denoted as either <math>S^{\infty}</math> or <math>S^{\mathbb{N}}</math>. We shall use the notation <math>S^*</math> for <math>S^0 \cup S^1 \cup S^2 \cup ... \cup S^{\infty}</math>, the set of all sequences over the set <math>S</math>.
  
 
If the set from which the elements of a sequence are taken is finite, and the sequence itself is finite, the sequence is also a [[string]]. Sequences, however, can also be infinite and have infinitely many different values for their elements; an example is the Fibonacci sequence.
 
If the set from which the elements of a sequence are taken is finite, and the sequence itself is finite, the sequence is also a [[string]]. Sequences, however, can also be infinite and have infinitely many different values for their elements; an example is the Fibonacci sequence.

Please note that all contributions to PEGWiki are considered to be released under the Attribution 3.0 Unported (see PEGWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)