In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters.
The number of elements (possibly infinite) is called the length of the sequence.
In particular, sequences are the basis for series, which are important in differential equations and analysis.
For instance, the infinite sequence of positive odd integers is written as (1, 3, 5, 7, ...).
One such notation is to write down a general formula for computing the nth term as a function of n, enclose it in parentheses, and include a subscript indicating the set of values that n can take.
It is often useful to combine this notation with the technique of treating the elements of a sequence as individual variables.
For example: One can consider multiple sequences at the same time by using different variables; e.g.
In cases where the set of indexing numbers is understood, the subscripts and superscripts are often left off.
In these cases, the index set may be implied by a listing of the first few abstract elements.
For instance, the sequence of squares of odd numbers could be denoted in any of the following ways.
Moreover, the subscripts and superscripts could have been left off in the third, fourth, and fifth notations, if the indexing set was understood to be the natural numbers.
To define a sequence by recursion, one needs a rule, called recurrence relation to construct each element in terms of the ones before it.
The Fibonacci sequence is a simple classical example, defined by the recurrence relation with initial terms
as a function of n. Nevertheless, holonomic sequences play an important role in various areas of mathematics.
For example, many special functions have a Taylor series whose sequence of coefficients is holonomic.
The use of the recurrence relation allows a fast computation of values of such special functions.
In this article, a sequence is formally defined as a function whose domain is an interval of integers.
However, many authors use a narrower definition by requiring the domain of a sequence to be the set of natural numbers.
In some contexts, to shorten exposition, the codomain of the sequence is fixed by context, for example by requiring it to be the set R of real numbers,[5] the set C of complex numbers,[6] or a topological space.
Sequences and their limits (see below) are important concepts for studying topological spaces.
A net is a function from a (possibly uncountable) directed set to a topological space.
is a sequence of points in a metric space, then the formula can be used to define convergence, if the expression
Sequences play an important role in topology, especially in the study of metric spaces.
The canonical projections are the maps pi : X → Xi defined by the equation
The set of all such functions is naturally identified with the set of all possible infinite sequences with elements in K, and can be turned into a vector space under the operations of pointwise addition of functions and pointwise scalar multiplication.
These are special cases of Lp spaces for the counting measure on the set of natural numbers.
Specifically, the set of F-valued sequences (where F is a field) is a function space (in fact, a product space) of F-valued functions over the set of natural numbers.
Infinite sequences of digits (or characters) drawn from a finite alphabet are of particular interest in theoretical computer science.
They are often referred to simply as sequences or streams, as opposed to finite strings.
The set C = {0, 1}∞ of all infinite binary sequences is sometimes called the Cantor space.