Iterate - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Fractals[LSystem]

  

Iterate

  

Formal Language Iterator

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Iterate(state, rules, iterations)

Parameters

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

Options

• 

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.

Description

• 

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.

Examples

withFractals:-LSystem:

state,rulesF,F=FF-[-F+F+F]+[+F-F-F]

state,rulesF,F=FF-[-F+F+F]+[+F-F-F]

(1)

newstateIteratestate,rules

newstateFF-[-F+F+F]+[+F-F-F]

(2)

state,rulesA,A=ABBA,B=BAAB

state,rulesA,A=ABBA,B=BAAB

(3)

newstateIteratestate,rules,3

newstateABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABBA

(4)

state,rulesABC,A=B,B=C,C=A

state,rulesABC,A=B,B=C,C=A

(5)

newstateIteratestate,rules,3

newstateABC

(6)

Compatibility

• 

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