Home Download Help Resources Extensions FAQ References Contact Us Donate Models: Library Community Modeling Commons User Manuals: Web Printable Chinese Czech Japanese Spanish

NetLogo Models Library: 
If you download the NetLogo application, this model is included. (You can also run this model in your browser, but we don't recommend it; details here.) 
This model creates a fractallike structure consisting of stars drawn at various scales, the number of which is specified by the user. The structure is drawn by generations of turtles that draw stars at a given scale and hatch successive generations to draw new ones at smaller scales.
The FRACTALLEVEL slider controls the number of levels the structure is drawn in. For instance, a fractal level of 0 results in a single star, while a fractal level of 1 draws a star with smaller stars that begin at each of its 5 corners. This pattern is repeated as the level increases.
Click the SETUP button to initialize the structure and GO to begin drawing it.
The figure drawn embodies the most important fractal quality: selfsimilar structure at smaller scales. This means that no matter how far you "zoom in" to it, you will still see the same shape (namely, a star). The fractal level determines to how small a scale this property holds, so the greater the level the more you can "zoom in" and still see stars.
Notice that at a fractal level greater than 1, the model begins with one turtle, which hatches new turtles at each corner, and these turtles similarly hatch new ones at each of their corners as well. This behavior is made possible by a powerful mathematical technique called recursion. A process is called recursive when its workings involve "performing itself". In this case, the process performed by each turtle at each step is to draw a new side of its star and then create new turtles to perform the very same process. A helpful property of recursive processes is that the instructions are often short, because each performer is executing the same instructions. Hence the brevity of Star Fractal's procedures.
The ideas behind fractal scaling (the property of selfsimilar structures at different scales) and recursion are essentially the same. This is suggested by the fact that a recursive process is able to generate a fractallike structure, as in this model. One way to think about it is that recursion applies these ideas to processes (like NetLogo models), and fractal scaling applies them to physical or mathematical structures (like the figure drawn by Star Fractal).
Edit GO so that it's not a forever button, and/or use the speed slider to slow the model down, and note what happens during each tick. Notice that what begins as a single drawing multiplies into many drawings, each of which is at a smaller scale but proceeds exactly like the larger one that spawned it. Thus, recursion begets selfsameness at different scales.
Try the model initially with small fractal levels and work your way up to higher ones. Try to figure out how many more stars are incorporated into the figure each time the level increases by one. What kind of general rule you can come up with? That is, given a generation of turtles g, how many turtles will be in the generation g + 1? Start from g = 0. (This is a recursive rule.)
In increasing order of difficulty:
Change the color scaling so that the smaller stars are brighter than the larger ones.
Change the model so that it draws shapes other than stars. Will any shape work?
The structure that this model draws is only "fractallike", because even when you "zoom in" and look at smaller scales, the smaller stars aren't actually part of the larger ones; they're just connected to them at a vertex. An important property of fractals is that the larger structures are composed of the smaller ones, something which clearly doesn't hold here. For a tougher exercise, try changing the model so that the smaller stars (or whatever shapes are being drawn) are actually part of the larger ones, for instance by drawing them in the middle of their sides. Such a figure will be a lot less "noisy" than this one, in terms of how difficult it is to discern individual stars, and it will have different properties when you zoom in.
This model makes use of an important NetLogo command: hatch
. hatch
allows one turtle to create a new one on the same patch and give it some initial instructions. In this case, the parent turtle sets the length of the star its offspring will draw, its initial heading, and several other variables. Notice that the new turtle uses the values of its parent turtle's variables in the body of the hatch procedure.
Another useful primitive this model uses is scalecolor
. It is used to make the brightness of the color the turtles are drawing inversely proportional to the turtle's generation, so that larger stars are brighter than smaller ones (this was done to make the larger ones more visible). This code:
scalecolor red (fractallevel  generation) 1 (fractallevel + 1)
works as follows: Subtract the value of generation
from that of fractallevel
. The higher that resulting value is on the scale from 1 to (fractallevel + 1)
, the darker the shade of red the turtle will draw with.
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
Please cite the NetLogo software as:
Copyright 1999 Uri Wilensky.
This work is licensed under the Creative Commons AttributionNonCommercialShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/byncsa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECTBASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program)  grant numbers RED #9552950 and REC #9632612.
This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORKBASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs)  grant numbers REC #9814682 and REC0126227. Converted from StarLogoT to NetLogo, 2001.
(back to the NetLogo Models Library)