# Linear Algebra Project; Some fractals in Maple. Kirk Partridge restart; with(plots): kochf:=(A,B)->[A,[(2/3)*A[1]+(1/3)*B[1],(2/3)*A[2]+(1/3)*B[2]], [(1/2)*(B[1]+A[1])+(1/3)*(A[2]-B[2]),(1/2)*(B[2]+A[2])+(1/3)*(B[1]-A[1])], [(1/3)*A[1]+(2/3)*B[1],(1/3)*A[2]+(2/3)*B[2]],B]; iterate:=proc(n,f) local i,points,C; points:=[[0,0],[1,0]]; for i from 1 to n do C:=zip((x,y)->[x,y], points[1..-2], points[2..-1]); points:=evalf(map(x->op(f(x[1],x[2])[1..-2]),C)); points:=[op(points),[1,0]]; od; PLOT(CURVES(points),AXESSTYLE(NONE)): end proc: #Try it with only 2 iterations iterate(2,kochf); #Now 3 iterations iterate(3,kochf); #4 Iterations iterate(4,kochf); #5 iterations iterate(5,kochf); #6 iterations iterate(6,kochf); #Example of an Orbit Diagram the presents fractal properties with(plots): f:= (x,i) -> i*x*(1-x); p0:=0.25; points:={}: for i from 2.4 by 0.02 to 4 do p:=p0: for j from 0 to 100 do p:=f(p,i): if j>40 then points:=points union {[i,p]} fi: od: od: PLOT(POINTS(op(points),SYMBOL(POINT)));