# SubstitutionSystem

SubstitutionSystem[rule,init,t]

generates a list representing the evolution of the substitution system with the specified rule from initial condition init for t steps.

SubstitutionSystem[rule,init]

gives the result of evolving init for one step.

SubstitutionSystem[rule]

is an operator form of SubstitutionSystem that corresponds to one step of evolution.

# Details

• In SubstitutionSystem[rule,], rule can be of the following forms:
•  {i1rhs1,i2rhs2,…} 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 all

## Basic Examples(3)

Five steps of a string substitution system:

Analogous substitution system with lists:

Steps in a 2D substitution system:

Give the fourth step only:

Alternative form:

Generate a rule icon for a substitution system:

## Scope(16)

#### 1D List Substitution Systems(3)

Lists do not have to be the same length:

The initial condition can be of any length:

Rules can involve patterns:

#### Higher-Dimensional List Substitution Systems(5)

Arrays do not have to be square:

Arrays can have any depth:

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

SparseArray as an initial condition:

#### String Substitution Systems(2)

A string substitution system:

Use any characters in the strings:

Arrange output in a column:

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

Include additional characters in rules:

#### Time Step Specifications(6)

Steps 0 through 5:

Step 5 only:

Steps 3 through 5:

Odd-numbered steps:

Apply a single step of evolution:

Apply in operator form:

## Generalizations & Extensions(1)

Set up neighbor-dependent string rules; rules are applied in the order given:

## Applications(3)

Steps in constructing a Cantor set:

Create an analogous 2D nested object:

3D Menger sponge:

Generate a "C curve" fractal:

## Properties & Relations(2)

Approximate a Cantor staircase function:

Generate steps in a ThueMorse substitution system:

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

## Possible Issues(1)

SubstitutionSystem always uses only the first substitution that applies:

## Neat Examples(2)

3D substitution system based on the LeviCivita tensor:

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.

#### CMS

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

#### BibTeX

@misc{reference.wolfram_2022_substitutionsystem, author="Wolfram Research", title="{SubstitutionSystem}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/SubstitutionSystem.html}", note=[Accessed: 07-June-2023 ]}

#### BibLaTeX

@online{reference.wolfram_2022_substitutionsystem, organization={Wolfram Research}, title={SubstitutionSystem}, year={2015}, url={https://reference.wolfram.com/language/ref/SubstitutionSystem.html}, note=[Accessed: 07-June-2023 ]}