Fractals[LSystem]
Iterate
Formal Language Iterator
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Iterate(state, rules, iterations)
state
-
string or Vector(integer) ; the current state of the LSystem
rules
list(character=string) or table(integer=list(integer)) ; the iteration rules for the given state
iterations
nonnegint ; (optional) number of iterations to be applied
returnVector : keyword option of the form returnVector=value where value is true or false. If returnVector=true then a Vector corresponding to the ascii representation of the new state will be returned, otherwise the new state will be returned in the same format as state.
The Iterate command takes in a state and applies an iteration rule to each element, which is typically used to form an LSystem state.
The state parameter is a sequence of characters. It can be input as a string, or as Vector of integers in the range [1,255], whose values correspond to the ascii values of the characters of the sequence.
The iteration rules are defined by the rules parameter. An iteration will replace each element in the state with its corresponding iteration rule. If rules is input as list(character=string), the right-hand side of each equation in the list will replace the corresponding left hand side character at each occurrence of the character in the state. An element with no iteration rule defined will map to itself. The rules parameter may also be input as table(integer=list(integer)) (that is, a table where integers in the range [1,255] index to lists of integers in the range [1,255]). Each integer corresponds to an ASCII value and each occurrence of an ASCII value in state will get replaced by the corresponding list of integers.
The iterations parameter defines the number of iterations that will be performed. This value is 1 by default.
Iterate returns the iterated state in the same format as the input of state, unless otherwise specified by the returnVector option.
The Iterate command can be used with LSystem[LSystemPlot] to create LSystem plots.
with⁡Fractals:-LSystem:
state,rules≔F,F=FF-[-F+F+F]+[+F-F-F]
newstate≔Iterate⁡state,rules
newstate≔FF-[-F+F+F]+[+F-F-F]
state,rules≔A,A=ABBA,B=BAAB
newstate≔Iterate⁡state,rules,3
newstate≔ABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABBA
state,rules≔ABC,A=B,B=C,C=A
newstate≔ABC
The Fractals:-LSystem:-Iterate command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
See Also
LSystemExamples
LSystemPlot
Download Help Document