Home Download Resources Extensions FAQ References Contact Us Models: Library Community Modeling Commons User Manuals: Web Printable Chinese Czech Japanese |
## 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.) |

## WHAT IS IT?

Helge von Koch was a Swedish mathematician who, in 1904, introduced what is now called the Koch curve. This curve contains no straight lines which are smooth in the sense that we could see them as a carefully bent line. Rather this curve has much of the complexity which we could see in a natural coastline: folds within folds within folds and so on.

Koch's motivation for finding this curve was to provide another example for the discovery made by the German mathematician Karl Weierstrass, who in 1872 had precipitated a minor crisis in mathematics. He had described a curve that could not be differentiated (did not have a tangent) at any of its points. The ability to differentiate is central to differential calculus and for a long time it was assumed that curves have tangent lines almost everywhere.

## HOW IT WORKS

Here is a simple geometric construction of the Koch curve. Begin with a straight line. This initial object is also called the "initiator." Partition it into three equal parts. Then replace the middle third by an equilateral triangle and take away its base. This completes the basic construction step. A reduction of this figure, made of four parts, will be used in the following stages. It is called the "generator." Thus, we now repeat, taking each of the resulting line segments and partitioning them into three equal parts, and so on. The figure below illustrates this iterative process.

________________________ Step 0: "Initiator"

/\

/ \

/ \

/ \

_______/ \_______ Step 1: "Generator"

/\

__/ \__

\ /

/ \

___/\__/ \__/\___ Step 2

Self-similarity is built into the construction process. Each part of the four parts in the k-th step is again a version scaled down by the factor of 3 of the entire curve in the previous (k-1)-st step.

Let us now discuss the length of the Koch curve. After the first iteration we have a curve which is made of four line segments of the same length, after the second iteration we will have each of the four segments broken into four more segments i.e. sixteen segments and so on. After each iteration we increase the number of segments by the factor of four. If we denote the number of segments after k-steps by S(k) then mathematically:

> S(k) = 4<sup>k</sup>

Now if the initial segment had length L the length of each of the four segments obtained after the first stage would be L/3. After the second step the length of each of the sixteen segments is (L/3)/3 or L/9. Denoting the length of each segment during the k-th iteration by L(k) we may write:

> L(k) = L / (3<sup>k</sup>)

Multiplying the number of segments by the length of each segment we get the following expression for the length of the Koch curve after k steps of construction:

> L * (4/3)<sup>k</sup>

Clearly the length grows exponentially with the number of iterations so in fact the length of the entire Koch curve is infinite as is the arc length between any of its two points. It therefore might come as a surprise that the area enclosed by the Koch curve is finite; the proof of this we leave as an exercise for the reader.

## HOW TO USE IT

Reset the program by pushing the SETUP button. This will clear the world, create the initiator and initialize the globals. Press repeatedly on the STEP button. Each time you press this button the construction algorithm is iterated and you will see successive approximations of the Koch curve.

## THINGS TO NOTICE

What happens to the total length of the curve as the iteration progresses?

## THINGS TO TRY

Try running the model through several iterations. Can you see how the recursive design is changing from one iteration to another? Note that each successive iteration takes longer to compute. Depending on the speed of your machine, high-numbered iterations could take a long time!

## EXTENDING THE MODEL

You can combine three copies of the Koch curve to form a closed curve called the Koch snowflake. Try to write a program that draws this curve.

Can you think of other initiators and generators? Try and implement a few. Can you characterize which initiators and generators lead to "interesting shapes"?

## NETLOGO FEATURES

Notice how the curves are made out of many turtles, all following the same rules. Also, take note of the use of the `hatch` command to create all of the turtles by repeated "cloning" from a single seed turtle.

The model looks like it uses links, but it doesn't. To make circles and lines, it just uses a special turtle shape (a circle with a line sticking out of it).

## 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. (1998). NetLogo Koch Curve model. http://ccl.northwestern.edu/netlogo/models/KochCurve. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

* Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

## COPYRIGHT AND LICENSE

Copyright 1998 Uri Wilensky.

![CC BY-NC-SA 3.0](http://ccl.northwestern.edu/images/creativecommons/byncsa.png)

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 project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED 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: 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. Converted from StarLogoT to NetLogo, 2002.

(back to the NetLogo Models Library)