 Fractals[LSystem] - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Mathematics : Fractals : Lindenmayer System : Fractals/LSystem/LSystemExamples

Fractals[LSystem]

 LSystemExamples
 Lindenmayer System Examples

Description

 • LSystemExamples is a package that exports 12 examples of Lindenmayer Systems that are ready for use with the LSystemPlot, and Iterate commands
 • The 12 exported Lindenmayer Systems:
 – $\mathrm{SierpinskiTriangle}$
 – $\mathrm{Tree}$
 – $\mathrm{KochCurve}$
 – $\mathrm{FractalPlant}$
 – $\mathrm{DragonCurve}$
 – $\mathrm{GosperCurve}$
 – $\mathrm{Box}$
 – $\mathrm{Seaweed}$
 – $\mathrm{Crystal}$
 – $\mathrm{Rings}$
 – $\mathrm{Carpet}$
 – $\mathrm{PenroseTiling}$
 • Each example is itself a module with four exports:
 $\mathrm{IterationRules}$, $\mathrm{InitialState}$, $\mathrm{PlottingConstants}$, and  $\mathrm{InitialAngle}$
 • $\mathrm{IterationRules}$ defines the rules of the LSystem Iteration process
 • $\mathrm{InitialState}$ defines the Initial String of the LSystem
 • $\mathrm{PlottingConstants}$ defines the plotting procedures that each character represents
 • $\mathrm{InitialAngle}$ defines the initial plotting angle of the LSystem
 • These exports can be given to LSystemPlot, and Iterate directly as input (for the respective parameters).
 • LSystemExamples also exports three functions:
 $\mathrm{PlotExample}$, $\mathrm{ViewStateAsString}$, $\mathrm{ViewRulesAsStrings}$.
 • $\mathrm{PlotExample}$ accepts an exported LSystem example and an optional positive integer (the default value is 1) to specify how many times the iteration rule will be applied to the initial state. $\mathrm{PlotExample}$ returns a plot of the LSystem.
 • $\mathrm{ViewStateAsString}$ accepts an LSystem state and prints the string representing the state.
 • $\mathrm{ViewRulesAsStrings}$ accepts a table of LSystem rules and prints the rules as a list(string=string).

Examples

 > $\mathrm{with}\left(\mathrm{Fractals}:-\mathrm{LSystem}\right):$
 > $\mathrm{with}\left(\mathrm{LSystemExamples}\right):$
 > $\mathrm{LSKoch}≔\mathrm{KochCurve}$
 ${\mathrm{LSKoch}}{≔}{\mathrm{KochCurve}}$ (1)
 > $\mathrm{ViewStateAsString}\left(\mathrm{LSKoch}:-\mathrm{InitialState}\right)$
 ${"F"}$ (2)
 > $\mathrm{ViewRulesAsStrings}\left(\mathrm{LSKoch}:-\mathrm{IterationRules}\right)$
 $\left[{"F"}{=}{"F+F-F-F+F"}\right]$ (3)
 > $\mathrm{PlotExample}\left(\mathrm{LSKoch}\right)$ > $\mathrm{PlotExample}\left(\mathrm{LSKoch},6\right)$ > $\mathrm{LSGosperCurve}≔\mathrm{GosperCurve}$
 ${\mathrm{LSGosperCurve}}{≔}{\mathrm{GosperCurve}}$ (4)
 > $\mathrm{ViewStateAsString}\left(\mathrm{LSGosperCurve}:-\mathrm{InitialState}\right)$
 ${"X"}$ (5)
 > $\mathrm{ViewRulesAsStrings}\left(\mathrm{LSGosperCurve}:-\mathrm{IterationRules}\right)$
 $\left[{"Y"}{=}{"+X-YY--Y-X++X+Y"}{,}{"X"}{=}{"X-Y--Y+X++XX+Y-"}\right]$ (6)
 > $\mathrm{PlotExample}\left(\mathrm{LSGosperCurve}\right)$ > $\mathrm{PlotExample}\left(\mathrm{LSGosperCurve},5\right)$ Compatibility

 • The Fractals:-LSystem:-LSystemExamples package was introduced in Maple 2015.
 • For more information on Maple 2015 changes, see Updates in Maple 2015.