StringTools
ThueMorse
generate a Thue-Morse string
Calling Sequence
Parameters
Description
Examples
ThueMorse( n, a, b )
n
-
non-negative integer; specifies that ThueMorse must return then nth Thue-Morse string
a
character; (optional) first symbol to use
b
character; (optional) second symbol to use
The ThueMorse(n, a, b) command generates the length-n prefix of the (infinite) Thue-Morse string, with initial values a and b. The arguments after the first are optional, and default to the strings 0 and 1, respectively.
The Thue-Morse string is the infinite string defined to be the fixed point of the iterated semigroup morphism 0−>01,1−>10 on the free semigroup generated by 0,1.
A recursive definition of the Thue-Morse sequence is as follows. t0=0, t2⁢n=tn, t1+2⁢n=1−tn.
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
with⁡StringTools:
seq⁡ThueMorse⁡n,n=0..5
,0,01,011,0110,01101
ThueMorse⁡5,a,b
abbab
ThueMorse⁡100
0110100110010110100101100110100110010110011010010110100110010110100101100110100101101001100101100110
See Also
string
Download Help Document