Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate an L-system
ResourceFunction["LSystem"][rules,init,t,θ] returns an Association containing the word and the branches generated after executing the L-system represented by rules from initial word init for t steps, with movement specified by the angle θ. |
+ | increase the current angle by θ |
- | decrease the current angle by θ |
[ | start a new branch |
] | close the current branch |
"InitialAngle" | 90 | initial angle in degrees from which the next points will be generated |
"InitialPoint" | {0,0} | intial point from which the next points will be generated |
"MoveLength" | 1 | distance of a new point from the previous one |
Run a simple L-system for one iteration:
In[1]:= | ![]() |
Out[1]= | ![]() |
Because this L-system doesn't use brackets, it contains only one branch:
In[2]:= | ![]() |
Out[2]= | ![]() |
Run a simple L-system with brackets for one iteration:
In[3]:= | ![]() |
Out[3]= | ![]() |
Because this L-system uses brackets, it contains multiple branches:
In[4]:= | ![]() |
Out[4]= | ![]() |
Show a fractal:
In[5]:= | ![]() |
Out[5]= | ![]() |
Show a tree:
In[6]:= | ![]() |
Out[6]= | ![]() |
Display a variety of fractals:
In[7]:= | ![]() |
Out[7]= | ![]() |
Plot different trees:
In[8]:= | ![]() |
Out[8]= | ![]() |
Show the effect of changing the initial angle:
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
Show the effect of changing the initial point:
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
Show the effect of using different values for "MoveLength":
In[13]:= | ![]() |
Out[13]= | ![]() |
Show the step-by-step creation of the dragon curve:
In[14]:= | ![]() |
In[15]:= | ![]() |
Out[15]= | ![]() |
Show the step-by-step creation of the Peano curve:
In[16]:= | ![]() |
In[17]:= | ![]() |
Out[17]= | ![]() |
Create a colorful tree:
In[18]:= | ![]() |
Out[18]= | ![]() |
Create a tree with green leaves:
In[19]:= | ![]() |
Out[19]= | ![]() |
Create a colorful plant with leaves:
In[20]:= | ![]() |
Out[20]= | ![]() |
Create a colorful tree with grapes:
In[21]:= | ![]() |
Out[21]= | ![]() |
The execution time tends to grow very fast according to the number of iterations:
In[22]:= | ![]() |
Out[22]= | ![]() |
In[23]:= | ![]() |
Out[23]= | ![]() |
An animated orange tree:
In[24]:= | ![]() |
In[25]:= | ![]() |
In[26]:= | ![]() |
Out[26]= | ![]() |
Generate a snowflake:
In[27]:= | ![]() |
Out[27]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License