NetLogo Programming Exercises

Author: Alan G. Isaac
Organization: American University
Copyright: 2016

The following exercises are meant to help you test and develop your understanding of NetLogo as a programming language.

Function Plotting

To make a line chart of a univariate function, we need a function and collection of points from its domain.

  1. Create the integer interval [0..100]. (How many points is that?)
  2. Scale your points so that they lie in the real interval [0, 1].
  3. Treat your new points as the domain of the function xx*x. Produce the corresponding list of function values.
  4. Produce a list of pairs (x, f(x)) for this function.
  1. Make a line chart of this list of pairs.

Hints:

Do not look at these hints unless you need to! If you need the hints, you need to review the concepts.

  1. Use n-values.
  2. Use map.
  3. Use map.
  4. Use map with two arguments. (Read the documentation carefully.)
  5. Use foreach, plotxy, first, and last.