Tree Simple

Tree Simple preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

mathematics 

Tagged by Reuven M. Lerner over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 486 times • Downloaded 70 times • Run 2 times
Download the 'Tree Simple' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This program draws special types of pictures called fractals. A fractal is a shape that is self-similar - that is, it looks the same no matter how closely you zoom in or out. For instance, a tree can be thought of as a fractal since if you look at the tree as a whole, you see a stick, that is to say the trunk, with branches coming out of it. Then if you look at a smaller portion of it, say a branch, you see a similar thing, namely, a stick with branches coming out of it.

HOW TO USE IT

Perhaps the best way to start with this program is by looking at an example of a fractal. In the "Interface" tab, press the SETUP button to set up a fractal that draws a tree. Then press the GO button and watch it draw.

You can also have the fractal drawn one step a time. Once you click the SETUP button, instead of clicking the GO button, click on the GO ONCE button. This draws the fractal by drawing one iteration of the fractal per click as opposed to continuously, like the GO button.

If you don't like the location of the fractal you can change it by modifying the value of the following sliders:
The INIT-X slider sets the initial x coordinate of the first turtle. It changes the horizontal starting location of the original turtle.
The INIT-Y slider sets the initial y coordinate of the first turtle. It changes the vertical starting location of the original turtle.

If you don't like the color scheme of the fractal you can change it by modifying the value of the following sliders:
The INIT-COLOR slider sets the initial color of the first turtle.
The value of the COLOR-INC slider is added to the turtles color anytime a new turtle hatches.

The NUM TURTLES monitor indicates how many turtles are currently alive.

It might be best to limit the number of iterations to about 8 or 9 of any particular fractal. If you go much more than that, NetLogo might run out of memory.

THINGS TO NOTICE

Notice the self-similarity of the fractal at each iteration. What if one were to perform an infinite number of iterations? Would looking at any piece up close look any different than looking at the whole? Also notice how the number of turtles in each of the example is multiplied by some number at each iteration. Does this make sense? Try to figure out the number of turtles at some arbitrary step n.

THINGS TO TRY

Now that you have played around with settings for the example provided, why not try making your own tree fractals. Use NetLogo commands to make your own fractals that look like trees. Then change the initial color and color increment values to make the fractal more interesting to look at.

EXTENDING THE MODEL

Try adding switches or sliders such as max-increment-random-length or min-increment-random-degree or random-length that could impose a random factor to the movement of the turtles. The use of these plus the NetLogo primitive random would increase the realism in a fractal. This would be especially useful in drawing realistic trees since branches are not spaced uniformly on a tree nor do they all branch from the trunk at the same angle.

Pick up a book on fractals or search on the internet to find fractals that are interesting and try to create them. Also try to find different types of fractals such as L-System Fractals. You may find some resources below.

Try starting with more than just one turtle, in a different location or heading, and see how that can affect the fractals that you have made. Does it ruin them or does it make them more interesting and complex?

Try to make a realistic forest. Does this require vastly different commands from making a realistic tree?

NETLOGO FEATURES

Notice the use of agentsets to make some of the commands only affect certain turtles. For example, the reporter with is used to isolate non-new turtles and have the rules only affect them.

Also notice how the fractals are formed using several agents following the same rules through the use of the hatch primitive which makes it so simple to generate fractals like a tree.

RELATED MODELS

L-System Fractals

CREDITS AND REFERENCES

This site offers an introduction to fractals, including L-system fractals as well as others: http://www.cs.wpi.edu/~matt/courses/cs563/talks/cbyrd/pres1.html

The Fractal Geometry of Nature by Benoit Mandelbrot

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. (2001). NetLogo Tree Simple model. http://ccl.northwestern.edu/netlogo/models/TreeSimple. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 2001 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/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 projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED 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 REC-0126227.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

turtles-own
[ new? ]

; setup the initial turtle and its properties

to setup
  clear-all
  crt 1
  [
    set shape "line"
    set color init-color
    setxy init-x init-y
    set heading 0
    pd
  ]
  reset-ticks
end 

; have all non-new turtles draw an iteration of the tree

to go
  ask turtles
  [
    set new? false
    pen-down
  ]
; here are the commands to draw the tree
  ask turtles with [ not new? ]
  [
    fd 4
    rt 15
    fd 8
    hatch 1 [ set new? true ]
    set color (color + color-inc)
    rt 180
    jump 8
    rt 180
    lt 15
    fd 4
    lt 15
    hatch 1 [ set new? true ]
    set color (color + color-inc)
    fd 8
    die
  ]
  tick
end 


; Copyright 2001 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Tree Simple Download this version

Attached files

File Type Description Last updated
Tree Simple.png preview Preview for 'Tree Simple' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.