{VERSION 5 0 "IBM INTEL NT" "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 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Warning" -1 7 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 2 2 2 2 2 1 1 1 3 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Tim es" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 } {PSTYLE "Normal" -1 257 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 21 "Jurassic Park Fractal" } }{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 50 "By Syl vain Muise, smuise@student.math.uwaterloo.ca" }}{PARA 0 "" 0 "" {TEXT -1 65 "This Maplet displays a fractal used in the \"Jurassic Park\" no vel." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 256 96 " To run this maplet, click the \"Execute-Worksheet\" button in the too l-bar menu (the !!! button)\n" }{TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "restart: with(plots): with(plottools): with(Mapl ets): with(Maplets[Elements]):" }}{PARA 7 "" 1 "" {TEXT -1 33 "Warning , computation interrupted\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 206 "jurLeft := proc(n) option remember;\n local left, right:\n if n = 1 then\n return [1]:\n else\n left := jurLeft(n-1):\n rig ht := jurRight(n-1):\n return [op(left), 1, op(right)]:\n end if: \nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 209 "jurRight := proc(n) option remember;\n local left, right:\n if n = 1 then\n \+ return [-1]:\n else\n left := jurLeft(n-1):\n right := jurRight (n-1):\n return [op(left), -1, op(right)]:\n end if:\nend proc:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 842 "draw := proc(li, randL, r andC, C) option remember;\n local X, Y, Angle, newX, newY, i, lines, \+ L:\n X := 0:\n Y := 0:\n Angle := 270:\n newX := 0: newY := -0.25: \n lines[1] := line([X,Y],[newX,newY], color=COLOR(RGB, C[1], C[2], C [3]), thickness=3):\n X := newX: Y := newY:\n for i from 1 to nops(l i) do\n Angle := Angle - 90 * li[i]:\n if randL then\n L := rand()/10^12:\n else\n L := 0.25:\n end if:\n newX := n ewX + L*cos(Angle * Pi / 180):\n newY := newY + L*sin(Angle * Pi / \+ 180):\n if randC then\n lines[i+1] := line([X,Y], [newX,newY], color=COLOR(RGB, rand()/10^12, rand()/10^12, rand()/10^12), thickness =3):\n else\n lines[i+1] := line([X,Y],[newX,newY], color=COLO R(RGB, C[1], C[2], C[3]), thickness=3):\n end if:\n X := newX: Y := newY:\n end do:\n seq(lines[i], i = 1..(nops(li) + 1));\nend pro c:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2823 "fractalMaplet := Ma plet(\n Window[W1]('title' = \"Fractal\", menubar = MB1, 'layout' = B L1),\n MenuBar[MB1](Menu(\"File\", MenuItem(\"Close\", Shutdown()))), \n BoxLayout[BL1](inset=0,\n BoxColumn(inset=0, spacing=0,\n \+ Label(\"If you took a narrow strip of paper, and kept folding it in ha lf, and then\", font = Font(\"times\", 12)),\n Label(\"unfolded i t, you would get the following fractal. But achieving the fractal\", f ont = Font(\"times\", 12)),\n Label(\"is much easier with the hel p of this Maplet.\", font = Font(\"helvetica\", 12)),\n Label(\"I t can be recursively defined as a list of right of left turns as follo ws: \", font = Font(\"times\", 12)),\n Label(\"1. The middle turn is always a right turn. \", font = Font(\"helvetica\", 12)), \n \+ Label(\"2. The turns to the left of the middle are the turns of the it eration before. \", font = Font(\"times\", 12)),\n Label(\"3. The turns to the right of the middle are opposites of the ones to the lef t.\", font = Font(\"times\", 12)),\n Plotter[P1](),\n Label( \"This fractal is illustrated in the novel \"\"Jurassic Park\"\", by M ichael Crichton. \", font = Font(\"times\", 12)) \n ),\n BoxCo lumn(inset=0, spacing=0,\n BoxRow(inset=0,spacing=0,\n \"N umber of Iterations:\"\n ),\n BoxRow(inset=0, spacing=0,\n \+ ComboBox[n](\"1\", [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \" 7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\", \"15\"])\n \+ ),\n BoxRow(inset=0, spacing=0,\n CheckBox[randL](fal se, caption=\"Random Length\")\n ),\n BoxRow(inset=0, spacin g=0,\n CheckBox[randC](false, caption=\"Random Color\")\n \+ ),\n BoxRow(inset=0, spacing=0,\n BoxColumn(inset=0, spaci ng=0,\n \"Red\",\n TextField[r](\"0\",width=2, halig n=right, onchange=SetOption( target=rs, Argument(r) )),\n Sli der[rs](filled=true, lower=0, majorticks=20, minorticks=5, orientation =vertical, snapticks=false, upper=255, value=0, onchange=SetOption( ta rget=r, Argument( rs) ))\n ),\n BoxColumn(inset=0, spaci ng=0,\n \"Green\",\n TextField[g](\"0\",width=2, hal ign=right, onchange=SetOption(target=gs, Argument(g))),\n Sli der[gs](filled=true, lower=0, majorticks=20, minorticks=5, orientation =vertical, snapticks=false, upper=255, value=0, onchange=Evaluate(targ et=g, Argument(gs)))\n ),\n BoxColumn(inset=0, spacing=0 ,\n \"Blue\",\n TextField[b](\"0\",width=2, halign=r ight, onchange=SetOption(target=bs, Argument(b))),\n Slider[b s](filled=true,lower=0,majorticks=20,minorticks=5, orientation=vertic al, snapticks=false, upper=255, value=0, onchange=Evaluate(target=b,Ar gument(bs)))\n )\n ),\n Button[go](\"Do it!\", oncl ick=A1)\n )\n ),\n Action[A1](Evaluate(P1 = 'display(draw(jurLeft (n),randL,randC,[r/255,g/255,b/255]), axes=boxed, scaling=constrained) '))\n):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "Display(fractalM aplet);" }}}}{MARK "0 3 0" 65 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }