# Koch Curve

### 1 collaborator

Uri Wilensky (Author)

### Tags

mathematics

Tagged by Reuven M. Lerner over 10 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 315 times • Downloaded 49 times • Run 0 times
Download 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?

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) = 4k

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 / (3k)

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)k

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 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 1998 Uri Wilensky.

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.

## Comments and Questions

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

Click to Run Model

```;; We use the built-in turtle variable SIZE to make the line
;; segment have the appropriate length.  Because the "segment"
;; shape extends from the center of the turtle to its edge,
;; rather than from edge to edge, we need to set the size
;; to twice the segment length in order for the turtles to
;; appear the right size.  This is why we multiple or divide
;; by two in several places in the following code.

to setup
clear-all
set-default-shape turtles "segment"
create-turtles 1
[ setxy min-pxcor       ;; start turtle in lower left corner
min-pycor
set heading 90                ;; facing right
set color blue
set size world-width * 2 ]
reset-ticks
end

to step
ask turtles [ iterate ]
tick
end

to iterate
set size size / 3
hatch 1
fd size / 2
lt 60
hatch 1
fd size / 2
rt 120
hatch 1
fd size / 2
lt 60
end

; Copyright 1998 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 10 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 11 years ago Updated version tag Download this version
Uri Wilensky about 11 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 12 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 13 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 13 years ago Koch Curve Download this version

## Attached files

File Type Description Last updated
Koch Curve.png preview Preview for 'Koch Curve' over 10 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.