Iterated function systems: Koch curve

The Koch curve, drawn using Python Turtle Graphics
The Koch curve, drawn using Python Turtle Graphics

The Koch curve is a mathematical curve and one of the earliest fractal curves to have been described, appearing in a 1904 paper by the Swedish mathematician Helge von Koch.

Construction begins by taking a straight line and dividing it into three equal segments.  The middle segment is then replaced by two sides of an equilateral triangle with sides equal to the segment that was replaced.  This process is then repeated on each new segment. 

The curve in the image was created in Python Turtle Graphics and follows the Lindenmayer system or L-system where symbols in the model refer to elements of the drawing.

  • Variables : F
  • Constants : + – 
  • Axiom : F
  • Rules : F -> F+F–F+F
  • Angle : 60 degrees

Where by ‘F’ means draw forward, ‘+’ means turn left 60 degrees and ‘-‘ means turn right 60 degrees. 

Variants

Variations of the curve include using right angles and the following construction.

  • Axiom : F
  • Rules : F -> F+F-F-F+F
Variant of the Koch curve, using right angles
Variant of the Koch curve, using right angles

Koch snowflake

Placing three copies of the Koch curve around the outside of an equilateral triangle forms the boundary of the Koch snowflake, and can be constructed using the following L-system.

  • Axiom : F++F++F
  • Rules : F -> F-F++F-F
  • Angle : 60 degrees
Boundary of the Koch snowflake
Boundary of the Koch snowflake

Koch anti-snowflake

While placing three copies inside the equilateral triangle forms the boundary of the Koch anti-snowflake.

  • Axiom : F++F++F
  • Rules : F -> F+F–F+F
Boundary of the Koch anti-snowflake
Boundary of the Koch anti-snowflake

Inspiration was taken from ecademy.agnesscott.edu/~lriddle/ifs/ifs.htm

Leave a Reply

Your email address will not be published. Required fields are marked *