(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 5987, 180] NotebookOptionsPosition[ 5703, 166] NotebookOutlinePosition[ 6037, 181] CellTagsIndexPosition[ 5994, 178] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{ "This", " ", "is", " ", "MATHEMATICA", " ", "code", " ", "for", " ", "drawing", " ", "the", " ", "usual", " ", "VonKoch", " ", RowBox[{"snowflake", ".", "After"}], " ", "the", " ", "code", " ", "has", " ", "been", " ", "loaded"}], ",", RowBox[{"typing", " ", RowBox[{ RowBox[{"`KochSnowflake", "[", "n", "]"}], "'"}], " ", "will", " ", "draw", " ", "the", " ", "nth", " ", "generation", " ", "of", " ", "the", " ", "snowflake"}]}], "*)"}], RowBox[{ RowBox[{ RowBox[{"g", "=", "0.5"}], ";"}], "\n", RowBox[{ RowBox[{"w", "=", ".002"}], ";"}], "\n", RowBox[{ RowBox[{ RowBox[{"KochSnowflake", "[", RowBox[{ RowBox[{"n_Integer", "?", "NonNegative"}], ",", "g_", ",", "w_"}], "]"}], ":=", RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{ RowBox[{"GrayLevel", "[", "g", "]"}], ",", RowBox[{"Thickness", "[", "w", "]"}], ",", RowBox[{"FixedPoint", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"#1", "/.", RowBox[{ RowBox[{"Line", "[", RowBox[{"{", RowBox[{"start_", ",", "finish_"}], "}"}], "]"}], "\[RuleDelayed]", RowBox[{"doline", "[", RowBox[{"start", ",", "finish"}], "]"}]}]}], ")"}], "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Line", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"1", "/", "2"}], ",", RowBox[{ RowBox[{"Sqrt", "[", "3", "]"}], "/", "2"}]}], "}"}]}], "}"}], "]"}], ",", RowBox[{"Line", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "/", "2"}], ",", RowBox[{ RowBox[{"Sqrt", "[", "3", "]"}], "/", "2"}]}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}]}], "}"}], "]"}], ",", RowBox[{"Line", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}], "}"}], "]"}]}], "}"}], ",", "n"}], "]"}]}], "}"}], "]"}]}], ";"}], "\n", "\[IndentingNewLine]", RowBox[{"Show", "[", RowBox[{ RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}], "\n", "\[IndentingNewLine]", RowBox[{ RowBox[{"doline", "[", RowBox[{"start_", ",", "finish_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"vec", ",", "normal"}], "}"}], ",", RowBox[{ RowBox[{"vec", "=", RowBox[{"finish", "-", "start"}]}], ";", "\[IndentingNewLine]", RowBox[{"normal", "=", RowBox[{ RowBox[{"Reverse", "[", "vec", "]"}], RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], RowBox[{ RowBox[{"Sqrt", "[", "3", "]"}], "/", "6"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"Line", "[", RowBox[{"{", RowBox[{"start", ",", RowBox[{"start", "+", RowBox[{"vec", "/", "3"}]}]}], "}"}], "]"}], ",", RowBox[{"Line", "[", RowBox[{"{", RowBox[{ RowBox[{"start", "+", RowBox[{"vec", "/", "3"}]}], ",", RowBox[{"start", "+", RowBox[{"vec", "/", "2"}], "+", "normal"}]}], "}"}], "]"}], ",", RowBox[{"Line", "[", RowBox[{"{", RowBox[{ RowBox[{"start", "+", RowBox[{"vec", "/", "2"}], "+", "normal"}], ",", RowBox[{"start", "+", RowBox[{"2", " ", RowBox[{"vec", "/", "3"}]}]}]}], "}"}], "]"}], ",", RowBox[{"Line", "[", RowBox[{"{", RowBox[{ RowBox[{"start", "+", RowBox[{"2", " ", RowBox[{"vec", "/", "3"}]}]}], ",", "finish"}], "}"}], "]"}]}], "}"}]}]}], "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\n", RowBox[{ RowBox[{"vk", "[", "n_", "]"}], ":=", RowBox[{"Show", "[", RowBox[{ RowBox[{"KochSnowflake", "[", RowBox[{"n", ",", "0", ",", ".005"}], "]"}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}]}], "\n", "\n"}]}]], "Input", CellChangeTimes->{{3.46254232867733*^9, 3.462542331601828*^9}}], Cell[BoxData[ RowBox[{"vk", "[", "4", "]"}]], "Input", CellChangeTimes->{{3.462542338614604*^9, 3.462542339948747*^9}}] }, WindowSize->{640, 750}, WindowMargins->{{172, Automatic}, {Automatic, 77}}, FrontEndVersion->"6.0 for Linux x86 (32-bit) (June 19, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 5007, 139, 627, "Input"], Cell[5578, 162, 121, 2, 32, "Input"] } ] *) (* End of internal cache information *)