# Sturmian word

In mathematics, a Sturmian word (Sturmian sequence or billiard sequence), named after Jacques Charles François Sturm, is a certain kind of infinitely long sequence of characters. Such a sequence can be generated by considering a game of English billiards on a square table. The struck ball will successively hit the vertical and horizontal edges labelled 0 and 1 generating a sequence of letters. This sequence is a Sturmian word.

## Definition

Sturmian sequences can be defined strictly in terms of their combinatoric properties or geometrically as cutting sequences for lines of irrational slope or codings for irrational rotations. They are traditionally taken to be infinite sequences on the alphabet of the two symbols 0 and 1.

### Combinatorial definitions
#### Sequences of low complexity

For an infinite sequence of symbols w, let σ(n) be the complexity function of w; i.e., σ(n) = the number of distinct contiguous subwords (factors) in w of length n. Then w is Sturmian if σ(n) = n + 1 for all n.

#### Balanced sequences

A set X of binary strings is called balanced if the Hamming weight of elements of X takes at most two distinct values. That is, for any $s\in X$ |s|$_1$ = k or |s|$_1$ = k' where |s|$_1$ is the number of 1s in s.
Let w be an infinite sequence of 0s and 1s and let ${\mathcal {L}}_{n}(w)$ denote the set of all length-n subwords of w. The sequence w is Sturmian if ${\mathcal {L}}_{n}(w)$ is balanced for all n and w is not eventually periodic.

### Geometric definitions
#### Cutting sequence of irrational

Let w be an infinite sequence of 0s and 1s. The sequence w is Sturmian if for some $x\in [0,1)$ and some irrational $\theta \in (0,\infty )$, w is realized as the cutting sequence of the line $f(t)=\theta t+x$.

#### Difference of Beatty sequences

Let w = (w$_n$) be an infinite sequence of 0s and 1s. The sequence w is Sturmian if it is the difference of non-homogeneous Beatty sequences, that is, for some $x\in [0,1)$ and some irrational $\theta \in (0,1)$
    $w_{n}=\lfloor n\theta +x\rfloor -\lfloor (n-1)\theta +x\rfloor$
for all $n$ or
    $w_{n}=\lceil n\theta +x\rceil -\lceil (n-1)\theta +x\rceil$
for all $n$.

#### Coding of irrational rotation

For $\theta \in [0,1)$, define $T_{\theta }:[0,1)\to [0,1)$ by $t\mapsto t+\theta {\bmod {1}}$. For $x\in [0,1)$ define the θ-coding of x to be the sequence (x$_n$) where
    $x_{n}={\begin{cases}1&{\text{if }}T_{\theta }^{n}(x)\in [0,\theta ),\\0&{\text{else}}.\end{cases}}$
Let w be an infinite sequence of 0s and 1s. The sequence w is Sturmian if for some $x\in [0,1)$ and some irrational $\theta \in (0,\infty )$, w is the θ-coding of x.

## Discussion
### Example

A famous example of a (standard) Sturmian word is the Fibonacci word; its slope is $1/\phi$, where $\phi$ is the golden ratio.

### Balanced aperiodic sequences

A set S of finite binary words is balanced if for each n the subset S$_n$ of words of length n has the property that the Hamming weight of the words in S$_n$ takes at most two distinct values. A balanced sequence is one for which the set of factors is balanced. A balanced sequence has at most n+1 distinct factors of length n.$^{:43}$ An aperiodic sequence is one which does not consist of a finite sequence followed by a finite cycle. An aperiodic sequence has at least n + 1 distinct factors of length n.$^{:43}$ A sequence is Sturmian if and only if it is balanced and aperiodic.$^{:43}$

### Slope and intercept

A sequence $(a_{n})_{n\in \mathbb {N} }$ over {0,1} is a Sturmian word if and only if there exist two real numbers, the slope $\alpha$ and the intercept $\rho$, with $\alpha$ irrational, such that
    $a_{n}=\lfloor \alpha (n+1)+\rho \rfloor -\lfloor \alpha n+\rho \rfloor -\lfloor \alpha \rfloor$
for all $n$.$^{:284}$$^{:152}$ Thus a Sturmian word provides a discretization of the straight line with slope $\alpha$ and intercept ρ. Without loss of generality, we can always assume $0<\alpha <1$, because for any integer k we have
    $\lfloor (\alpha +k)(n+1)+\rho \rfloor -\lfloor (\alpha +k)n+\rho \rfloor -\lfloor \alpha +k\rfloor =a_{n}.$
All the Sturmian words corresponding to the same slope $\alpha$ have the same set of factors; the word $c_{\alpha }$ corresponding to the intercept $\rho =0$ is the standard word or characteristic word of slope $\alpha$.$^{:283}$ Hence, if $0<\alpha <1$, the characteristic word $c_{\alpha }$ is the first difference of the Beatty sequence corresponding to the irrational number $\alpha$.
The standard word $c_{\alpha }$ is also the limit of a sequence of words $(s_{n})_{n\geq 0}$ defined recursively as follows:
Let $[0;d_{1}+1,d_{2},\ldots ,d_{n},\ldots ]$ be the continued fraction expansion of $\alpha$, and define
* $s_{0}=1$
* $s_{1}=0$
* $s_{n+1}=s_{n}^{d_{n}}s_{n-1}{\text{ for }}n>0$
where the product between words is just their concatenation. Every word in the sequence $(s_{n})_{n>0}$ is a prefix of the next ones, so that the sequence itself converges to an infinite word, which is $c_{\alpha }$.
The infinite sequence of words $(s_{n})_{n\geq 0}$ defined by the above recursion is called the standard sequence for the standard word $c_{\alpha }$, and the infinite sequence d = (d$_1$, d$_2$, d$_3$, ...) of nonnegative integers, with d$_1$ ≥ 0 and d$_n$ > 0 (n ≥ 2), is called its directive sequence.
A Sturmian word w over {0,1} is characteristic if and only if both 0w and 1w are Sturmian.

### Frequencies

If s is an infinite sequence word and w is a finite word, let μ$_N$(w) denote the number of occurrences of w as a factor in the prefix of s of length N + |w| − 1. If μ$_N$(w) has a limit as N→∞, we call this the frequency of w, denoted by μ(w).$^{:73}$
For a Sturmian word s, every finite factor has a frequency. The three-gap theorem implies that the factors of fixed length n have at most three distinct frequencies, and if there are three values then one is the sum of the other two.$^{:73}$

## Non-binary words

For words over an alphabet of size k greater than 2, we define a Sturmian word to be one with complexity function n + k − 1.$^{:6}$ They can be described in terms of cutting sequences for k-dimensional space.$^{:84}$ An alternative definition is as words of minimal complexity subject to not being ultimately periodic.$^{:85}$

## Associated real numbers

A real number for which the digits with respect to some fixed base form a Sturmian word is a transcendental number.$^{:64,85}$

## Sturmian endomorphisms

An endomorphism of the free monoid B$^∗$ on a 2-letter alphabet B is Sturmian if it maps every Sturmian word to a Sturmian word and locally Sturmian if it maps some Sturmian word to a Sturmian word. The Sturmian endomorphisms form a submonoid of the monoid of endomorphisms of B$^∗$.
Define endomorphisms φ and ψ of B$^∗$, where B = {0,1}, by φ(0) = 01, φ(1) = 0 and ψ(0) = 10, ψ(1) = 0. Then I, φ and ψ are Sturmian, and the Sturmian endomorphisms of B$^∗$ are precisely those endomorphisms in the submonoid of the endomorphism monoid generated by {I,φ,ψ}.
A morphism is Sturmian if and only if the image of the word 10010010100101 is a balanced sequence; that is, for each n, the Hamming weights of the subwords of length n take at most two distinct values.

## History

Although the study of Sturmian words dates back to Johann III Bernoulli (1772),$^{:295}$ it was Gustav A. Hedlund and Marston Morse in 1940 who coined the term Sturmian to refer to such sequences,$^{:295}$ in honor of the mathematician Jacques Charles François Sturm due to the relation with the Sturm comparison theorem.$^{:114}$