For this project you will need familiarity with the commands:
plot | proc | display |
for...from...to...do...od | ||
? |
In addition, you will need to use the style and numpoints options of plot and the two argument form of arctan.
r3 := sqrt(3); snow_0 := [[0,r3/6], [1/2,r3*2/3], [1,r3/6], [0,r3/6]]: plot(snow_0, scaling=constrained);
Remove the middle third of each side and insert two sides of a smaller equilateral triangle as shown below.
snow_1 := [[0,r3/6], [1/6,r3/3], [0,r3/2], [1/3, r3/2], [1/2, 2*r3/3], [2/3, r3/2], [1, r3/2], [5/6, r3/3], [1,r3/6], [2/3,r3/6], [1/2,0], [1/3,r3/6], [0,r3/6]]: plot(snow_1, scaling=constrained);
There are two observations to make:
I. Calculate:
The second iteration is shown below. Try it---if you're up to the typing (or use copy and paste ).
snow_2 := [ [0, r3/6], [1/18,r3*2/9], [0, r3*5/18], [1/9, r3*5/18], [1/6, r3/3], [1/9, r3*7/18], [0, r3*7/18], [1/18, r3*4/9], [0, r3/2], [1/9, r3/2], [1/6, r3*5/9], [2/9, r3/2], [1/3, r3/2], [7/18,r3*5/9], [1/3, r3*11/18], [4/9, r3*11/18], [1/2, r3*2/3], [5/9, r3*11/18], [2/3, r3*11/18], [11/18,r3*5/9], [2/3, r3/2], [7/9, r3/2], [5/6, r3*5/9], [8/9, r3/2], [1, r3/2], [17/18,r3*4/9], [1, r3*7/18], [8/9, r3*7/18], [5/6, r3/3], [8/9, r3*5/18], [1, r3*5/18], [17/18,r3*2/9], [1, r3/6], [8/9, r3/6], [5/6, r3/9], [7/9, r3/6], [2/3, r3/6], [11/18,r3/9], [2/3, r3/18], [5/9, r3/18], [1/2, 0], [4/9, r3/18], [1/3, r3/18], [7/18, r3/9], [1/3, r3/6], [2/9, r3/6], [1/6, r3/9], [1/9, r3/6], [0, r3/6] ]: plot(snow_2, scaling=constrained);
For those who aren't up to the typing, a printout of a Maple session with the routines for generating and animating Koch snowflakes follows.
Note: You must use Maple V Release 2 or a newer version to use the routines below. If you have an earlier version then jump to the bottom of this section and click on the QuickTime movie.
#################################### ## Animating the Koch Snowflake ## ## (requires Maple V Release 2) ## ## (or newer version ) ## #################################### # setup plotting plots[setoptions](axes=none, scaling=constrained); ############################################## ## A proc to "connect the dots" to plot a path ## (mainly for Maple V Release 2) ## graph := proc() local pts; pts := [args]; plot(pts, style= LINE, numpoints=nargs) end: ################################################## ## Rotate point A about the origin through angle p ## rotate := proc(a, p); [p[1]*cos(a)-p[2]*sin(a), p[1]*sin(a)+p[2]*cos(a)]; end: ########################################################### ## Insert three points of a Koch triangle between pts A & B ## Koch := proc(A, B) local pA, pB, pC, dx, dy, len, alpha, delta; pA := [(2/3*A[1]+1/3*B[1]), (2/3*A[2]+1/3*B[2])]; dx := B[1]-A[1]; dy := B[2]-A[2]; len := sqrt(dx^2+dy^2)/3; alpha := arctan(dy, dx); # Note the comma delta := rotate(alpha, [len/2, sqrt(3)*len/2]); pB := [(pA[1]+delta[1]), (pA[2]+delta[2])]; pC := [(1/3*A[1]+2/3*B[1]) ,(1/3*A[2]+2/3*B[2])]; pA, pB, pC; end: ####################################################### ## Take a path and iterate with inserted Koch triangles ## path := proc() local pa, pth, i; pa := args; pth := pa[1]; for i from 2 to nops([pa]) do pth := (pth, Koch(pa[i-1], pa[i]), pa[i]); od; pth: end: ## Start with an equilateral triangle # s := sqrt(3)/6: p := [0, s], [1/2, 4*s], [1, s], [0, s]: snow.0 := graph(p): ## Now begin the iterations - go up to 5 N := 5: for i from 1 to N do p := path(p); snow.i := graph(p); od: ## and animate plots[display]([snow.(0..N)], insequence=true); #################################################
For Maple 5.0 users Look at the QuickTime movie (on a Macintosh).
II. Calculate:
For each successive iteration, repeat the procedure of inserting smaller and smaller triangles as seen in the figure below.
| ||
The First Three Iterations |
How many line segments are in the n -th iteration's curve?
The Koch Snowflake is the limit curve of this procedure. The snowflake has the remarkable property that at no point does the curve possess a tangent line. To see the curve develop, run the animation using the Maple procedures given in the listing above in this project.
III. Determine: