 Home
Help
Resources
Extensions
FAQ
NetLogo Publications
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish # Random Walk 360 If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web

## WHAT IS IT?

In this model the turtles engage in a "random walk." Each turtle walks one step away from its current location in a different random direction at each clock tick. This movement is known as walking a 360-gon "lattice." A lattice is a set of points on the plane (or in space) that form a grid on which turtles walk.

As the simulation continues, one can expect the turtles to become more spread out. Will they ever return home (to their point of origin at 0 0)? Observe the kinds of patterns that develop as the turtles move.

## HOW TO USE IT

General Settings

Use the NUM-TURTLES slider to select how many turtles will participate in the random walk.

Use the STEP-SIZE slider to decide how far from its current location a turtle will move on each step.

How steps are implemented: if STEP-SIZE is set to n it will add (n * cos(theta)) to its current xcor value and it will add (n * sin(theta)) to its current ycor value. It will have moved n patch units from its current location. (Why?)

Each of the above movements would be considered a single "pace."

### Distance Rings

Set DRAW-RINGS to ON to draw the x-axis, y-axis, and a set of concentric circles about the point (0 0). This switch must be set prior to pressing SETUP.

Use the RING-RADIUS slider to set the incremental distance between the distance rings.

### Plots

"Average Distance" - measures the average distance over all turtles, from home (the origin at 0,0) to their current coordinates.

"Average X-Distance" - measures the average distance over all turtles along the x-axis away from the origin (x = 0).

"Std.Dev. of Distance" - measures the standard deviation of all turtles' true distance from home to their current position. NetLogo's standard deviation primitive is used.

Note that xcor and ycor values are stored in such a way that turtles are tracked even if they move outside the boundaries of the world. These 'out of bounds' values are used to measure distances. They are stored at turtle variable xc (for xcor) and yc (for ycor).

Distances are either zero or positive.

### Buttons

Press SETUP when all of the above selections have been made. This will create the selected number of turtles at the bottom center of the world.

Press GO-ONCE to make the turtles move one pace.

Press GO to make the turtles move continuously. To stop the turtles, press the GO button again.

## THINGS TO NOTICE

Try starting with 500 turtles with a step size of 1. If you want to show distance rings, try setting the radius increment to 20.

Press SETUP then press GO.

The turtles all start at (0,0) (home).

Think about how you would define an 'average' turtle and an 'average' walk.

Where would you expect an average turtle to end up at a given time? Why?

Will all turtles eventually return home? If so, how many paces would you expect a turtle to travel before it returned to home? Why?

What kinds of calculations or measurements would you use in trying to answer these questions?

Two characteristics of the plots you see are their smoothness and their slope.

To think about smoothness of the plots, notice how much the lines move up and down over time.

To think about slope of the plots, consider whether the plot appears to be going 'uphill' or 'downhill' and consider whether the 'hill' is steep or flat.

What do you notice about the smoothness and slope of the plots? - Are they smooth? Why or why not? - Are they steep? Why or why not? - For a given plot, is its steepness the same at the far edges and at the center? Why or why not?

Does the plot have any symmetry? Would you expect it to? Why?

Does a single line plot ever change between positive and negative slopes? Why or why not? If it does, what does that mean?

## THINGS TO TRY

Try to answer the following questions before running the simulations. Record your predictions. Compare your predicted results with the actual results. - What reasoning led you to correct predictions? - What assumptions that you made need to be revised?

Try different numbers of turtles while keeping all other slider values the same. - What happens to the plot's smoothness and slope when the number of turtles is increased? - What happens to the plot's smoothness and slope when the number of turtles is decreased? - Does the simulation finish faster or slower than the first model?

Try different numbers of steps while keeping all other slider values the same. - What happens to the plot's smoothness and slope when the number of steps is increased? - What happens to the plot's smoothness and slope when the number of turtles is decreased? - Does the simulation finish faster or slower than the first model?

How do your answers to the above questions compare to the average values calculated for all turtles in a given simulation?

## EXTENDING THE MODEL

In this simulation, turtles can only move based on integer values of heading. Change the model so that any value of heading between 0 and 360 degrees is possible.

Does this change the amount of time it would take for a turtle to return home? How? Why?

One of the plots measures the average x-distance away from the origin over all turtles. Obviously, it could have measured the y-distance instead. Watch the plot under one run of the model, and then change the procedure so that it measures y-distance. How do the plots differ?

Create a new monitor called home-turtles. Have it display the number of turtles at (or very near) home. Create a plot to display this information.

## NETLOGO FEATURES

Since NetLogo does not allow the world to be unbounded, the special code below is needed for this model to simulate the behavior, instead of stopping at the edge of the world the turtles hide themselves when they have moved outside the world.

``````set xc xc + (step-size * dx)
set yc yc + (step-size * dy)
; hide turtles who have moved out of the world
ifelse patch-at (xc - xcor) (yc - ycor) = nobody
[ ht ]
[ st
set xcor xc
set ycor yc ]
set dist sqrt (xc * xc + yc * yc)
``````

Stamping of turtle shapes is used to draw a polar coordinate grid in the drawing layer.

## HOW TO CITE

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: 