{VERSION 5 0 "IBM INTEL LINUX" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 39 "Restart Map le and clear any definitions" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "rest art:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 25 "Load the p lotting package" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(plots):" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 32 "Procedure for plot ting a polygon" }}{PARA 0 "" 0 "" {TEXT -1 105 " A polygon is a list of points [x,y]\n In any procedure, nargs is the number of argument s passed to it" }}{PARA 0 "" 0 "" {TEXT -1 41 " args is the list of arguments passed." }}{PARA 0 "" 0 "" {TEXT -1 64 " So args[1] is th e first argument, args[2] is the second etc.\n" }}{PARA 0 "" 0 "" {TEXT -1 60 " A procedure can have any number of arguments passed to it" }}{PARA 0 "" 0 "" {TEXT -1 63 " as long as we have at least as \+ many as are explicitly named." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 79 " Below, if you pass a color as a second argument, the procedure can use it in" }}{PARA 0 "" 0 "" {TEXT -1 24 " the plotting command." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 129 "polyp lot:=proc(poly)\n if nargs > 1 then\n polygonplot(poly,color= args[2]):\n else\n polygonplot(poly)\n end:\nend:" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 50 "Procedure for a reg ular polygon with side length 1" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 258 "regular1:=proc(n,theta)\n local a, b, i, poly, r;\n a:=2*Pi/n;\n \+ b:=theta*Pi/180;\n r:=1/(2*sin(a/2));\n poly:=[[r*cos(b),r*sin(b )]];\n for i from 1 to n-1 do\n b:=b+a;\n poly:=[op(poly ), [r*cos(b),r*sin(b)]];\n end:\n RETURN(poly);\nend: " }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 24 "The pieces of our t iling" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "dodec:=regular1(12,15):" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "sqr:=regular1(4,45):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "hex:=regular1(6,30):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "polyplot(hex,green);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 57 "The distance betwee n neighboring dodecagons in the tiling" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "r:=1+cot(Pi/12):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 " evalf(r);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 52 "These are the translations that generate our tiling." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "T1:=x->[x[1],x[2]+r]:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "T2:=x->[x[1]+r*cos(Pi/6),x[2]+r*sin(Pi/6)]:" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 66 "This procedure appl ies all powers T1^i T2^j for i from 0 to n" }}{PARA 0 "" 0 "" {TEXT -1 42 " and j from 0 to m to the polygon poly." }}{PARA 0 "" 0 "" {TEXT -1 82 "The color is clr.\nA second argument (in this case c lr) can be passed in the \"map\"" }}{PARA 0 "" 0 "" {TEXT -1 67 "comm and by including it after the list of things to apply the given" }} {PARA 0 "" 0 "" {TEXT -1 32 "command (in this case polyplot)." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 171 "tiles:=proc(n,m,T1,T2,poly,clr)\n \+ map( polyplot, \n [seq( \n seq( map( (T1@@i)@(T2@@j ) , poly ),\n j=0..m),\n i=0..n) ] ,\n clr);\n end:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 33 "Store a pl ot in a named variable." }}{PARA 0 "" 0 "" {TEXT -1 72 "Be sure to put a : at the end so that all the raw data is not displayed." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "P1:=display(tiles(2,2,T1,T2,dodec,red)):" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 45 "Note thatt we hav e to shift the square upward" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "P2: =display(tiles(2,2,T1,T2,\n map(x->[x[1],x[2]+r/2],sqr),blue)):" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT -1 43 "Note that we shift the hexagon to the right" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 90 "P3:=di splay(tiles(2,2,T1,T2,\n map(x->[x[1]+(cot(Pi/12)+cot(Pi/6))/2,x[2] ],hex),green)):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "display( \{P1,P2,P3\},axes=none,scaling=CONSTRAINED);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }{TEXT -1 54 "Now we need more blue squares and more g reen hexagons." }}{PARA 0 "" 0 "" {TEXT -1 34 "Then we will have the w hole tiling" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 1 0" 8 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }