The boundary of the Koch Snowflake constructed by Helge Von Koch in 1904 is the union of three congruent self-similar fractals. Each third of the snowflake is constructed by starting with one side of an equilateral triangle and performing an iterative process. The following cell defines a function called Snowflake that illustrates the stages in this iterative process.
Input := (* Given a non-negative integer n, the function Snowflake generates the nth level approximation to the Koch Snowflake. Code from the Notices of the AMS Vol.39 #7 Sept 92, page 709 *) Clear[n,Snowflake,start,finish,doline] Snowflake[n_Integer?NonNegative]:= Show[Graphics[ Nest[ (#1/.Line[{start_,finish_}] :>doline[start, finish]) &, {Line[{{0,0},{1/2,Sqrt[3]/2}}], Line[{{1/2,Sqrt[3]/2},{1,0}}], Line[{{1,0},{0,0}}]}, n]], AspectRatio->Automatic,PlotRange->All] doline[start_,finish_]:= Module[{vec,normal}, vec=finish-start; normal=Reverse[vec] {-1,1} Sqrt[3]/6; {Line[{start,start + vec/3}], Line[{start + vec/3,start + vec/2 + normal}], Line[{start + vec/2 + normal, start + 2 vec/3}], Line[{start + 2 vec/3, finish}] } ];
The following cell generates a picture of the initial stage of the snowflake's construction.
Input := Snowflake[0]
Output = -Graphics-
At the next stage of the snowflake's construction, we remove the middle one-third of each side and add two new segments having the same length as the part that was removed. (See the picture generated by the cell below).
Input := Snowflake[1]
Output = -Graphics-
At each stage, we replace the middle-third of every segment in the previous stage by two new segments, creating a "bump" on the original segment. Evaluate the following cells to see the next four stages in the construction of the Koch Snowflake. Warning: Level 5 of the snowflake took me 3 minutes, 22 seconds to generate on an SGI Indy.
Input := Snowflake[2]
Output = -Graphics-
Input := Snowflake[3]
Output = -Graphics-
Input := Snowflake[4]
Output = -Graphics-
Input := Snowflake[5]
Output = -Graphics-