SubstitutionSystem
✖
SubstitutionSystem
generates a list representing the evolution of the substitution system with the specified rule from initial condition init for t steps.
is an operator form of SubstitutionSystem that corresponds to one step of evolution.
Details

- In SubstitutionSystem[rule,…], rule can be of the following forms:
-
{i1rhs1,i2rhs2,…} list substitution system {"s1"rhs1,"s2"rhs2,…} string substitution system - In list substitution systems, the rhsi can be lists of any length or can be rectangular arrays of any depth but all with the same dimensions. They can also be individual elements such as integers.
- In string substitution systems, the rhsi can be strings of any length.
- Both lists and string substitution systems can have rules that involve patterns, but every object that appears in the rhsi must have a transformation defined by the rules given.
- List substitution systems work with SparseArray objects.
- In string substitution systems, the initial condition init must be a string; in list substitution systems, it must be an array whose depth is equal to the depth of the rhsi.
- In SubstitutionSystem[rule,init,tspec], the time specification tspec can have any of the following forms:
-
t all steps 0 through t {t} a list containing only step t {t1,t2} steps t1 through t2 {t1,t2,dt} steps t1, t1+dt, … - SubstitutionSystem uses the first substitutions that apply at each step, in the same way as SequenceReplace and StringReplace.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Five steps of a string substitution system:

https://wolfram.com/xid/09a8lh2zm-cffwyh

Analogous substitution system with lists:

https://wolfram.com/xid/09a8lh2zm-zana6h

Steps in a 2D substitution system:

https://wolfram.com/xid/09a8lh2zm-pv6wsv


https://wolfram.com/xid/09a8lh2zm-4fsoto


https://wolfram.com/xid/09a8lh2zm-utt8m6

Generate a rule icon for a substitution system:

https://wolfram.com/xid/09a8lh2zm-rme7zl

Scope (16)Survey of the scope of standard use cases
1D List Substitution Systems (3)

https://wolfram.com/xid/09a8lh2zm-qv0bhd

Lists do not have to be the same length:

https://wolfram.com/xid/09a8lh2zm-64bbbw

The initial condition can be of any length:

https://wolfram.com/xid/09a8lh2zm-htphyh


https://wolfram.com/xid/09a8lh2zm-n1p9y3


https://wolfram.com/xid/09a8lh2zm-4wvwo0

Higher-Dimensional List Substitution Systems (5)

https://wolfram.com/xid/09a8lh2zm-3gpdqz


https://wolfram.com/xid/09a8lh2zm-vlomqm

Arrays do not have to be square:

https://wolfram.com/xid/09a8lh2zm-xp13c3


https://wolfram.com/xid/09a8lh2zm-fxdvpc

The right-hand side of a rule can be a SparseArray:

https://wolfram.com/xid/09a8lh2zm-ees1a

SparseArray as an initial condition:

https://wolfram.com/xid/09a8lh2zm-k21uz

String Substitution Systems (2)

https://wolfram.com/xid/09a8lh2zm-6qxf2e

Use any characters in the strings:

https://wolfram.com/xid/09a8lh2zm-ndr3ff


https://wolfram.com/xid/09a8lh2zm-6k3ruq


https://wolfram.com/xid/09a8lh2zm-441ejj


https://wolfram.com/xid/09a8lh2zm-1bao9n

Characters that do not appear in the rules are not replaced at each step:

https://wolfram.com/xid/09a8lh2zm-7c81gl

Include additional characters in rules:

https://wolfram.com/xid/09a8lh2zm-1cfeni

Time Step Specifications (6)

https://wolfram.com/xid/09a8lh2zm-kkfx7p


https://wolfram.com/xid/09a8lh2zm-o6se30


https://wolfram.com/xid/09a8lh2zm-09q4vt


https://wolfram.com/xid/09a8lh2zm-qux3yi

Apply a single step of evolution:

https://wolfram.com/xid/09a8lh2zm-txm18t


https://wolfram.com/xid/09a8lh2zm-k1oedx

Generalizations & Extensions (1)Generalized and extended use cases
Applications (3)Sample problems that can be solved with this function
Steps in constructing a Cantor set:

https://wolfram.com/xid/09a8lh2zm-89bzs2

Create an analogous 2D nested object:

https://wolfram.com/xid/09a8lh2zm-kijr6q


https://wolfram.com/xid/09a8lh2zm-f5wso5


https://wolfram.com/xid/09a8lh2zm-5dvfz3

Properties & Relations (2)Properties of the function, and connections to other functions
Approximate a Cantor staircase function:

https://wolfram.com/xid/09a8lh2zm-479ufe


https://wolfram.com/xid/09a8lh2zm-uk11kb

Generate steps in a Thue–Morse substitution system:

https://wolfram.com/xid/09a8lh2zm-57fr5g

The output at each step k is given by ThueMorse[Range[0,2^k-1]:

https://wolfram.com/xid/09a8lh2zm-7nadpv

Possible Issues (1)Common pitfalls and unexpected behavior
SubstitutionSystem always uses only the first substitution that applies:

https://wolfram.com/xid/09a8lh2zm-8bnxhf

Wolfram Research (2015), SubstitutionSystem, Wolfram Language function, https://reference.wolfram.com/language/ref/SubstitutionSystem.html.
Text
Wolfram Research (2015), SubstitutionSystem, Wolfram Language function, https://reference.wolfram.com/language/ref/SubstitutionSystem.html.
Wolfram Research (2015), SubstitutionSystem, Wolfram Language function, https://reference.wolfram.com/language/ref/SubstitutionSystem.html.
CMS
Wolfram Language. 2015. "SubstitutionSystem." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SubstitutionSystem.html.
Wolfram Language. 2015. "SubstitutionSystem." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SubstitutionSystem.html.
APA
Wolfram Language. (2015). SubstitutionSystem. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SubstitutionSystem.html
Wolfram Language. (2015). SubstitutionSystem. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SubstitutionSystem.html
BibTeX
@misc{reference.wolfram_2025_substitutionsystem, author="Wolfram Research", title="{SubstitutionSystem}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/SubstitutionSystem.html}", note=[Accessed: 15-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_substitutionsystem, organization={Wolfram Research}, title={SubstitutionSystem}, year={2015}, url={https://reference.wolfram.com/language/ref/SubstitutionSystem.html}, note=[Accessed: 15-April-2025
]}