(* 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[ 104336, 3227] NotebookOptionsPosition[ 95828, 2969] NotebookOutlinePosition[ 96616, 3002] CellTagsIndexPosition[ 96548, 2997] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Understanding Statistical Physics", "Title"], Cell["\<\ Project Suggestions for APAM 1601 Due: Monday, March 30, 2009\ \>", "Subsubtitle", CellChangeTimes->{{3.44588602205689*^9, 3.4458860263268833`*^9}, { 3.4470621760663233`*^9, 3.4470621766996737`*^9}}], Cell["\<\ All projects must have\[Ellipsis] Name:____________ Email:_____@columbia.edu\ \>", "Subsubtitle"], Cell[CellGroupData[{ Cell["Introduction", "Section"], Cell[TextData[{ "During the past few lectures, we've explored simple models for the \ evolution of complex systems interacting with random motions. Although these \ models are very simple, they can be used to develop insights to real physical \ systems, such as proteins, cluster, magnets and polymers.\n\nFor your next \ project, I ask that you prepare a notebook that reports your investigations \ related to a problem or question in statistical physics and/or random \ numbers. I listed below several possible subjects each phrased like a \ homework problem, but I encourage you to look beyond the simple answer to the \ question. Like before, your notebook should contain ", StyleBox["Mathematica", FontSlant->"Italic"], " expressions and graphics which illustrate your solution. Try not to \ include a large number of repeated expressions. Instead, generate a table or \ graphic of your results. Also, consider collecting ", StyleBox["Mathematica", FontSlant->"Italic"], " expressions that are used repeatedly into a single ", StyleBox["Module[...]", FontWeight->"Bold"], " that can be executed within a ", StyleBox["Table[ ]", FontWeight->"Bold"], " statement or by mapping to elements of a list. \n\nIn all cases, format \ your notebook and include textual comments and descriptions. Your notebook \ need not be long. It should begin with an Introduction describing your \ problem, approach, and a brief abstract of your results. It should also be \ interesting and arrive at a definite conclusion.\n\nI've also attached (to \ our class website) an article from ", StyleBox["American Scientist", FontSlant->"Italic"], " (written by former editor Brian Hayes) that provide some background for \ one possible investigation, entitled \"How to Avoid Yourself\" and describes \ counting of possible self-avoiding random walks. Feel free to use any idea \ contained in this article to motivate questions for you project. (Ideas for \ the Eden simulation and for \"diffusion limited aggregation\" came from \ Giordano's textbook.)" }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Random and Self-Avoiding Walks", "Section"], Cell["\<\ Using our in-class notebook describing the \"pivot\" method for generating \ self-avoiding walks and Brian Hayes's article \"How to Avoid Yourself\", \ compare the statistics of (i) random walks, (ii) non-reversing walks, and \ (iii) self-avoiding walks. \ \>", "Text"], Cell[TextData[{ "Your analyses will have several steps. First, you must verify that your \ three \"stepper\" functions work as designed and that you are able to \ construct ensembles of walks using the three techniques. Secondly, compute \ statistical averages and variations of your walks as a function of the length \ of the walks. The average position is the \"center of mass\", {", Cell[BoxData[ FormBox[ SubscriptBox["x", "cm"], TraditionalForm]]], ",", Cell[BoxData[ FormBox[ SubscriptBox["y", "cm"], TraditionalForm]]], "}. The root-mean-square size of the walkers is \[CapitalDelta] \[Congruent] \ ", Cell[BoxData[ FormBox[ SqrtBox[ RowBox[{"\[LeftAngleBracket]", FormBox[ SuperscriptBox[ RowBox[{"(", RowBox[{"|", RowBox[{ FormBox[ SubscriptBox["r", "i"], TraditionalForm], " ", "\[Dash]", " ", FormBox[ SubscriptBox["r", "cm"], TraditionalForm]}], "|"}], ")"}], "2"], TraditionalForm], "\[RightAngleBracket]"}]], TraditionalForm]]], ". \[CapitalDelta] is a measure of the average \"radius\" of random walk \ process. The end-to-end length is ", StyleBox["L = |", FontSlant->"Italic"], Cell[BoxData[ FormBox[ SubscriptBox["r", "n"], TraditionalForm]]], " - ", Cell[BoxData[ FormBox[ SubscriptBox["r", "0"], TraditionalForm]]], "| is a measure of how far one can walk in ", StyleBox["n", FontSlant->"Italic"], " steps. C", "alculate averages of \[CapitalDelta] and ", StyleBox["L", FontSlant->"Italic"], " as a function of the number of steps, ", StyleBox["n", FontSlant->"Italic"], ", for a large number of random walkers and for each of the three types of \ walks. We know that \[LeftAngleBracket]", "\[CapitalDelta]\[RightAngleBracket] and \[LeftAngleBracket]", StyleBox["L", FontSlant->"Italic"], "\[RightAngleBracket]", " scale like ", Cell[BoxData[ FormBox[ SqrtBox["n"], TraditionalForm]]], " for an unbiased random walk. How do these quantities vary with ", StyleBox["n", FontSlant->"Italic"], " for the other two types of walks?" }], "Text"], Cell[CellGroupData[{ Cell["Defining the Walkers", "Subsection"], Cell[TextData[{ "See class notebooks: ", ButtonBox["8-3D_Walks.nb", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://www.apam.columbia.edu/courses/ap1601y/8-3D_Walks.nb"], None}], " and ", ButtonBox["8-SelfAvoidingWalks.nb", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://www.apam.columbia.edu/courses/ap1601y/8-SelfAvoidingWalks.nb"]\ , None}], "." }], "Text"], Cell[CellGroupData[{ Cell["2D Random Walk", "Subsubsection"], Cell[BoxData[ RowBox[{ RowBox[{"step2D", "[", "]"}], ":=", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "}"}], "\[LeftDoubleBracket]", RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", "4"}], "}"}], "]"}], "\[RightDoubleBracket]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"walk2D", "[", "n_", "]"}], " ", ":=", " ", RowBox[{"NestList", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"#", " ", "+", " ", RowBox[{"step2D", "[", "]"}]}], ")"}], "&"}], ",", " ", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", " ", "n"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"walk2D", "[", "50", "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"Thickness", "[", "0.01`", "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "14"}], ",", "14"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "14"}], ",", "14"}], "}"}]}], "}"}]}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}]}], "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["2D Non-Reversing Walk", "Subsubsection"], Cell[BoxData[ RowBox[{ RowBox[{"oldStep", " ", "=", " ", RowBox[{"{", "}"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"stepNR2D", "[", "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "s", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"While", "[", RowBox[{ RowBox[{"s", " ", "=", " ", RowBox[{"step2D", "[", "]"}]}], ";", " ", RowBox[{"s", " ", "\[Equal]", " ", RowBox[{"-", "oldStep"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"oldStep", " ", "=", " ", "s"}], ";", "\[IndentingNewLine]", "s"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"walkNR2D", "[", "n_", "]"}], " ", ":=", " ", RowBox[{"(", RowBox[{ RowBox[{"oldStep", " ", "=", " ", RowBox[{"{", "}"}]}], ";", " ", RowBox[{"NestList", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"#", " ", "+", " ", RowBox[{"stepNR2D", "[", "]"}]}], ")"}], "&"}], ",", " ", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", " ", "n"}], "]"}]}], ")"}]}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"walkNR2D", "[", "50", "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"Thickness", "[", "0.01`", "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "14"}], ",", "14"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "14"}], ",", "14"}], "}"}]}], "}"}]}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}]}], "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Self-Avoiding Walk", "Subsubsection"], Cell[BoxData[{ RowBox[{ RowBox[{"rot90", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"rot180", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"rot270", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}]}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"twist", "[", "chain_List", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "n", ",", "iPivot", ",", "fixpart", ",", "movepart", ",", "rotchoice", ",", "newpart", ",", "newchain", ",", "rot"}], "}"}], ",", RowBox[{ RowBox[{"rot", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}]}], "}"}]}], "}"}]}], ";", RowBox[{"n", "=", RowBox[{ RowBox[{"Length", "[", "chain", "]"}], "-", "1"}]}], ";", RowBox[{"iPivot", "=", RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", RowBox[{"n", "-", "1"}]}], "}"}], "]"}]}], ";", RowBox[{"fixpart", "=", RowBox[{"Take", "[", RowBox[{"chain", ",", "iPivot"}], "]"}]}], ";", RowBox[{"movepart", "=", RowBox[{"Take", "[", RowBox[{"chain", ",", RowBox[{"iPivot", "-", RowBox[{"(", RowBox[{"n", "+", "1"}], ")"}]}]}], "]"}]}], ";", RowBox[{"rotchoice", "=", RowBox[{"rot", "\[LeftDoubleBracket]", RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", "3"}], "}"}], "]"}], "\[RightDoubleBracket]"}]}], ";", RowBox[{"newpart", "=", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{ "chain", "\[LeftDoubleBracket]", "iPivot", "\[RightDoubleBracket]"}], "+", RowBox[{ RowBox[{"(", RowBox[{"#1", "-", RowBox[{ "chain", "\[LeftDoubleBracket]", "iPivot", "\[RightDoubleBracket]"}]}], ")"}], ".", "rotchoice"}]}], "&"}], ")"}], "/@", "movepart"}]}], ";", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"newpart", "\[Intersection]", "fixpart"}], "\[Equal]", RowBox[{"{", "}"}]}], ",", RowBox[{"newchain", "=", RowBox[{"Join", "[", RowBox[{"fixpart", ",", "newpart"}], "]"}]}], ",", "chain"}], "]"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"nSteps", " ", "=", " ", "50"}], ";", RowBox[{"chain0", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "0"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "0", ",", " ", "nSteps"}], "}"}]}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Nest", "[", RowBox[{"twist", ",", "chain0", ",", "500"}], "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"Thickness", "[", "0.01`", "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "14"}], ",", "14"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "14"}], ",", "14"}], "}"}]}], "}"}]}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}]}], "]"}]], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Demo", "Subsection"], Cell["\<\ Here we look at the average distance walked by averaging over 100 walkers \ (about \[PlusMinus] 10% accuracy).\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"nWalkers", " ", "=", " ", "100"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"steps", " ", "=", " ", RowBox[{"Table", "[", RowBox[{"i", ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "10", ",", " ", "410", ",", " ", "50"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"distance2", "[", "w_List", "]"}], " ", ":=", " ", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"#1", "^", "2"}], " ", "+", " ", RowBox[{"#2", "^", "2"}]}], ")"}], "&"}], " ", "@@", " ", RowBox[{"Last", "[", "w", "]"}]}]}]], "Input"], Cell[BoxData[ RowBox[{"distance2", "[", RowBox[{"walkNR2D", "[", "50", "]"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"rw", " ", "=", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"#", ",", " ", RowBox[{"Sqrt", "[", RowBox[{"Mean", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"N", "[", RowBox[{"distance2", "[", RowBox[{"walk2D", "[", "#", "]"}], "]"}], "]"}], ",", " ", RowBox[{"{", "nWalkers", "}"}]}], "]"}], "]"}], "]"}]}], "}"}], "&"}], " ", "/@", " ", "steps"}]}]], "Input"], Cell[BoxData[ RowBox[{"rwNR", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"#", ",", RowBox[{"Sqrt", "[", " ", RowBox[{"Mean", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"N", "[", RowBox[{"distance2", "[", RowBox[{"walkNR2D", "[", "#", "]"}], "]"}], "]"}], ",", " ", RowBox[{"{", "nWalkers", "}"}]}], "]"}], "]"}], "]"}]}], "}"}], "&"}], " ", "/@", " ", "steps"}]}]], "Input"], Cell[BoxData[ RowBox[{"rwSA", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"#", ",", " ", RowBox[{ RowBox[{"chain0", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "0"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "0", ",", " ", "#"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"Sqrt", "[", RowBox[{"Mean", "[", " ", RowBox[{ RowBox[{ RowBox[{"N", "[", RowBox[{"distance2", "[", "#", "]"}], "]"}], "&"}], " ", "/@", " ", RowBox[{"Take", "[", RowBox[{ RowBox[{"NestList", "[", RowBox[{"twist", ",", " ", "chain0", ",", RowBox[{"nWalkers", " ", "+", " ", "100"}]}], "]"}], ",", " ", RowBox[{"-", "nWalkers"}]}], "]"}]}], "]"}], "]"}]}]}], "}"}], "&"}], " ", "/@", " ", "steps"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Needs", "[", "\"\\"", "]"}], ";", RowBox[{"Needs", "[", "\"\\"", "]"}]}], ")"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"{", RowBox[{"rw", ",", "rwNR", ",", "rwSA"}], "}"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\<\\!\\(\\*SqrtBox[\\(\[LeftAngleBracket]\\*SuperscriptBox[\\(r\\), \ \\(2\\)]\[RightAngleBracket]\\)]\\)\>\""}], "}"}]}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}]], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Problems in Protein Folding", "Section"], Cell["\<\ One of the most interesting subjects of statistical physics is the phase \ transition. You are familiar with the phase transitions of water. As water is \ heated, ice melts, water boils, and eventually the atoms ionize. Similar \ phenomenon occur in proteins. The structure of the protein is compact when \ cold, and it becomes \"stretched out\" when it is heated. \ \>", "Text"], Cell[TextData[{ "Using our in-class notebook that develops a simple model for protein \ folding, you can study the phase transitions of proteins. There will be two \ types of variables that you will measure in your simulation, and these \ variables change as the ", StyleBox["temperature", FontSlant->"Italic"], " used in your folding simulation changes. The first type of measurement is \ the ", StyleBox["size", FontSlant->"Italic"], ". You can measure either the \"end-to-end length\" or the root-mean-squared \ radius of the amino acids. The size variable will increase as the temperature \ increases. The second type of measurement is the (chemical) ", StyleBox["potential energy", FontSlant->"Italic"], ". This is the sum of the interaction energies of your protein. If the \ thermal agitation is not too large, then the amino acids of the protein chain \ can find and bind together is a \"low energy state\". As the temperature \ increases, then the average chemical energy of the protein will also \ increase. " }], "Text"], Cell["\<\ You find that the chemical potential energy and the protein size will not be \ linear functions of the temperature. Indeed, you will find a sharp increase \ in the average energy at a critical temperature that corresponds to the \ \"un-folding\" of the protein. This is a phase transition, just like the \ melting of ice. \ \>", "Text"], Cell[CellGroupData[{ Cell["Suggested Investigations", "Subsection"], Cell[TextData[{ StyleBox["(a)", FontWeight->"Bold"], " Select a protein (or a protein segment) and create a simulation as a \ function of temperature. Examine a range of temperatures, and find bounds \ that are ", StyleBox["below", FontSlant->"Italic"], " and ", StyleBox["above", FontSlant->"Italic"], " the critical temperature for the protein structure phase transition." }], "Text"], Cell[TextData[{ StyleBox["(b)", FontWeight->"Bold"], " Prepare a sequence of simulations as the temperature gradually varies from \ the lower to upper bounds", ". For each case, compute the average energy and size of the protein. This \ could be done by averaging protein configurations from the final stages of \ the simulation. You may also want to observe the standard deviation, or \ fluctuations, from the average. During a phase transition, the fluctuations \ increase." }], "Text"], Cell[TextData[{ StyleBox["(c)", FontWeight->"Bold"], " Examine how the protein structure, phase-transition, and/or critical \ temperature changes with amino acid sequence", "." }], "Text"], Cell[TextData[{ StyleBox["(d)", FontWeight->"Bold"], " Examine how the protein structure, phase-transition, and/or critical \ temperature changes with different interaction matrices. For example, you \ could change the coefficients for hydophobacity or coulomb interactions. You \ could also create a \"random\" interaction matrix. Does the nature of the \ interaction matrix effect the equilibrium size of the protein? Does it effect \ the critical temperature?" }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Demo", "Subsection"], Cell[CellGroupData[{ Cell["Setup Protein Folding Algorithm", "Subsubsection"], Cell[BoxData[ RowBox[{ RowBox[{"SetDirectory", "[", "\"\<~/Desktop\>\"", "]"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"getSequenceFromFile", "[", "filename_String", "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "strings", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"strings", " ", "=", " ", RowBox[{"ReadList", "[", RowBox[{"filename", ",", " ", "String"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"StringTake", "[", RowBox[{ RowBox[{"First", "[", "strings", "]"}], ",", RowBox[{"{", RowBox[{"2", ",", "5"}], "}"}]}], "]"}], ",", " ", RowBox[{"StringJoin", "[", RowBox[{"Drop", "[", RowBox[{"strings", ",", "1"}], "]"}], "]"}]}], "}"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"aminoTable", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "71.09", ",", "115", ",", "88.6", ",", "\"\<-\>\"", ",", "6.107", ",", "16.65", ",", "1.401", ",", "1", ",", "\"\\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "103.15", ",", "135", ",", "108.5", ",", "9.3", ",", "5.02", ",", "25.0", ",", "\"\<-\>\"", ",", "0", ",", "\"\\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "115.09", ",", "150", ",", "111.1", ",", "4.5", ",", "2.98", ",", "0.778", ",", "1.66", ",", RowBox[{"-", "0.1"}], ",", "\"\\"", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "129.12", ",", "190", ",", "138.4", ",", "4.6", ",", "3.08", ",", "0.864", ",", "1.46", ",", "0.5", ",", "\"\\"", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "147.18", ",", "210", ",", "189.9", ",", "\"\<-\>\"", ",", "5.91", ",", "2.965", ",", "\"\<-\>\"", ",", "2.3", ",", "\"\<3232AA\>\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "57.05", ",", "75", ",", "60.1", ",", "\"\<-\>\"", ",", "6.064", ",", "24.99", ",", "1.607", ",", "0", ",", "\"\\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "137.14", ",", "195", ",", "153.2", ",", "6.2", ",", "7.64", ",", "4.19", ",", "\"\<-\>\"", ",", "1.3", ",", "\"\<8282D2\>\"", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "113.16", ",", "175", ",", "166.7", ",", "\"\<-\>\"", ",", "6.038", ",", "4.117", ",", "\"\<-\>\"", ",", "2.7", ",", "\"\<0F820F\>\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "128.17", ",", "200", ",", "168.6", ",", "10.4", ",", "9.47", ",", "25", ",", "\"\<-\>\"", ",", "1.9", ",", "\"\<145AFF\>\"", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "113.16", ",", "170", ",", "166.7", ",", "\"\<-\>\"", ",", "6.036", ",", "2.426", ",", "1.191", ",", "2.9", ",", "\"\<0F820F\>\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "131.19", ",", "185", ",", "162.9", ",", "\"\<-\>\"", ",", "5.74", ",", "3.381", ",", "1.34", ",", "2.3", ",", "\"\\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "114.11", ",", "160", ",", "114.1", ",", "\"\<-\>\"", ",", "\"\<-\>\"", ",", "3.53", ",", "1.54", ",", RowBox[{"-", "0.1"}], ",", "\"\<00DCDC\>\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "97.12", ",", "145", ",", "112.7", ",", "\"\<-\>\"", ",", "6.3", ",", "162.3", ",", "\"\<-\>\"", ",", "1.9", ",", "\"\\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "128.14", ",", "180", ",", "143.8", ",", "\"\<-\>\"", ",", "\"\<-\>\"", ",", "2.5", ",", "\"\<-\>\"", ",", "1.3", ",", "\"\<00DCDC\>\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "156.19", ",", "225", ",", "173.4", ",", "12", ",", "10.76", ",", "15", ",", "1.1", ",", "1.1", ",", "\"\<145AFF\>\"", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "87.08", ",", "115", ",", "89", ",", "\"\<-\>\"", ",", "5.68", ",", "5.023", ",", "1.537", ",", "0.2", ",", "\"\\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "101.11", ",", "140", ",", "116.1", ",", "\"\<-\>\"", ",", "\"\<-\>\"", ",", "25", ",", "\"\<-\>\"", ",", "1.1", ",", "\"\\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "99.14", ",", "155", ",", "140", ",", "\"\<-\>\"", ",", "6.002", ",", "8.85", ",", "1.23", ",", "2.2", ",", "\"\<0F820F\>\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "186.12", ",", "255", ",", "227.8", ",", "\"\<-\>\"", ",", "5.88", ",", "1.136", ",", "\"\<-\>\"", ",", "2.9", ",", "\"\\"", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "163.18", ",", "230", ",", "193.6", ",", "9.7", ",", "5.63", ",", "0.0453", ",", "1.456", ",", "1.6", ",", "\"\<3232AA\>\"", ",", "0"}], "}"}]}], "}"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"aminoIndex", "[", "aaChar_String", "]"}], " ", ":=", " ", "\[IndentingNewLine]", RowBox[{"Do", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"aminoTable", "\[LeftDoubleBracket]", RowBox[{"i", ",", "3"}], "\[RightDoubleBracket]"}], "\[Equal]", " ", "aaChar"}], ",", " ", RowBox[{"Return", "[", "i", "]"}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "2", ",", " ", "21"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"makeColorFromString", "[", "str_String", "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"r", ",", "g", ",", "b"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"r", " ", "=", " ", RowBox[{"N", "[", RowBox[{ RowBox[{"ToExpression", "[", RowBox[{"\"\<16^^\>\"", "<>", RowBox[{"StringTake", "[", RowBox[{"str", ",", RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}]}], "]"}]}], "]"}], "/", "255"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"g", " ", "=", " ", RowBox[{"N", "[", RowBox[{ RowBox[{"ToExpression", "[", RowBox[{"\"\<16^^\>\"", "<>", RowBox[{"StringTake", "[", RowBox[{"str", ",", RowBox[{"{", RowBox[{"3", ",", "4"}], "}"}]}], "]"}]}], "]"}], "/", "255"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"b", " ", "=", " ", RowBox[{"N", "[", RowBox[{ RowBox[{"ToExpression", "[", RowBox[{"\"\<16^^\>\"", "<>", RowBox[{"StringTake", "[", RowBox[{"str", ",", RowBox[{"{", RowBox[{"5", ",", "6"}], "}"}]}], "]"}]}], "]"}], "/", "255"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RGBColor", "[", RowBox[{"r", ",", "g", ",", "b"}], "]"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"aminoJkc", " ", "=", " ", RowBox[{"Table", "[", " ", RowBox[{ RowBox[{ RowBox[{ RowBox[{"-", " ", "k"}], " ", RowBox[{"aminoTable", "\[LeftDoubleBracket]", RowBox[{ StyleBox["i", FontColor->RGBColor[1, 0, 0]], ",", "11"}], "\[RightDoubleBracket]"}], " ", RowBox[{"aminoTable", "\[LeftDoubleBracket]", RowBox[{ StyleBox["j", FontColor->RGBColor[1, 0, 1]], ",", "11"}], "\[RightDoubleBracket]"}]}], " ", "-", " ", RowBox[{"c", " ", RowBox[{"aminoTable", "\[LeftDoubleBracket]", RowBox[{ StyleBox["i", FontColor->RGBColor[1, 0, 0]], ",", "13"}], "\[RightDoubleBracket]"}], " ", RowBox[{"aminoTable", "\[LeftDoubleBracket]", RowBox[{ StyleBox["j", FontColor->RGBColor[1, 0, 1]], ",", "13"}], "\[RightDoubleBracket]"}]}]}], ",", " ", RowBox[{"{", RowBox[{ StyleBox["i", FontColor->RGBColor[1, 0, 0]], ",", " ", "2", ",", " ", "21"}], "}"}], ",", " ", RowBox[{"{", RowBox[{ StyleBox["j", FontColor->RGBColor[1, 0, 1]], ",", " ", "2", ",", " ", "21"}], "}"}]}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"aminoJ", " ", "=", " ", RowBox[{ RowBox[{"aminoJkc", " ", "/.", " ", RowBox[{"k", " ", "\[Rule]", " ", "1.0"}]}], " ", "/.", " ", RowBox[{"c", " ", "\[Rule]", " ", "1.0"}]}]}], ";"}], " ", RowBox[{"(*", " ", StyleBox[ RowBox[{"for", " ", "example"}], FontColor->RGBColor[0, 1, 0]], " ", "*)"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"twist", "[", "chain_List", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "n", ",", "iPivot", ",", "fixpart", ",", "movepart", ",", "rotchoice", ",", "newpart", ",", "newchain", ",", "rot"}], "}"}], ",", RowBox[{ RowBox[{"rot", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0", ",", "0"}], "}"}]}], "}"}]}], "}"}]}], ";", RowBox[{"n", "=", RowBox[{ RowBox[{"Length", "[", "chain", "]"}], "-", "1"}]}], ";", RowBox[{"iPivot", "=", RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", RowBox[{"n", "-", "1"}]}], "}"}], "]"}]}], ";", RowBox[{"fixpart", "=", RowBox[{"Take", "[", RowBox[{"chain", ",", "iPivot"}], "]"}]}], ";", RowBox[{"movepart", "=", RowBox[{"Take", "[", RowBox[{"chain", ",", RowBox[{"iPivot", "-", RowBox[{"(", RowBox[{"n", "+", "1"}], ")"}]}]}], "]"}]}], ";", RowBox[{"rotchoice", "=", RowBox[{"rot", "\[LeftDoubleBracket]", RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", "9"}], "}"}], "]"}], "\[RightDoubleBracket]"}]}], ";", RowBox[{"newpart", "=", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{ "chain", "\[LeftDoubleBracket]", "iPivot", "\[RightDoubleBracket]"}], "+", RowBox[{ RowBox[{"(", RowBox[{"#1", "-", RowBox[{ "chain", "\[LeftDoubleBracket]", "iPivot", "\[RightDoubleBracket]"}]}], ")"}], ".", "rotchoice"}]}], "&"}], ")"}], "/@", "movepart"}]}], ";", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"newpart", "\[Intersection]", "fixpart"}], "\[Equal]", RowBox[{"{", "}"}]}], ",", RowBox[{"newchain", "=", RowBox[{"Join", "[", RowBox[{"fixpart", ",", "newpart"}], "]"}]}], ",", "chain"}], "]"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"newProteinFromFile", "[", RowBox[{"filename_String", ",", RowBox[{"nTwists_:", "50"}]}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "chain", ",", "sequenceLetters", ",", " ", "length", ",", " ", "sequenceNumbers"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"sequenceLetters", " ", "=", " ", RowBox[{"getSequenceFromFile", "[", "filename", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"proteinName", " ", "=", " ", RowBox[{"First", "[", "sequenceLetters", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"sequenceLetters", " ", "=", " ", RowBox[{"Last", "[", "sequenceLetters", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"length", " ", "=", " ", RowBox[{"StringLength", "[", "sequenceLetters", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"chain", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "0", ",", "0"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "0", ",", " ", RowBox[{"length", "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"chain", " ", "=", " ", RowBox[{"Nest", "[", RowBox[{"twist", ",", " ", "chain", ",", " ", "nTwists"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"sequenceNumbers", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"aminoIndex", "[", RowBox[{"StringTake", "[", RowBox[{"sequenceLetters", ",", RowBox[{"{", "i", "}"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "length"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"chain", ",", " ", "sequenceNumbers"}], "}"}]}]}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"twistProtein", "[", "p_List", "]"}], " ", ":=", " ", RowBox[{"{", RowBox[{ RowBox[{"twist", "[", RowBox[{"First", "[", "p", "]"}], "]"}], ",", " ", RowBox[{"Last", "[", "p", "]"}]}], "}"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"showProtein", "[", RowBox[{"p_List", ",", "opts___"}], "]"}], " ", ":=", " ", RowBox[{"Show", "[", RowBox[{ RowBox[{"Graphics3D", "[", RowBox[{"{", RowBox[{ RowBox[{ StyleBox["Line", FontColor->RGBColor[1, 0, 1]], "[", RowBox[{"First", "[", "p", "]"}], "]"}], ",", " ", RowBox[{"PointSize", "[", "0.04", "]"}], ",", RowBox[{"Flatten", "[", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ StyleBox[ RowBox[{"makeColorFromString", "[", RowBox[{"aminoTable", "\[LeftDoubleBracket]", RowBox[{ RowBox[{"Last", "[", "#", "]"}], ",", "12"}], "\[RightDoubleBracket]"}], "]"}], FontColor->RGBColor[1, 0, 1]], ",", " ", RowBox[{ StyleBox["Point", FontColor->RGBColor[1, 0, 1]], "[", RowBox[{"First", "[", "#", "]"}], "]"}]}], "}"}], "&"}], " ", "/@", " ", RowBox[{"Transpose", "[", "p", "]"}]}], "]"}]}], "}"}], "]"}], ",", "opts", ",", RowBox[{"AspectRatio", "\[Rule]", " ", "Automatic"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"lengthProtein", "[", "p_List", "]"}], " ", ":=", " ", RowBox[{ RowBox[{ RowBox[{"N", "[", RowBox[{"Sqrt", "[", RowBox[{ RowBox[{"#1", "^", "2"}], " ", "+", " ", RowBox[{"#2", "^", "2"}], " ", "+", " ", RowBox[{"#3", "^", "2"}]}], "]"}], "]"}], "&"}], " ", "@@", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"First", "[", "p", "]"}], "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], " ", "-", " ", RowBox[{ RowBox[{"First", "[", "p", "]"}], "\[LeftDoubleBracket]", RowBox[{"Length", "[", RowBox[{"First", "[", "p", "]"}], "]"}], "\[RightDoubleBracket]"}]}], ")"}]}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"center", "[", "p_List", "]"}], " ", ":=", " ", RowBox[{ RowBox[{"(", RowBox[{"Plus", " ", "@@", " ", RowBox[{"First", "[", "p", "]"}]}], ")"}], "/", RowBox[{"Length", "[", RowBox[{"First", "[", "p", "]"}], "]"}]}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"meanSquareRadius", "[", "p_List", "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"cm", ",", " ", "del"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"cm", " ", "=", " ", RowBox[{"center", "[", "p", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"del", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"#", " ", "-", " ", "cm"}], ")"}], "&"}], " ", "/@", " ", RowBox[{"First", "[", "p", "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"del", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"#1", "^", "2"}], " ", "+", " ", RowBox[{"#2", "^", "2"}], " ", "+", " ", RowBox[{"#3", "^", "2"}]}], ")"}], "&"}], " ", "@@@", " ", "del"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"(", RowBox[{"Plus", " ", "@@", " ", "del"}], ")"}], "/", RowBox[{"Length", "[", RowBox[{"First", "[", "p", "]"}], "]"}]}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"deltaNeighbors", " ", "=", " ", RowBox[{"DeleteCases", "[", RowBox[{ RowBox[{"Flatten", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "j", ",", "k"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"k", ",", RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "]"}], ",", "2"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"0", ",", "0", ",", "0"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"energyOne", "[", RowBox[{"p_List", ",", StyleBox[ RowBox[{ StyleBox["j", FontColor->RGBColor[1, 0, 0]], "_List"}]], ",", StyleBox[ RowBox[{ StyleBox["at", FontColor->RGBColor[0, 1, 0]], "_"}]]}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"e", ",", "neighbors"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"e", " ", "=", " ", "0.0"}], ";", "\[IndentingNewLine]", RowBox[{"neighbors", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Position", "[", RowBox[{ RowBox[{"First", "[", "p", "]"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"First", "[", "p", "]"}], "\[LeftDoubleBracket]", StyleBox["at", FontColor->RGBColor[0, 1, 0]], "\[RightDoubleBracket]"}], " ", "+", " ", "#"}]}], "]"}], "&"}], " ", "/@", " ", "deltaNeighbors"}], ",", " ", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"neighbors", " ", "=", " ", RowBox[{"Complement", "[", RowBox[{"neighbors", ",", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ StyleBox["at", FontColor->RGBColor[0, 1, 0]], "-", "1"}], "}"}], ",", " ", RowBox[{"{", RowBox[{ StyleBox["at", FontColor->RGBColor[0, 1, 0]], "+", "1"}], "}"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"e", " ", "+=", " ", RowBox[{"Plus", " ", "@@", " ", RowBox[{ StyleBox["j", FontColor->RGBColor[1, 0, 0]], "\[LeftDoubleBracket]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Last", "[", "p", "]"}], "\[LeftDoubleBracket]", StyleBox["at", FontColor->RGBColor[0, 1, 0]], "\[RightDoubleBracket]"}], "-", "1"}], ",", RowBox[{ RowBox[{ RowBox[{"Last", "[", "p", "]"}], "\[LeftDoubleBracket]", "#", "\[RightDoubleBracket]"}], "-", "1"}]}], "\[RightDoubleBracket]"}]}]}], "&"}], " ", "/@", " ", "neighbors"}], ";", "\[IndentingNewLine]", RowBox[{"e", "/", "2"}]}]}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"energy", "[", RowBox[{"p_List", ",", StyleBox[ RowBox[{ StyleBox["j", FontColor->RGBColor[1, 0, 0]], "_List"}]]}], "]"}], ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"etotal", ",", " ", "i"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"etotal", " ", "=", " ", "0.0"}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", " ", RowBox[{ RowBox[{"etotal", " ", "+=", " ", RowBox[{"energyOne", "[", RowBox[{"p", ",", StyleBox["j", FontColor->RGBColor[1, 0, 0]], ",", "i"}], "]"}]}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", RowBox[{"Length", "[", RowBox[{"First", "[", "p", "]"}], "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "etotal"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"twistFold", "[", RowBox[{"p_List", ",", "j_List", ",", "temp_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"newp", ",", "\[CapitalDelta]e"}], "}"}], ",", RowBox[{ RowBox[{"newp", "=", RowBox[{"twistProtein", "[", "p", "]"}]}], ";", RowBox[{"\[CapitalDelta]e", "=", RowBox[{ RowBox[{"energy", "[", RowBox[{"newp", ",", "j"}], "]"}], "-", RowBox[{"energy", "[", RowBox[{"p", ",", "j"}], "]"}]}]}], ";", RowBox[{"Which", "[", RowBox[{ RowBox[{"\[CapitalDelta]e", "\[LessEqual]", "0"}], ",", "newp", ",", RowBox[{ RowBox[{"RandomReal", "[", "]"}], "<", SuperscriptBox["\[ExponentialE]", RowBox[{"-", FractionBox["\[CapitalDelta]e", "temp"]}]]}], ",", "newp", ",", "True", ",", "p"}], "]"}]}]}], "]"}]}], ";"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Example Protein Segment", "Subsubsection"], Cell[BoxData[ RowBox[{"SetDirectory", "[", RowBox[{"NotebookDirectory", "[", "]"}], "]"}]], "Input", CellChangeTimes->{{3.4458859395884237`*^9, 3.44588594841473*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"p1", " ", "=", " ", RowBox[{"newProteinFromFile", "[", RowBox[{"\"\\"", ",", "0"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Dimensions", "[", "p1", "]"}]}], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"p1", " ", "=", " ", RowBox[{"p1", "\[LeftDoubleBracket]", RowBox[{"All", ",", " ", RowBox[{"Range", "[", RowBox[{"1", ",", "20"}], "]"}]}], "\[RightDoubleBracket]"}]}], ";"}], " ", RowBox[{"(*", " ", RowBox[{"first", " ", "20", " ", "amino", " ", "acids"}], " ", "*)"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"showProtein", "[", "p1", "]"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"pEvolution", " ", "=", " ", RowBox[{"NestList", "[", RowBox[{ RowBox[{ RowBox[{"twistFold", "[", RowBox[{"#", ",", "aminoJ", ",", "1.0"}], "]"}], "&"}], ",", " ", "p1", ",", " ", "100"}], "]"}]}], ";"}]], "Input"], Cell[BoxData[{ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"lengthProtein", "/@", "pEvolution"}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}], "\n", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"meanSquareRadius", "/@", "pEvolution"}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}], "\n", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"energy", "[", RowBox[{"#1", ",", "aminoJ"}], "]"}], "&"}], ")"}], "/@", "pEvolution"}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}]}], "Input"], Cell[BoxData[""], "Input"] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["The Eden Cluster", "Section"], Cell[TextData[StyleBox["One of the earliest models of stochastic growth was \ originally developed by biologist Murry Eden (National Institute of Health at \ Bethesda, MD) for simulating the appearance of various biological patterns; \ in particular, bacterial colonies. Although it received little attention from \ biologists, some twenty years later it was adopted by crystallographers, \ solid state researchers, other physicists and chemists. Because of the \ model's flexibility it is being used by them after modifications appropriate \ to the application, in order to simulate their physical study objects under a \ variety of conditions. Only within the last few years has there been any \ interest in using this and similar digital models to represent the possible \ products of biological processes. It is also worth noting that aside from its \ relevance to probabilistically influenced pattern formation, the model has \ possible use in image processing for image compression and as an \ information-lossless way to code, regions, contours, or line segments.", FontVariations->{"CompatibilityType"->0}]], "Text", CellTags->"i:78"], Cell[TextData[StyleBox["Consider the following model for a small cluster of \ tumor cells infect cells on the perimeter of the tumor, and these infect \ other adjacent cells, and so on. At each step in the process, one of the \ perimeter cells is chosen randomly to become infected, after which it is \ added to the cluster and a new perimeter is calculated, from which a new \ infected cell will be chosen in the next step. The resulting tumor growth is \ surprisingly realistic (and rather horrifying to watch as an animation.) \ This model is one of a large group of random processes, variously referred to \ as kinetic growth or percolation models. For your project consider performing \ the Eden model on a 2D square lattice. Initially, only one cell at the origin \ is in the tumor cluster. (See \"Examples and Hints\" below.)", FontVariations->{"CompatibilityType"->0}]], "Text", CellTags->"i:78"], Cell[CellGroupData[{ Cell["Suggested Investigations", "Subsection"], Cell[TextData[{ StyleBox["(a)", FontWeight->"Bold"], " Create an animation of the cluster growth for up to ", Cell[BoxData[ FormBox[ RowBox[{"n", "=", "2000"}], TraditionalForm]]], ", showing only every 20th step. (Use a ", StyleBox["ListPlot", FontFamily->"Courier", FontWeight->"Bold"], " to display the positions.)" }], "Text"], Cell[TextData[{ StyleBox["(b)", FontWeight->"Bold"], " The edge of the tumor cluster is highly corrugated. The length ", Cell[BoxData[ FormBox["L", TraditionalForm]]], " of the perimeter is simply the number of cells in the list ", StyleBox["perim", FontFamily->"Courier", FontWeight->"Bold"], " . Show using a log-log plot that ", Cell[BoxData[ FormBox[ RowBox[{"L", " ", "\[Proportional]", " ", SuperscriptBox["n", "b"]}], TraditionalForm]]], ", and find a value of ", Cell[BoxData[ FormBox["b", TraditionalForm]]], " from your simulation. What value of ", Cell[BoxData[ FormBox["b", TraditionalForm]]], " would you expect if the tumor had a smooth edge?" }], "Text"], Cell[TextData[{ StyleBox["(c)", FontWeight->"Bold"], " The Eden model can be made more realistic by assigning a probability of \ immunity ", Cell[BoxData[ FormBox["p", TraditionalForm]]], " to each member of the perimeter. When a perimeter cell is chosen, use the \ rejection method to determine whether to infect the cell: evaluate a random \ number ", Cell[BoxData[ FormBox["r", TraditionalForm]]], " with ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"0", "<", "r", "<", "1"}], ";"}], TraditionalForm]]], " if ", Cell[BoxData[ FormBox[ RowBox[{"r", "<", "p"}], TraditionalForm]]], ", the cell is not allowed to be infected in any future step: set it aside \ in a new list ", StyleBox["immunes", FontFamily->"Courier", FontWeight->"Bold"], ", which can never enter the tumor cluster, and choose another perimeter \ cell until one is found that can be infected." }], "Text"], Cell[TextData[{ "(i) Reevaluate the improved Eden model taking ", Cell[BoxData[ FormBox[ RowBox[{"p", "=", "0.5"}], TraditionalForm]]], " for all cells and ", Cell[BoxData[ FormBox[ RowBox[{"n", "=", "200"}], TraditionalForm]]], ". Create an animation as in part (a), and reevaluate the exponent ", Cell[BoxData[ FormBox["b", TraditionalForm]]], " for the length of the perimeter (include the immunes in the perimeter). \ Note: If ", Cell[BoxData[ FormBox[ RowBox[{"p", " "}], TraditionalForm]]], "is chosen too large then the tumor has a good probability of not growing, \ as it can be surrounded by immune cells. Did the tumor grow without bound or \ stop?" }], "Text"], Cell[TextData[{ "(ii) Repeat for different values of ", StyleBox["p", FontSlant->"Italic"], " (like", " ", Cell[BoxData[ FormBox[ RowBox[{"p", "=", "0.2"}], TraditionalForm]]], " and ", Cell[BoxData[ FormBox[ RowBox[{"n", "=", "2000"}], TraditionalForm]]], "). Can you determine a relationship between immunity probability (", StyleBox["p", FontSlant->"Italic"], ") and tumor growth? " }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Defining the Eden Model", "Subsection"], Cell[TextData[{ "[MEM: These hints came from my colleagues new book, ", StyleBox["Numerical and Analytical Methods for Scientists and Engineers \ Using Mathematica", FontSlant->"Italic"], ", by Dan Dubin at UCSD.]" }], "Text"], Cell[TextData[{ "Initialize the cluster. Here, ", StyleBox["cluster[i]", FontWeight->"Bold"], " is a list of cells within the cluster at the ", StyleBox["i", FontSlant->"Italic"], "th iteration. To start, at ", StyleBox["i", FontSlant->"Italic"], " = 0, the cluster is" }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"cluster", "[", "0", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], "}"}]}], ";"}]], "Input"], Cell[TextData[{ "We also need a list of the perimeter points of the cluster. Define the list \ ", StyleBox["perim[i]", FontWeight->"Bold"], ", which represents the perimeter after the ", StyleBox["i", FontSlant->"Italic"], "th iteration. " }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"perim", "[", "0", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}]}], ";"}]], "Input"], Cell[TextData[{ "From this perimeter list, a newly-infected cell is chosen at random. We \ define a function ", StyleBox["newsite[n]", FontFamily->"Courier", FontWeight->"Bold"], ", which is the position of this cell, chosen from the previous perimeter \ list, ", StyleBox["perim[n-1]", FontFamily->"Courier", FontWeight->"Bold"], ":" }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"newsite", "[", "n_", "]"}], ":=", RowBox[{ RowBox[{"newsite", "[", "n", "]"}], "=", RowBox[{ RowBox[{"perim", "[", RowBox[{"n", "-", "1"}], "]"}], "\[LeftDoubleBracket]", RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Length", "[", RowBox[{"perim", "[", RowBox[{"n", "-", "1"}], "]"}], "]"}]}], "}"}], "]"}], "\[RightDoubleBracket]"}]}]}]], "Input"], Cell["\<\ The new cluster is the union of the old cluster with the new site:\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"cluster", "[", "n_", "]"}], " ", ":=", " ", RowBox[{ RowBox[{"cluster", "[", "n", "]"}], " ", "=", " ", RowBox[{"Append", "[", RowBox[{ RowBox[{"cluster", "[", RowBox[{"n", "-", "1"}], "]"}], ",", RowBox[{"newsite", "[", "n", "]"}]}], "]"}]}]}]], "Input"], Cell["\<\ Finally, we must calculate the new perimeter, by first removing the new site \ from the old perimeter, and then adding the group of nearest neighbors to the \ new site onto the perimeter (making sure to avoid those nearest neighbors \ already in the cluster):\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"perim", "[", "n_", "]"}], " ", ":=", " ", RowBox[{ RowBox[{"perim", "[", "n", "]"}], "=", " ", RowBox[{ StyleBox["(", FontColor->RGBColor[1, 0, 1]], " ", RowBox[{ RowBox[{"perim1", " ", "=", " ", RowBox[{"Complement", "[", RowBox[{ RowBox[{"perim", "[", RowBox[{"n", "-", "1"}], "]"}], ",", RowBox[{"{", RowBox[{"newsite", "[", "n", "]"}], "}"}]}], "]"}]}], " ", StyleBox[ RowBox[{"(*", " ", RowBox[{ "Removes", " ", "newsite", " ", "from", " ", "the", " ", "perimeter"}], " ", "*)"}], FontColor->RGBColor[0, 1, 0]], ";", "\[IndentingNewLine]", RowBox[{"nn", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"newsite", "[", "n", "]"}], "+", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}], "[", RowBox[{"[", "m", "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"m", ",", "1", ",", "4"}], "}"}]}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"nn", " ", "=", " ", RowBox[{"Complement", "[", RowBox[{"nn", ",", " ", RowBox[{"cluster", "[", "n", "]"}]}], "]"}]}], ";", " ", StyleBox[ RowBox[{"(*", " ", RowBox[{ RowBox[{ "nn", " ", "is", " ", "the", " ", "nearest", " ", "neighbors", " ", "to", " ", "the", " ", "new", " ", "site"}], ",", " ", RowBox[{ "excluding", " ", "those", " ", "in", " ", "the", " ", "cluster"}]}], " ", "*)"}], FontColor->RGBColor[0, 1, 0]], "\[IndentingNewLine]", RowBox[{"Union", "[", RowBox[{"perim1", ",", "nn"}], "]"}]}], " ", StyleBox[ RowBox[{"(*", " ", RowBox[{"Finally", ",", " ", RowBox[{ "add", " ", "nearest", " ", "neighbors", " ", "to", " ", "the", " ", "perimeter", " ", "list", " ", "and", " ", "return", " ", "the", " ", "new", " ", "perimeter", " ", "list"}]}], " ", "*)"}], FontColor->RGBColor[0, 1, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox[")", FontColor->RGBColor[1, 0, 1]]}]}]}]], "Input"], Cell["Example", "Text"], Cell[BoxData[ RowBox[{"cluster", "[", "5", "]"}]], "Input"], Cell[BoxData[ RowBox[{"perim", "[", "5", "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Demo", "Subsection"], Cell["\<\ For example, here are some clusters\[Ellipsis]\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Do", "[", RowBox[{ RowBox[{"cluster", "[", "i", "]"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "1", ",", " ", "1000"}], "}"}]}], "]"}], ";"}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"p1", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"cluster", "[", "1000", "]"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"RGBColor", "[", RowBox[{"0", ",", "1", ",", "1"}], "]"}], ",", RowBox[{"PointSize", "[", "0.01`", "]"}]}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "25"}], ",", "25"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "25"}], ",", "25"}], "}"}]}], "}"}]}], ",", RowBox[{"DisplayFunction", "\[Rule]", "Identity"}]}], "]"}]}], ";", RowBox[{"p2", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"perim", "[", "999", "]"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"RGBColor", "[", RowBox[{"1", ",", "0", ",", "0"}], "]"}], ",", RowBox[{"PointSize", "[", "0.01`", "]"}]}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "25"}], ",", "25"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "25"}], ",", "25"}], "}"}]}], "}"}]}], ",", RowBox[{"DisplayFunction", "\[Rule]", "Identity"}]}], "]"}]}], ";"}], "\n", RowBox[{"Show", "[", RowBox[{"p1", ",", "p2", ",", RowBox[{"DisplayFunction", "\[Rule]", "$DisplayFunction"}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]}], "Input"], Cell[TextData[{ "A few notes: (1) Your cluster is defined once. To reset and compute another \ random cluster you must execute Remove[cluster,perim]. (2) This is an example \ of a ", StyleBox["recursive", FontSlant->"Italic"], " algorthym. ", StyleBox["Mathematica", FontSlant->"Italic"], " has a 256 recursion limit. This means when you compute the ", StyleBox["i", FontSlant->"Italic"], "th cluster, you must of computed (evaluated) the (", StyleBox["i", FontSlant->"Italic"], " \[Dash] 1)th cluster first. In the annimation above, 50-step recursions \ were computed for each ListPlot. " }], "Text"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Diffusion Limited Aggregation (DLA)", "Section"], Cell[TextData[StyleBox["Diffusion limited aggregation (DLA) is another \ example of cluster growth. With a DLA model, the cluster grows by the \ attachment of new cells that precipitate or randomly wander to the cluster. \ This could represent the growth of ice-crystals to make a snow flake, or the \ deposition of materials onto a surface. While the Eden model tends to form \ filled regions with rough surfaces, the DLA model tends to form complex \ cluster with large and deep voids. As matter randomly attaches to a DLA \ cluster, fine, leafy structures are created. ", FontVariations->{"CompatibilityType"->0}]], "Text", CellTags->"i:78"], Cell[TextData[{ StyleBox["Consider the following model for DLA cluster growth. At each step \ in the process, a particle is created at a random location at some outer \ surface. The particle randomly walks until (1) it moves too far away from the \ outersurface, or (2) until it comes into contact with the cluster, after \ which it is added to the cluster. The resulting DLA cluster growth is \ surprisingly realistic (like the Eden cluster). For your project consider \ performing DLA clusters on a 2D square lattice (although it is not at all \ difficult to study 3D cluster growth!) Initially, only one cell at the origin \ is starting cluster. Since particle moves slowly as a random walker (like ", FontVariations->{"CompatibilityType"->0}], Cell[BoxData[ FormBox[ SqrtBox["n"], TraditionalForm]]], "), as the distance that the particle must move to before attaching to the \ cluster increases, so does the calculation time." }], "Text", CellTags->"i:78"], Cell[CellGroupData[{ Cell["Suggested Investigations", "Subsection"], Cell[TextData[{ StyleBox["(a)", FontWeight->"Bold"], " Create an animation of the cluster growth for up to ", Cell[BoxData[ FormBox[ RowBox[{"n", "=", "1000"}], TraditionalForm]]], ", showing only every 20th step. (Use a ", StyleBox["ListPlot", FontFamily->"Courier", FontWeight->"Bold"], " to display the positions.)" }], "Text"], Cell[TextData[{ StyleBox["(b)", FontWeight->"Bold"], " What happens if the particle source is from a point, or a line, (initially \ far from the cluster) instead of a circle surrounding the cluster?" }], "Text"], Cell[TextData[{ StyleBox["(c)", FontWeight->"Bold"], " What if the cluster is initialized by a line instead of a point? Imagine \ the cluster begins with 100 points located along the ", StyleBox["x", FontSlant->"Italic"], "-axis? Imagine other initial conditions, like an array of seed clusters. \ What happens for different initial conditions?" }], "Text"], Cell[TextData[{ StyleBox["(d)", FontWeight->"Bold"], " What is the ", StyleBox["fractal dimension ", FontSlant->"Italic"], "of the cluster? The fractal dimension, ", Cell[BoxData[ FormBox[ SubscriptBox["d", "f"], TraditionalForm]]], ",", " is relatively easy to compute. It is the ratio of the ", Cell[BoxData[ FormBox[ SubscriptBox["d", "f"], TraditionalForm]]], " = log(number of particles)/log(radius). For example, if all of the \ particles were tightly spaced on a 2D surface, the fractal dimension would \ equal to 2. This is because the area of a circle increases with the square of \ the radius. When a 2D cluster is filled with voids, its dimension is ", StyleBox["less than 2.", FontSlant->"Italic"], " (For a 3D DLA cluster, the fractal dimension will be ", StyleBox["less than", FontSlant->"Italic"], " 3.) Can you compute the fractal dimension of your clusters? " }], "Text"], Cell[TextData[{ StyleBox["(e) ", FontWeight->"Bold"], "Can you investigate a 3D cluster?" }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Defining the DLA Algorithm", "Subsection"], Cell[TextData[{ "Initialize the cluster. Here, ", StyleBox["cluster[i]", FontWeight->"Bold"], " is a list of cells within the cluster at the ", StyleBox["i", FontSlant->"Italic"], "th iteration. To start, at ", StyleBox["i", FontSlant->"Italic"], " = 0, the cluster is" }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"cluster", "[", "0", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], "}"}]}], ";"}]], "Input"], Cell[TextData[{ "Let's start new particles at a radius about 10 steps larger than the ", StyleBox["maximum radius", FontSlant->"Italic"], " of the cluster. Therefore, at each cluster size, we will need to compute \ the maximum radius, ", Cell[BoxData[ FormBox[ SqrtBox[ RowBox[{ SuperscriptBox["x", "2"], "+", " ", SuperscriptBox["y", "2"]}]], TraditionalForm]]], ", of the particles contained within the cluster. " }], "Text"], Cell["\<\ We copy (and modify) the algorithm for 2D random walkers from 6-Exercise.nb. \ For this random-walker, we allow particles to move along the diagonals.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"step2D", "[", "]"}], ":=", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}]}], "}"}], "\[LeftDoubleBracket]", RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", "8"}], "}"}], "]"}], "\[RightDoubleBracket]"}]}]], "Input"], Cell[TextData[{ "Finally, we use a ", StyleBox["While[\[Ellipsis]]", FontWeight->"Bold"], " structure to take our random steps. ", "Random steps are taken until (1) the walker returns moves too far away, or \ (2) it comes into contact with the cluster." }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"walk2D", "[", "n_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "maxRadius", ",", "oldLocation", ",", "newLocation", ",", "theStep"}], "}"}], ",", RowBox[{ RowBox[{"maxRadius", "=", RowBox[{"Max", "[", RowBox[{"Apply", "[", RowBox[{ RowBox[{ SqrtBox[ RowBox[{ SuperscriptBox["#1", "2"], "+", SuperscriptBox["#2", "2"]}]], "&"}], ",", RowBox[{"cluster", "[", RowBox[{"n", "-", "1"}], "]"}], ",", RowBox[{"{", "1", "}"}]}], "]"}], "]"}]}], ";", RowBox[{"maxRadius", "=", RowBox[{"Max", "[", RowBox[{"maxRadius", ",", "1"}], "]"}]}], ";", RowBox[{"oldLocation", "=", RowBox[{"Floor", "[", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"maxRadius", "+", "10"}], ")"}], " ", RowBox[{"{", RowBox[{ RowBox[{"Cos", "[", "#1", "]"}], ",", RowBox[{"Sin", "[", "#1", "]"}]}], "}"}]}], "&"}], ")"}], "[", RowBox[{"RandomReal", "[", RowBox[{"{", RowBox[{"0", ",", RowBox[{"2", " ", "\[Pi]"}]}], "}"}], "]"}], "]"}], "]"}]}], ";", RowBox[{"While", "[", RowBox[{ RowBox[{ RowBox[{"theStep", "=", RowBox[{"step2D", "[", "]"}]}], ";", RowBox[{"newLocation", "=", RowBox[{"oldLocation", "+", "theStep"}]}], ";", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"newLocation", ".", "newLocation"}], ">", SuperscriptBox[ RowBox[{"(", RowBox[{"maxRadius", "+", "20"}], ")"}], "2"]}], ",", RowBox[{"newLocation", "=", RowBox[{"Floor", "[", FractionBox[ RowBox[{"oldLocation", " ", SuperscriptBox[ RowBox[{"(", RowBox[{"maxRadius", "+", "10"}], ")"}], "2"]}], RowBox[{"newLocation", ".", "newLocation"}]], "]"}]}]}], "]"}], ";", RowBox[{ RowBox[{ RowBox[{"{", "newLocation", "}"}], "\[Intersection]", RowBox[{"(", RowBox[{"cluster", "[", RowBox[{"n", "-", "1"}], "]"}], ")"}]}], "\[Equal]", RowBox[{"{", "}"}]}]}], ",", RowBox[{"oldLocation", "=", "newLocation"}]}], "]"}], ";", RowBox[{ RowBox[{"cluster", "[", "n", "]"}], "=", RowBox[{ RowBox[{"{", "oldLocation", "}"}], "\[Union]", RowBox[{"cluster", "[", RowBox[{"n", "-", "1"}], "]"}]}]}], ";"}]}], "]"}]}]], "Input"], Cell[TextData[{ "A few notes: (1) You can reset and compute another random cluster just by \ re-evaluating a sequence of calls to ", StyleBox["walk2D[i]", FontWeight->"Bold"], ". (2) You could try to speed up the algorithm by applying a \"bias\" to \ each step. If the random walk moves to larger radius (and away from the \ cluster) do not accept this step as frequently as when the random walk moves \ to smaller radii. " }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Demo", "Subsection"], Cell[BoxData[ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Do", "[", RowBox[{ RowBox[{"walk2D", "[", "i", "]"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "1", ",", " ", "250"}], "}"}]}], "]"}], ";"}], " ", ")"}], " ", "//", " ", "Timing", " ", StyleBox[ RowBox[{"(*", " ", RowBox[{ RowBox[{"This", " ", "takes", " ", "awhile"}], "..."}], "*)"}], FontColor->RGBColor[0, 1, 0]]}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"cluster", "[", "250", "]"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"RGBColor", "[", RowBox[{"0", ",", "0", ",", "1"}], "]"}], ",", RowBox[{"PointSize", "[", "0.02`", "]"}]}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}], ",", RowBox[{ "PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Fractal Trees", "Section"], Cell[TextData[{ StyleBox["Speaking of fractals, nature is full of them! Trees, flowers, and \ especially ferns are tremendously beautiful. They exhibit regularity of \ pattern, yet each is unique. There is an inherent ", FontVariations->{"CompatibilityType"->0}], StyleBox["randomness", FontSlant->"Italic", FontVariations->{"CompatibilityType"->0}], StyleBox[" in natural fractals that can be represented by simple computer \ programs using random numbers. ", FontVariations->{"CompatibilityType"->0}] }], "Text", CellTags->"i:78"], Cell[TextData[{ "Algorithms for constructing fractals involve the scaling of one point to \ another. Let ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ FormBox[ RowBox[{"{", SubscriptBox["x", "i"]}], TraditionalForm], ",", SubscriptBox["y", "i"]}], "}"}], TraditionalForm]]], " be one point, and ", StyleBox["s", FontSlant->"Italic"], " be a scaling function that maps this point to another, ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ FormBox[ RowBox[{"{", SubscriptBox["x", RowBox[{"i", "+", "1"}]]}], TraditionalForm], ",", SubscriptBox["y", RowBox[{"i", "+", "1"}]]}], "}"}], TraditionalForm]]], StyleBox[" = ", FontWeight->"Bold"], StyleBox["s", FontSlant->"Italic"], "(", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ FormBox[ RowBox[{"{", SubscriptBox["x", "i"]}], TraditionalForm], ",", SubscriptBox["y", "i"]}], "}"}], TraditionalForm]]], "). When ", StyleBox["s", FontSlant->"Italic"], " > 1, an amplification occurs. When ", StyleBox["s < ", FontSlant->"Italic"], "1, a reduction occurs. In general, our mappings can also involve a ", StyleBox["translation", FontSlant->"Italic"], ", ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ FormBox[ RowBox[{"{", SubscriptBox["x", RowBox[{"i", "+", "1"}]]}], TraditionalForm], ",", SubscriptBox["y", RowBox[{"i", "+", "1"}]]}], "}"}], TraditionalForm]]], StyleBox[" = ", FontWeight->"Bold"], StyleBox["s", FontSlant->"Italic"], "(", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ FormBox[ RowBox[{"{", SubscriptBox["x", "i"]}], TraditionalForm], ",", SubscriptBox["y", "i"]}], "}"}], TraditionalForm]]], ") + ", Cell[BoxData[ FormBox[ RowBox[{"{", RowBox[{ SubscriptBox["a", "x"], ",", " ", SubscriptBox["a", "y"]}], "}"}], TraditionalForm]]], ", and/or a ", StyleBox["rotation", FontSlant->"Italic"], ", ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ FormBox[ RowBox[{"{", SubscriptBox["x", RowBox[{"i", "+", "1"}]]}], TraditionalForm], ",", SubscriptBox["y", RowBox[{"i", "+", "1"}]]}], "}"}], TraditionalForm]]], StyleBox[" = ", FontWeight->"Bold"], StyleBox["s", FontSlant->"Italic"], "(", StyleBox["M", FontWeight->"Bold"], "\[CenterDot]", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ FormBox[ RowBox[{"{", SubscriptBox["x", "i"]}], TraditionalForm], ",", SubscriptBox["y", "i"]}], "}"}], TraditionalForm]]], ") + ", Cell[BoxData[ FormBox[ RowBox[{"{", RowBox[{ SubscriptBox["a", "x"], ",", " ", SubscriptBox["a", "y"]}], "}"}], TraditionalForm]]], ", where ", StyleBox["M", FontWeight->"Bold"], " is a 2\[Times]2 rotation matrix. The entire set of transformations, \ scaling, rotations, and translations, define a so-called ", StyleBox["affine transformation", FontSlant->"Italic"], ". (The word \"affine\" denotes a close relationship between successive \ points. After an affine transformation, points originally along a line, \ remain on a line. And the ratios of distances between points remain constant. \ In other words, only rotations, scalings, and (finite) translations are \ allowed.) What is important in affine transformations is that the object \ created with these rules turn out to be self-similar. Each new point leads to \ new parts of the object that bare the same relation to the previous points. \ This creates the fractal: an object that appears self-similar at many scale \ sizes. Whereas unbiased random walks with equal step sizes model diffusion, \ when the random walks involve scale-sizing, the overall size ", StyleBox["does not increase", FontSlant->"Italic"], " as more steps are taken. " }], "Text"], Cell[CellGroupData[{ Cell["A Tree", "Subsubsection"], Cell["\<\ Below are six transformations that create a nice \"tree\". From the first to \ the sixth, the transformations are applied with probabilities: 10%, 10%,20%, \ 20%, 20%, 20%. The tree is constructed by making a \"random walk\" with each \ step being one of six possible affine transformations.\ \>", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "1", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", " ", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0.6"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "1", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{"0.0", ",", "0.0"}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "2", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "0.5"}]}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "2", "]"}], "=", " ", RowBox[{"{", RowBox[{"0", ",", "1.0"}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "3", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.46", ",", RowBox[{"-", "0.15"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.39", ",", "0.38"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "3", "]"}], "=", " ", RowBox[{"{", RowBox[{"0", ",", "0.6"}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "4", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.47", ",", RowBox[{"-", "0.15"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.17", ",", "0.42"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "4", "]"}], "=", " ", RowBox[{"{", RowBox[{"0", ",", "1.1"}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "5", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.43", ",", "0.28"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.25"}], ",", "0.45"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "5", "]"}], "=", " ", RowBox[{"{", RowBox[{"0", ",", "1.0"}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "6", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.42", ",", "0.26"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.35"}], ",", "0.31"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "6", "]"}], "=", " ", RowBox[{"{", RowBox[{"0", ",", "0.7"}], "}"}]}], ";"}]}], "Input"], Cell["\<\ What happens as you change the coefficients of the transformations?\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Barnsley's Fern", "Subsubsection"], Cell[TextData[{ "The Barnsley Fern is a famous fractal constructed from a (random) mixture \ of four affine transformations. The matrices, ", Cell[BoxData[ FormBox[ SubscriptBox["M", "i"], TraditionalForm]]], ", scale and rotate coordinates. The translation vectors, ", Cell[BoxData[ FormBox[ SubscriptBox["a", "i"], TraditionalForm]]], ", move points a distance appropriate to the scaling and translation. Which \ transformation is applied is determined by a random number and a pre-set \ probability. Transformation 1 occurs only 2% of the time. Transformation 2 \ only 15% of the time; transformation 3 only 13% of the time; and the fourth \ transformation 70%." }], "Text"], Cell["\<\ Once the four transformations are defined, the fern is created by taking a \ \"random walk\" to finer and finer scales. As the walk continues, the fern is \ constructed with finer and finer details.\ \>", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "1", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", " ", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0.27"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "1", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{"0.5", ",", "0.0"}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "2", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.139"}], ",", " ", "0.263"}], "}"}], ",", RowBox[{"{", RowBox[{"0.246", ",", "0.224"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "2", "]"}], "=", " ", RowBox[{"{", RowBox[{"0.57", ",", RowBox[{"-", "0.036"}]}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "3", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.17", ",", RowBox[{"-", "0.215"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.222", ",", "0.176"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "3", "]"}], "=", " ", RowBox[{"{", RowBox[{"0.408", ",", "0.0893"}], "}"}]}], ";"}]}], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"m", "[", "4", "]"}], " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.781", ",", "0.034"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.032"}], ",", "0.739"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"a", "[", "4", "]"}], "=", " ", RowBox[{"{", RowBox[{"0.1075", ",", "0.27"}], "}"}]}], ";"}]}], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Suggested Investigations", "Subsection"], Cell[TextData[{ StyleBox["(a)", FontWeight->"Bold"], " Create an animation of the fractal construction for many steps (maybe ", Cell[BoxData[ FormBox[ RowBox[{"n", "=", "5000"}], TraditionalForm]]], "), showing only every 50th step. How does the fractal grow?" }], "Text"], Cell[TextData[{ StyleBox["(b)", FontWeight->"Bold"], " How does the fractal change it's shape for small changes in the affine \ transformation?" }], "Text"], Cell[TextData[{ StyleBox["(c)", FontWeight->"Bold"], " What is the ", StyleBox["fractal dimension ", FontSlant->"Italic"], "of the fractal? The fractal dimension, ", Cell[BoxData[ FormBox[ SubscriptBox["d", "f"], TraditionalForm]]], ", is relatively easy to compute. It is the ratio of the ", Cell[BoxData[ FormBox[ SubscriptBox["d", "f"], TraditionalForm]]], " = log(number of particles)/log(radius). For these fractals, it may be \ better to use squares instead of circles. For squares, ", Cell[BoxData[ FormBox[ SubscriptBox["d", "f"], TraditionalForm]]], " = log(number of particles)/log(side). As the side of the square decreases, \ the number of particles within a square should decrease as ", Cell[BoxData[ FormBox[ SuperscriptBox["s", "2"], TraditionalForm]]], " for a 2D object and as ", StyleBox["s", FontSlant->"Italic"], " for a 1D object.", ". Since fractal does not fully fill the 2D plane, the fractal dimension \ will be ", StyleBox["less than 2.", FontSlant->"Italic"], " (For a 3D fractal, the fractal dimension will be ", StyleBox["less than", FontSlant->"Italic"], " 3.) Can you compute the fractal dimension of your objects? " }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Demo", "Subsection"], Cell["\<\ The Barnsley Fern is a random walk with each step one of four possible affine \ transformations.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"affineStep", "[", RowBox[{"{", RowBox[{"x_", ",", "y_"}], "}"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"iSelect", ",", "ranNum"}], "}"}], ",", RowBox[{ RowBox[{"ranNum", "=", RowBox[{"RandomReal", "[", "]"}]}], ";", RowBox[{"iSelect", "=", RowBox[{"Which", "[", RowBox[{ RowBox[{"ranNum", "<", "0.02`"}], ",", "1", ",", RowBox[{"ranNum", "<", "0.17`"}], ",", "2", ",", RowBox[{"ranNum", "<", "0.3`"}], ",", "3", ",", "True", ",", "4"}], "]"}]}], ";", RowBox[{ RowBox[{ RowBox[{"m", "[", "iSelect", "]"}], ".", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], "+", RowBox[{"a", "[", "iSelect", "]"}]}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"barnsley", " ", "=", " ", RowBox[{"NestList", "[", RowBox[{"affineStep", ",", " ", RowBox[{"{", RowBox[{"0.5", ",", "0.0"}], "}"}], ",", " ", "2000"}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{"barnsley", ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"RGBColor", "[", RowBox[{"0", ",", "1", ",", "0"}], "]"}], ",", RowBox[{"PointSize", "[", "0.002`", "]"}]}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"barnsley", " ", "=", " ", RowBox[{"NestList", "[", RowBox[{"affineStep", ",", " ", RowBox[{"{", RowBox[{"0.5", ",", "0.0"}], "}"}], ",", " ", "20000"}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{"barnsley", ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"RGBColor", "[", RowBox[{"0", ",", "1", ",", "0"}], "]"}], ",", RowBox[{"PointSize", "[", "0.002`", "]"}]}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"%", ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.5`", ",", "0.7`"}], "}"}], ",", RowBox[{"{", RowBox[{"0.25`", ",", "0.5`"}], "}"}]}], "}"}]}]}], "]"}]], "Input"], Cell[CellGroupData[{ Cell["Computing fractal dimension (Box Count)", "Subsubsection"], Cell["Determine the overall size of the fractal...", "Text"], Cell[BoxData[ RowBox[{"Dimensions", "[", "barnsley", "]"}]], "Input"], Cell[BoxData[ RowBox[{"xmin", " ", "=", " ", RowBox[{"Min", "[", RowBox[{"First", "[", RowBox[{"Transpose", "[", "barnsley", "]"}], "]"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"xmax", " ", "=", " ", RowBox[{"Max", "[", RowBox[{"First", "[", RowBox[{"Transpose", "[", "barnsley", "]"}], "]"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"ymin", " ", "=", " ", RowBox[{"Min", "[", RowBox[{"Last", "[", RowBox[{"Transpose", "[", "barnsley", "]"}], "]"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"ymax", " ", "=", " ", RowBox[{"Max", "[", RowBox[{"Last", "[", RowBox[{"Transpose", "[", "barnsley", "]"}], "]"}], "]"}]}]], "Input"], Cell["How many boxes?", "Text"], Cell[BoxData[ RowBox[{"boxDim", " ", "=", " ", RowBox[{ RowBox[{"2", "^", "7"}], " ", "+", " ", "1"}]}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"xCoord", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"xmin", " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{"xmax", "-", "xmin"}], ")"}], " ", RowBox[{ RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}], "/", RowBox[{"(", RowBox[{"boxDim", "-", "1"}], ")"}]}]}]}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "1", ",", " ", "boxDim"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"yCoord", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"ymin", " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{"ymax", "-", "ymin"}], ")"}], RowBox[{ RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}], "/", RowBox[{"(", RowBox[{"boxDim", "-", "1"}], ")"}]}]}]}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "1", ",", " ", "boxDim"}], "}"}]}], "]"}]}], ";"}]}], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"countBox", "[", RowBox[{ RowBox[{"{", RowBox[{"xmin_", ",", "xmax_"}], "}"}], ",", RowBox[{"{", RowBox[{"ymin_", ",", "ymax_"}], "}"}]}], "]"}], " ", ":=", " ", RowBox[{"Length", "[", RowBox[{"Select", "[", RowBox[{"barnsley", ",", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{"xmin", " ", "\[LessEqual]", " ", RowBox[{"#", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], " ", "\[LessEqual]", " ", "xmax"}], ")"}], " ", "&&", " ", RowBox[{"(", RowBox[{"ymin", " ", "\[LessEqual]", " ", RowBox[{"#", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], " ", "\[LessEqual]", " ", "ymax"}], ")"}]}], ")"}], "&"}]}], "]"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"countBox", "[", RowBox[{ RowBox[{"{", RowBox[{"xmin", ",", "xmax"}], "}"}], ",", RowBox[{"{", RowBox[{"ymin", ",", "ymax"}], "}"}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"countSize", "[", "iSize_", "]"}], " ", ":=", " ", RowBox[{"(*", " ", StyleBox[ RowBox[{ RowBox[{"iSize", " ", "=", " ", "1"}], ",", " ", "2", ",", " ", "4", ",", " ", "8", ",", " ", "..."}], FontColor->RGBColor[0, 1, 0]], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"xbox", ",", "ybox", ",", " ", RowBox[{"sum", "=", "0"}], ",", " ", RowBox[{"goodBox", "=", "0"}], ",", " ", "cnt"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Do", "[", RowBox[{ RowBox[{ RowBox[{"xbox", " ", "=", " ", RowBox[{"xCoord", "\[LeftDoubleBracket]", RowBox[{"{", RowBox[{"i", ",", RowBox[{"i", "+", "iSize"}]}], "}"}], "\[RightDoubleBracket]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ybox", " ", "=", " ", RowBox[{"yCoord", "\[LeftDoubleBracket]", RowBox[{"{", RowBox[{"i", ",", RowBox[{"i", "+", "iSize"}]}], "}"}], "\[RightDoubleBracket]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cnt", " ", "=", " ", RowBox[{"countBox", "[", RowBox[{"xbox", ",", "ybox"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"cnt", " ", "\[NotEqual]", " ", "0"}], ",", " ", RowBox[{ RowBox[{"goodBox", " ", "+=", " ", "1"}], ";", RowBox[{"sum", " ", "+=", "cnt"}]}]}], "]"}]}], " ", ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "1", ",", " ", RowBox[{"boxDim", "-", "iSize"}], ",", " ", "iSize"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"goodBox", " ", ">", " ", "0"}], ",", " ", RowBox[{"N", "[", RowBox[{"sum", "/", "goodBox"}], "]"}], ",", " ", "0"}], "]"}]}]}], "]"}]}], "\[IndentingNewLine]"}]], "Input"], Cell[BoxData[ RowBox[{"countList", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{"2", "^", "s"}], ")"}], "/", "boxDim"}], ")"}], ",", " ", RowBox[{"countSize", "[", RowBox[{"2", "^", "s"}], "]"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"s", ",", " ", "0", ",", " ", "7"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Log", "[", "countList", "]"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"PointSize", "[", "0.02`", "]"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"Fit", "[", RowBox[{ RowBox[{"Log", "[", "countList", "]"}], ",", " ", RowBox[{"{", RowBox[{"1", ",", "x"}], "}"}], ",", "x"}], "]"}]], "Input"] }, Closed]] }, Closed]] }, Closed]] }, Open ]] }, WindowSize->{874, 997}, WindowMargins->{{167, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowSelection->True, Magnification->1.25, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (May 21, 2008)", StyleDefinitions->"Classic.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "i:78"->{ Cell[50507, 1490, 1144, 15, 202, "Text", CellTags->"i:78"], Cell[51654, 1507, 907, 12, 160, "Text", CellTags->"i:78"], Cell[64370, 1923, 646, 9, 117, "Text", CellTags->"i:78"], Cell[65019, 1934, 973, 17, 164, "Text", CellTags->"i:78"], Cell[74737, 2243, 544, 12, 75, "Text", CellTags->"i:78"]} } *) (*CellTagsIndex CellTagsIndex->{ {"i:78", 96205, 2983} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 50, 0, 149, "Title"], Cell[643, 25, 212, 5, 84, "Subsubtitle"], Cell[858, 32, 107, 4, 101, "Subsubtitle"], Cell[CellGroupData[{ Cell[990, 40, 31, 0, 62, "Section"], Cell[1024, 42, 2067, 37, 436, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[3128, 84, 49, 0, 28, "Section"], Cell[3180, 86, 280, 5, 75, "Text"], Cell[3463, 93, 2140, 66, 198, "Text"], Cell[CellGroupData[{ Cell[5628, 163, 42, 0, 30, "Subsection"], Cell[5673, 165, 391, 14, 32, "Text"], Cell[CellGroupData[{ Cell[6089, 183, 39, 0, 30, "Subsubsection"], Cell[6131, 185, 572, 20, 40, "Input"], Cell[6706, 207, 340, 10, 41, "Input"], Cell[7049, 219, 681, 19, 74, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[7767, 243, 46, 0, 30, "Subsubsection"], Cell[7816, 245, 102, 3, 40, "Input"], Cell[7921, 250, 538, 14, 90, "Input"], Cell[8462, 266, 478, 15, 41, "Input"], Cell[8943, 283, 683, 19, 74, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[9663, 307, 43, 0, 30, "Subsubsection"], Cell[9709, 309, 824, 29, 72, "Input"], Cell[10536, 340, 2725, 81, 159, "Input"], Cell[13264, 423, 328, 10, 40, "Input"], Cell[13595, 435, 724, 20, 74, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[14368, 461, 26, 0, 30, "Subsection"], Cell[14397, 463, 134, 3, 32, "Text"], Cell[14534, 468, 86, 2, 38, "Input"], Cell[14623, 472, 218, 6, 40, "Input"], Cell[14844, 480, 303, 9, 41, "Input"], Cell[15150, 491, 98, 2, 40, "Input"], Cell[15251, 495, 479, 14, 40, "Input"], Cell[15733, 511, 488, 14, 56, "Input"], Cell[16224, 527, 989, 28, 102, "Input"], Cell[17216, 557, 202, 6, 40, "Input"], Cell[17421, 565, 524, 14, 89, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[17994, 585, 46, 0, 28, "Section"], Cell[18043, 587, 390, 6, 75, "Text"], Cell[18436, 595, 1044, 21, 181, "Text"], Cell[19483, 618, 346, 6, 75, "Text"], Cell[CellGroupData[{ Cell[19854, 628, 46, 0, 30, "Subsection"], Cell[19903, 630, 398, 12, 54, "Text"], Cell[20304, 644, 493, 10, 96, "Text"], Cell[20800, 656, 193, 6, 32, "Text"], Cell[20996, 664, 479, 9, 96, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[21512, 678, 26, 0, 30, "Subsection"], Cell[CellGroupData[{ Cell[21563, 682, 56, 0, 30, "Subsubsection"], Cell[21622, 684, 99, 2, 40, "Input"], Cell[21724, 688, 768, 22, 75, "Input"], Cell[22495, 712, 6160, 130, 585, "Input"], Cell[28658, 844, 526, 14, 58, "Input"], Cell[29187, 860, 1462, 39, 109, "Input"], Cell[30652, 901, 1298, 38, 73, "Input"], Cell[31953, 941, 391, 11, 40, "Input"], Cell[32347, 954, 5054, 144, 224, "Input"], Cell[37404, 1100, 1997, 50, 209, "Input"], Cell[39404, 1152, 258, 7, 41, "Input"], Cell[39665, 1161, 1231, 33, 108, "Input"], Cell[40899, 1196, 718, 20, 58, "Input"], Cell[41620, 1218, 287, 8, 41, "Input"], Cell[41910, 1228, 1108, 29, 107, "Input"], Cell[43021, 1259, 710, 21, 74, "Input"], Cell[43734, 1282, 2528, 69, 142, "Input"], Cell[46265, 1353, 886, 25, 91, "Input"], Cell[47154, 1380, 969, 26, 111, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[48160, 1411, 48, 0, 30, "Subsubsection"], Cell[48211, 1413, 171, 3, 40, "Input"], Cell[48385, 1418, 236, 6, 57, "Input"], Cell[48624, 1426, 369, 11, 40, "Input"], Cell[48996, 1439, 83, 2, 40, "Input"], Cell[49082, 1443, 282, 8, 40, "Input"], Cell[49367, 1453, 1012, 26, 123, "Input"], Cell[50382, 1481, 26, 0, 37, "Input"] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[50469, 1488, 35, 0, 28, "Section"], Cell[50507, 1490, 1144, 15, 202, "Text", CellTags->"i:78"], Cell[51654, 1507, 907, 12, 160, "Text", CellTags->"i:78"], Cell[CellGroupData[{ Cell[52586, 1523, 46, 0, 30, "Subsection"], Cell[52635, 1525, 348, 12, 54, "Text"], Cell[52986, 1539, 705, 22, 77, "Text"], Cell[53694, 1563, 911, 28, 119, "Text"], Cell[54608, 1593, 698, 20, 98, "Text"], Cell[55309, 1615, 421, 17, 55, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[55767, 1637, 45, 0, 30, "Subsection"], Cell[55815, 1639, 231, 6, 54, "Text"], Cell[56049, 1647, 294, 11, 32, "Text"], Cell[56346, 1660, 187, 6, 40, "Input"], Cell[56536, 1668, 260, 9, 54, "Text"], Cell[56799, 1679, 437, 15, 40, "Input"], Cell[57239, 1696, 360, 12, 54, "Text"], Cell[57602, 1710, 477, 14, 41, "Input"], Cell[58082, 1726, 90, 2, 32, "Text"], Cell[58175, 1730, 323, 9, 41, "Input"], Cell[58501, 1741, 284, 5, 75, "Text"], Cell[58788, 1748, 2577, 71, 193, "Input"], Cell[61368, 1821, 23, 0, 32, "Text"], Cell[61394, 1823, 60, 1, 40, "Input"], Cell[61457, 1826, 58, 1, 40, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[61552, 1832, 26, 0, 30, "Subsection"], Cell[61581, 1834, 70, 2, 32, "Text"], Cell[61654, 1838, 215, 7, 40, "Input"], Cell[61872, 1847, 1771, 49, 159, "Input"], Cell[63646, 1898, 618, 17, 96, "Text"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[64313, 1921, 54, 0, 28, "Section"], Cell[64370, 1923, 646, 9, 117, "Text", CellTags->"i:78"], Cell[65019, 1934, 973, 17, 164, "Text", CellTags->"i:78"], Cell[CellGroupData[{ Cell[66017, 1955, 46, 0, 30, "Subsection"], Cell[66066, 1957, 348, 12, 54, "Text"], Cell[66417, 1971, 215, 5, 54, "Text"], Cell[66635, 1978, 365, 9, 54, "Text"], Cell[67003, 1989, 920, 25, 123, "Text"], Cell[67926, 2016, 105, 4, 32, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[68068, 2025, 48, 0, 30, "Subsection"], Cell[68119, 2027, 294, 11, 32, "Text"], Cell[68416, 2040, 187, 6, 40, "Input"], Cell[68606, 2048, 454, 13, 65, "Text"], Cell[69063, 2063, 174, 3, 54, "Text"], Cell[69240, 2068, 912, 31, 57, "Input"], Cell[70155, 2101, 271, 7, 54, "Text"], Cell[70429, 2110, 2733, 77, 314, "Input"], Cell[73165, 2189, 440, 9, 96, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[73642, 2203, 26, 0, 30, "Subsection"], Cell[73671, 2205, 449, 14, 40, "Input"], Cell[74123, 2221, 530, 14, 74, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[74702, 2241, 32, 0, 28, "Section"], Cell[74737, 2243, 544, 12, 75, "Text", CellTags->"i:78"], Cell[75284, 2257, 3909, 142, 278, "Text"], Cell[CellGroupData[{ Cell[79218, 2403, 31, 0, 30, "Subsubsection"], Cell[79252, 2405, 315, 5, 75, "Text"], Cell[79570, 2412, 436, 15, 56, "Input"], Cell[80009, 2429, 447, 16, 56, "Input"], Cell[80459, 2447, 454, 16, 56, "Input"], Cell[80916, 2465, 454, 16, 56, "Input"], Cell[81373, 2483, 454, 16, 56, "Input"], Cell[81830, 2501, 454, 16, 56, "Input"], Cell[82287, 2519, 91, 2, 32, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[82415, 2526, 40, 0, 30, "Subsubsection"], Cell[82458, 2528, 692, 15, 118, "Text"], Cell[83153, 2545, 222, 4, 54, "Text"], Cell[83378, 2551, 434, 15, 56, "Input"], Cell[83815, 2568, 489, 17, 56, "Input"], Cell[84307, 2587, 464, 16, 56, "Input"], Cell[84774, 2605, 464, 16, 56, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[85275, 2626, 46, 0, 30, "Subsection"], Cell[85324, 2628, 284, 8, 54, "Text"], Cell[85611, 2638, 160, 5, 32, "Text"], Cell[85774, 2645, 1209, 36, 150, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[87020, 2686, 26, 0, 30, "Subsection"], Cell[87049, 2688, 120, 3, 32, "Text"], Cell[87172, 2693, 826, 24, 74, "Input"], Cell[88001, 2719, 237, 7, 40, "Input"], Cell[88241, 2728, 433, 11, 74, "Input"], Cell[88677, 2741, 238, 7, 40, "Input"], Cell[88918, 2750, 434, 11, 74, "Input"], Cell[89355, 2763, 292, 9, 40, "Input"], Cell[CellGroupData[{ Cell[89672, 2776, 64, 0, 30, "Subsubsection"], Cell[89739, 2778, 60, 0, 32, "Text"], Cell[89802, 2780, 70, 1, 40, "Input"], Cell[89875, 2783, 170, 4, 40, "Input"], Cell[90048, 2789, 170, 4, 40, "Input"], Cell[90221, 2795, 169, 4, 40, "Input"], Cell[90393, 2801, 169, 4, 40, "Input"], Cell[90565, 2807, 31, 0, 32, "Text"], Cell[90599, 2809, 121, 3, 38, "Input"], Cell[90723, 2814, 1010, 32, 56, "Input"], Cell[91736, 2848, 838, 22, 58, "Input"], Cell[92577, 2872, 194, 6, 40, "Input"], Cell[92774, 2880, 2083, 52, 156, "Input"], Cell[94860, 2934, 442, 13, 40, "Input"], Cell[95305, 2949, 286, 7, 57, "Input"], Cell[95594, 2958, 182, 5, 40, "Input"] }, Closed]] }, Closed]] }, Closed]] }, Open ]] } ] *) (* End of internal cache information *)