Halton Sequence
   HOME

TheInfoList



OR:

In
statistics Statistics (from German language, German: ', "description of a State (polity), state, a country") is the discipline that concerns the collection, organization, analysis, interpretation, and presentation of data. In applying statistics to a s ...
, Halton sequences are
sequence In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters. Like a set, it contains members (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is cal ...
s used to generate points in space for numerical methods such as
Monte Carlo simulations Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. The underlying concept is to use randomness to solve problems that might be det ...
. Although these sequences are
deterministic Determinism is the metaphysical view that all events within the universe (or multiverse) can occur only in one possible way. Deterministic theories throughout the history of philosophy have developed from diverse and sometimes overlapping mo ...
, they are of low discrepancy, that is, appear to be
random In common usage, randomness is the apparent or actual lack of definite pattern or predictability in information. A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. ...
for many purposes. They were first introduced in 1960 and are an example of a quasi-random number sequence. They generalize the one-dimensional
van der Corput sequence A van der Corput sequence is an example of the simplest one-dimensional low-discrepancy sequence over the unit interval; it was first described in 1935 by the Dutch mathematician J. G. van der Corput. It is constructed by reversing the base-' ...
s.


Example of Halton sequence used to generate points in (0, 1) × (0, 1) in R2

The Halton sequence is constructed according to a deterministic method that uses
coprime numbers In number theory, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equiva ...
as its bases. As a simple example, let's take one dimension of the two-dimensional Halton sequence to be based on 2 and the other dimension on 3. To generate the sequence for 2, we start by dividing the interval (0,1) in half, then in fourths, eighths, etc., which generates : , : , , : , , , , : , ,... Equivalently, the nth number of this sequence is the number n written in binary representation, inverted, and written after the decimal point. This is true for any base. As an example, to find the sixth element of the above sequence, we'd write 6 = 1*2 + 1*2 + 0*2 = 110, which can be inverted and placed after the decimal point to give 0.011 = 0*2 + 1*2 + 1*2 = . So the sequence above is the same as : 0.1, 0.01, 0.11, 0.001, 0.101, 0.011, 0.111, 0.0001, 0.1001,... To generate the sequence for 3 for the other dimension, we divide the interval (0,1) in thirds, then ninths, twenty-sevenths, etc., which generates : , , , , , , , , ,... When we pair them up, we get a sequence of points in a
unit square In mathematics, a unit square is a square whose sides have length . Often, ''the'' unit square refers specifically to the square in the Cartesian plane with corners at the four points ), , , and . Cartesian coordinates In a Cartesian coordinat ...
: : (, ), (, ), (, ), (, ), (, ), (, ), (, ), (, ), (, ). Even though standard Halton sequences perform very well in low dimensions, correlation problems have been noted between sequences generated from higher primes. For example, if we started with the primes 17 and 19, the first 16 pairs of points: (, ), (, ), (, ) ... (, ) would have perfect
linear correlation In statistics, correlation or dependence is any statistical relationship, whether causality, causal or not, between two random variables or bivariate data. Although in the broadest sense, "correlation" may indicate any type of association, in ...
. To avoid this, it is common to drop the first 20 entries, or some other predetermined quantity depending on the primes chosen. Several other methods have also been proposed. One of the most prominent solutions is the scrambled Halton sequence, which uses permutations of the coefficients used in the construction of the standard sequence. Another solution is the ''leaped Halton'', which skips points in the standard sequence. Using, e.g., only each 409th point (also other prime numbers not used in the Halton core sequence are possible), can achieve significant improvements.Kocis and Whiten, 1997


Implementation

In
pseudocode In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actio ...
: algorithm Halton-Sequence is inputs: index i base b output: result r f \larr 1 r \larr 0 while i > 0 do f \larr f/b r \larr r + f * (i \operatorname b) i \larr \lfloor i/b \rfloor return r An alternative implementation that produces subsequent numbers of a Halton sequence for base ''b'' is given in the following generator function (in
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (prog ...
). This algorithm uses only
integer An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
numbers internally, which makes it robust against round-off errors. def halton_sequence(b): """Generator function for Halton sequence.""" n, d = 0, 1 while True: x = d - n if x

1: n = 1 d *= b else: y = d // b while x <= y: y //= b n = (b + 1) * y - x yield n / d


See also

*
Constructions of low-discrepancy sequences In mathematics, a low-discrepancy sequence is a sequence with the property that for all values of N, its subsequence x_1, \ldots, x_N has a low discrepancy. Roughly speaking, the discrepancy of a sequence is low if the proportion of points in the ...


References

* * . * . * {{citation , last1=Kocis , first1=Ladislav , last2=Whiten , first2=William , title=Computational Investigations of Low-Discrepancy Sequences , journal=ACM Transactions on Mathematical Software , volume=23 , year=1997 , issue=2 , doi=10.1145/264029.264064 , pages=266–296 , s2cid=183263 , doi-access=free . Low-discrepancy sequences Sequences and series Articles with example pseudocode Articles with example Python (programming language) code