(* 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[ 37865, 971] NotebookOptionsPosition[ 33300, 827] NotebookOutlinePosition[ 35053, 883] CellTagsIndexPosition[ 34702, 870] WindowFrame->Normal ContainsDynamic->True *) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Lattice Random Walk in 2D", "DemoTitle", CellChangeTimes->{ 3.35264472118016*^9, {3.35612589519117*^9, 3.35612589920722*^9}, { 3.3708095431478453`*^9, 3.370809544555932*^9}}, CellID->700863240], Cell["", "InitializationSection"], Cell[CellGroupData[{ Cell["", "ManipulateSection"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"rn", ",", "rnmax"}], "}"}], ",", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"rn", ",", "rnmax"}], "}"}], "=", RowBox[{ RowBox[{ RowBox[{"FoldList", "[", RowBox[{"Plus", ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{ RowBox[{"SeedRandom", "[", "seed", "]"}], ";", RowBox[{"RandomChoice", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "}"}], ",", "#"}], "]"}]}]}], "]"}], "&"}], "/@", RowBox[{"{", RowBox[{"n", ",", "max"}], "}"}]}]}], ";", RowBox[{"Graphics", "[", RowBox[{ RowBox[{"If", "[", RowBox[{"arrows", ",", RowBox[{"{", RowBox[{ RowBox[{"Arrowheads", "[", RowBox[{"0.5", "/", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", "rnmax", "]"}], "-", RowBox[{"Min", "[", "rnmax", "]"}]}], ")"}]}], "]"}], ",", RowBox[{"Arrow", "/@", RowBox[{"Partition", "[", RowBox[{"rn", ",", "2", ",", "1"}], "]"}]}]}], "}"}], ",", RowBox[{"Line", "[", "rn", "]"}]}], "]"}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"500", ",", "325"}], "}"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"If", "[", RowBox[{"pr", ",", "All", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", RowBox[{"Sqrt", "[", "max", "]"}]}], ",", RowBox[{"Sqrt", "[", "max", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", RowBox[{"Sqrt", "[", "max", "]"}]}], ",", RowBox[{"Sqrt", "[", "max", "]"}]}], "}"}]}], "}"}]}], "]"}]}]}], "]"}]}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"max", ",", "10000", ",", "\"\\""}], "}"}], ",", RowBox[{"10", "^", RowBox[{"Range", "[", RowBox[{"2", ",", "5"}], "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"n", ",", "50", ",", "\"\\""}], "}"}], ",", "1", ",", "max", ",", "1"}], "}"}], ",", "Delimiter", ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"seed", ",", "1234", ",", "\"\\""}], "}"}], ",", "1000", ",", "100000", ",", "1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"arrows", ",", "False", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"True", ",", "False"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"pr", ",", "False", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"True", ",", "False"}], "}"}]}], "}"}]}], "]"}]], "Input", CellChangeTimes->{ 3.35264472582699*^9, {3.36326564440625*^9, 3.36326569646875*^9}, { 3.36940797690417*^9, 3.36940797737487*^9}, {3.36940813268594*^9, 3.36940817128336*^9}, {3.36940823248442*^9, 3.36940827020053*^9}, { 3.36940842019468*^9, 3.36940845305308*^9}, {3.36940857122117*^9, 3.36940860219737*^9}, {3.36941033599315*^9, 3.3694103382461*^9}, { 3.370809495266419*^9, 3.370809512439424*^9}, {3.370809574497644*^9, 3.370809633741469*^9}, {3.370809817896118*^9, 3.3708098404976254`*^9}, { 3.3708112451597023`*^9, 3.370811246087771*^9}, {3.370811387841374*^9, 3.370811388253983*^9}, {3.3714326566780176`*^9, 3.371432675756509*^9}}, CellID->1496021318], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`arrows$$ = False, $CellContext`max$$ = 100, $CellContext`n$$ = 41, $CellContext`pr$$ = False, $CellContext`seed$$ = 1234, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`max$$], 100, "maximum steps"}, {100, 1000, 10000, 100000}}, {{ Hold[$CellContext`n$$], 41, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, {{ Hold[$CellContext`seed$$], 1234, "new random walk"}, 1000, 100000, 1}, {{ Hold[$CellContext`arrows$$], False, "show arrows"}, {True, False}}, {{ Hold[$CellContext`pr$$], False, "shrink to fit"}, {True, False}}}, Typeset`size$$ = {500., {160., 165.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`max$48759$$ = 0, $CellContext`n$48760$$ = 0, $CellContext`seed$48761$$ = 0, $CellContext`arrows$48762$$ = False, $CellContext`pr$48763$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`arrows$$ = False, $CellContext`max$$ = 100, $CellContext`n$$ = 41, $CellContext`pr$$ = False, $CellContext`seed$$ = 1234}, "ControllerVariables" :> { Hold[$CellContext`max$$, $CellContext`max$48759$$, 0], Hold[$CellContext`n$$, $CellContext`n$48760$$, 0], Hold[$CellContext`seed$$, $CellContext`seed$48761$$, 0], Hold[$CellContext`arrows$$, $CellContext`arrows$48762$$, False], Hold[$CellContext`pr$$, $CellContext`pr$48763$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Module[{$CellContext`rn$, $CellContext`rnmax$}, {$CellContext`rn$, \ $CellContext`rnmax$} = Map[FoldList[ Plus, {0, 0}, SeedRandom[$CellContext`seed$$]; RandomChoice[{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}, #]]& , {$CellContext`n$$, $CellContext`max$$}]; Graphics[ If[$CellContext`arrows$$, { Arrowheads[ 0.5/(Max[$CellContext`rnmax$] - Min[$CellContext`rnmax$])], Map[Arrow, Partition[$CellContext`rn$, 2, 1]]}, Line[$CellContext`rn$]], ImageSize -> {500, 325}, PlotRange -> If[$CellContext`pr$$, All, {{-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}, {-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}}]]], "Specifications" :> {{{$CellContext`max$$, 100, "maximum steps"}, {100, 1000, 10000, 100000}}, {{$CellContext`n$$, 41, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, Delimiter, {{$CellContext`seed$$, 1234, "new random walk"}, 1000, 100000, 1}, {{$CellContext`arrows$$, False, "show arrows"}, { True, False}}, {{$CellContext`pr$$, False, "shrink to fit"}, { True, False}}}, "Options" :> {ControllerLinking -> True}, "DefaultOptions" :> {}], ImageSizeCache->{544., {255., 260.}}], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", GeneratedCell->False, CellAutoOverwrite->False, CellID->314179704] }, {2}]] }, Open ]], Cell[CellGroupData[{ Cell["", "ManipulateCaptionSection"], Cell["\<\ At each step, the walk goes randomly a unit distance along one of the four \ possible 2D coordinate directions. \ \>", "ManipulateCaption", CellChangeTimes->{ 3.35696210375764*^9, {3.3714320211033144`*^9, 3.371432070698017*^9}, { 3.371432713288479*^9, 3.3714327197417283`*^9}}, CellID->70610328] }, Open ]], Cell[CellGroupData[{ Cell["", "ThumbnailSection"], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`arrows$$ = False, $CellContext`max$$ = 10000, $CellContext`n$$ = 3784, $CellContext`pr$$ = True, $CellContext`seed$$ = 1234, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`max$$], 10000, "maximum steps"}, {100, 1000, 10000, 100000}}, {{ Hold[$CellContext`n$$], 5053, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, {{ Hold[$CellContext`seed$$], 1234, "new random walk"}, 1000, 100000, 1}, {{ Hold[$CellContext`arrows$$], False, "show arrows"}, {True, False}}, {{ Hold[$CellContext`pr$$], False, "shrink to fit"}, {True, False}}}, Typeset`size$$ = {500., {160., 165.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`max$48831$$ = 0, $CellContext`n$48832$$ = 0, $CellContext`seed$48833$$ = 0, $CellContext`arrows$48834$$ = False, $CellContext`pr$48835$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`arrows$$ = False, $CellContext`max$$ = 10000, $CellContext`n$$ = 5053, $CellContext`pr$$ = False, $CellContext`seed$$ = 1234}, "ControllerVariables" :> { Hold[$CellContext`max$$, $CellContext`max$48831$$, 0], Hold[$CellContext`n$$, $CellContext`n$48832$$, 0], Hold[$CellContext`seed$$, $CellContext`seed$48833$$, 0], Hold[$CellContext`arrows$$, $CellContext`arrows$48834$$, False], Hold[$CellContext`pr$$, $CellContext`pr$48835$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Module[{$CellContext`rn$, $CellContext`rnmax$}, {$CellContext`rn$, \ $CellContext`rnmax$} = Map[FoldList[ Plus, {0, 0}, SeedRandom[$CellContext`seed$$]; RandomChoice[{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}, #]]& , {$CellContext`n$$, $CellContext`max$$}]; Graphics[ If[$CellContext`arrows$$, { Arrowheads[ 0.5/(Max[$CellContext`rnmax$] - Min[$CellContext`rnmax$])], Map[Arrow, Partition[$CellContext`rn$, 2, 1]]}, Line[$CellContext`rn$]], ImageSize -> {500, 325}, PlotRange -> If[$CellContext`pr$$, All, {{-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}, {-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}}]]], "Specifications" :> {{{$CellContext`max$$, 10000, "maximum steps"}, { 100, 1000, 10000, 100000}}, {{$CellContext`n$$, 5053, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, Delimiter, {{$CellContext`seed$$, 1234, "new random walk"}, 1000, 100000, 1}, {{$CellContext`arrows$$, False, "show arrows"}, { True, False}}, {{$CellContext`pr$$, False, "shrink to fit"}, { True, False}}}, "Options" :> {ControllerLinking -> True}, "DefaultOptions" :> {}], ImageSizeCache->{544., {255., 260.}}], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", GeneratedCell->False, CellAutoOverwrite->False, CellID->135449672] }, Open ]], Cell[CellGroupData[{ Cell["", "SnapshotsSection"], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`arrows$$ = False, $CellContext`max$$ = 1000, $CellContext`n$$ = 913, $CellContext`pr$$ = False, $CellContext`seed$$ = 12262, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`max$$], 1000, "maximum steps"}, {100, 1000, 10000, 100000}}, {{ Hold[$CellContext`n$$], 913, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, {{ Hold[$CellContext`seed$$], 12262, "new random walk"}, 1000, 100000, 1}, {{ Hold[$CellContext`arrows$$], False, "show arrows"}, {True, False}}, {{ Hold[$CellContext`pr$$], False, "shrink to fit"}, {True, False}}}, Typeset`size$$ = {500., 325.}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`max$48903$$ = 0, $CellContext`n$48904$$ = 0, $CellContext`seed$48905$$ = 0, $CellContext`arrows$48906$$ = False, $CellContext`pr$48907$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`arrows$$ = False, $CellContext`max$$ = 1000, $CellContext`n$$ = 913, $CellContext`pr$$ = False, $CellContext`seed$$ = 12262}, "ControllerVariables" :> { Hold[$CellContext`max$$, $CellContext`max$48903$$, 0], Hold[$CellContext`n$$, $CellContext`n$48904$$, 0], Hold[$CellContext`seed$$, $CellContext`seed$48905$$, 0], Hold[$CellContext`arrows$$, $CellContext`arrows$48906$$, False], Hold[$CellContext`pr$$, $CellContext`pr$48907$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Module[{$CellContext`rn$, $CellContext`rnmax$}, {$CellContext`rn$, \ $CellContext`rnmax$} = Map[FoldList[ Plus, {0, 0}, SeedRandom[$CellContext`seed$$]; RandomChoice[{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}, #]]& , {$CellContext`n$$, $CellContext`max$$}]; Graphics[ If[$CellContext`arrows$$, { Arrowheads[ 0.5/(Max[$CellContext`rnmax$] - Min[$CellContext`rnmax$])], Map[Arrow, Partition[$CellContext`rn$, 2, 1]]}, Line[$CellContext`rn$]], ImageSize -> {500, 325}, PlotRange -> If[$CellContext`pr$$, All, {{-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}, {-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}}]]], "Specifications" :> {{{$CellContext`max$$, 1000, "maximum steps"}, {100, 1000, 10000, 100000}}, {{$CellContext`n$$, 913, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, Delimiter, {{$CellContext`seed$$, 12262, "new random walk"}, 1000, 100000, 1}, {{$CellContext`arrows$$, False, "show arrows"}, { True, False}}, {{$CellContext`pr$$, False, "shrink to fit"}, { True, False}}}, "Options" :> {ControllerLinking -> True}, "DefaultOptions" :> {}], ImageSizeCache->{544., {256., 261.}}], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", GeneratedCell->False, CellAutoOverwrite->False, CellID->182999172], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`arrows$$ = False, $CellContext`max$$ = 10000, $CellContext`n$$ = 9074, $CellContext`pr$$ = False, $CellContext`seed$$ = 24310, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`max$$], 10000, "maximum steps"}, {100, 1000, 10000, 100000}}, {{ Hold[$CellContext`n$$], 9074, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, {{ Hold[$CellContext`seed$$], 24310, "new random walk"}, 1000, 100000, 1}, {{ Hold[$CellContext`arrows$$], False, "show arrows"}, {True, False}}, {{ Hold[$CellContext`pr$$], False, "shrink to fit"}, {True, False}}}, Typeset`size$$ = {500., 325.}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`max$48975$$ = 0, $CellContext`n$48976$$ = 0, $CellContext`seed$48977$$ = 0, $CellContext`arrows$48978$$ = False, $CellContext`pr$48979$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`arrows$$ = False, $CellContext`max$$ = 10000, $CellContext`n$$ = 9074, $CellContext`pr$$ = False, $CellContext`seed$$ = 24310}, "ControllerVariables" :> { Hold[$CellContext`max$$, $CellContext`max$48975$$, 0], Hold[$CellContext`n$$, $CellContext`n$48976$$, 0], Hold[$CellContext`seed$$, $CellContext`seed$48977$$, 0], Hold[$CellContext`arrows$$, $CellContext`arrows$48978$$, False], Hold[$CellContext`pr$$, $CellContext`pr$48979$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Module[{$CellContext`rn$, $CellContext`rnmax$}, {$CellContext`rn$, \ $CellContext`rnmax$} = Map[FoldList[ Plus, {0, 0}, SeedRandom[$CellContext`seed$$]; RandomChoice[{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}, #]]& , {$CellContext`n$$, $CellContext`max$$}]; Graphics[ If[$CellContext`arrows$$, { Arrowheads[ 0.5/(Max[$CellContext`rnmax$] - Min[$CellContext`rnmax$])], Map[Arrow, Partition[$CellContext`rn$, 2, 1]]}, Line[$CellContext`rn$]], ImageSize -> {500, 325}, PlotRange -> If[$CellContext`pr$$, All, {{-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}, {-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}}]]], "Specifications" :> {{{$CellContext`max$$, 10000, "maximum steps"}, { 100, 1000, 10000, 100000}}, {{$CellContext`n$$, 9074, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, Delimiter, {{$CellContext`seed$$, 24310, "new random walk"}, 1000, 100000, 1}, {{$CellContext`arrows$$, False, "show arrows"}, { True, False}}, {{$CellContext`pr$$, False, "shrink to fit"}, { True, False}}}, "Options" :> {ControllerLinking -> True}, "DefaultOptions" :> {}], ImageSizeCache->{544., {256., 261.}}], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", GeneratedCell->False, CellAutoOverwrite->False, CellID->281623397], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`arrows$$ = False, $CellContext`max$$ = 100000, $CellContext`n$$ = 32540, $CellContext`pr$$ = False, $CellContext`seed$$ = 1234, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`max$$], 100000, "maximum steps"}, {100, 1000, 10000, 100000}}, {{ Hold[$CellContext`n$$], 32540, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, {{ Hold[$CellContext`seed$$], 1234, "new random walk"}, 1000, 100000, 1}, {{ Hold[$CellContext`arrows$$], False, "show arrows"}, {True, False}}, {{ Hold[$CellContext`pr$$], False, "shrink to fit"}, {True, False}}}, Typeset`size$$ = {500., 325.}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`max$49047$$ = 0, $CellContext`n$49048$$ = 0, $CellContext`seed$49049$$ = 0, $CellContext`arrows$49050$$ = False, $CellContext`pr$49051$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`arrows$$ = False, $CellContext`max$$ = 100000, $CellContext`n$$ = 32540, $CellContext`pr$$ = False, $CellContext`seed$$ = 1234}, "ControllerVariables" :> { Hold[$CellContext`max$$, $CellContext`max$49047$$, 0], Hold[$CellContext`n$$, $CellContext`n$49048$$, 0], Hold[$CellContext`seed$$, $CellContext`seed$49049$$, 0], Hold[$CellContext`arrows$$, $CellContext`arrows$49050$$, False], Hold[$CellContext`pr$$, $CellContext`pr$49051$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Module[{$CellContext`rn$, $CellContext`rnmax$}, {$CellContext`rn$, \ $CellContext`rnmax$} = Map[FoldList[ Plus, {0, 0}, SeedRandom[$CellContext`seed$$]; RandomChoice[{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}, #]]& , {$CellContext`n$$, $CellContext`max$$}]; Graphics[ If[$CellContext`arrows$$, { Arrowheads[ 0.5/(Max[$CellContext`rnmax$] - Min[$CellContext`rnmax$])], Map[Arrow, Partition[$CellContext`rn$, 2, 1]]}, Line[$CellContext`rn$]], ImageSize -> {500, 325}, PlotRange -> If[$CellContext`pr$$, All, {{-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}, {-Sqrt[$CellContext`max$$], Sqrt[$CellContext`max$$]}}]]], "Specifications" :> {{{$CellContext`max$$, 100000, "maximum steps"}, { 100, 1000, 10000, 100000}}, {{$CellContext`n$$, 32540, "steps taken"}, 1, Dynamic[$CellContext`max$$], 1}, Delimiter, {{$CellContext`seed$$, 1234, "new random walk"}, 1000, 100000, 1}, {{$CellContext`arrows$$, False, "show arrows"}, { True, False}}, {{$CellContext`pr$$, False, "shrink to fit"}, { True, False}}}, "Options" :> {ControllerLinking -> True}, "DefaultOptions" :> {}], ImageSizeCache->{544., {256., 261.}}], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", GeneratedCell->False, CellAutoOverwrite->False, CellID->579172243] }, Open ]], Cell["", "DetailsSection"], Cell["", "ImplementationSection"], Cell[CellGroupData[{ Cell["", "ControlSuggestionsSection"], Cell[BoxData[ TooltipBox[ RowBox[{ CheckboxBox[True], Cell[" Resize Images"]}], "\"Click inside an image to reveal its orange resize frame.\\nDrag any of \ the orange resize handles to resize the image.\"", ActionDelay->0.35]], "ControlSuggestions", FontFamily->"Verdana", CellTags->"ResizeImages"], Cell[BoxData[ TooltipBox[ RowBox[{ CheckboxBox[False], Cell[" Rotate and Zoom in 3D"]}], RowBox[{ "\"Drag a 3D graphic to rotate it. Starting the drag near the center \ tumbles\\nthe graphic; starting near a corner turns it parallel to the plane \ of the screen.\\nHold down \"", FrameBox[ "Ctrl", Background -> GrayLevel[0.9], FrameMargins -> 2, FrameStyle -> GrayLevel[0.9]], "\" (or \"", FrameBox[ "Cmd", Background -> GrayLevel[0.9], FrameMargins -> 2, FrameStyle -> GrayLevel[0.9]], "\" on Mac) and drag up and down to zoom.\""}], ActionDelay->0.35]], "ControlSuggestions", FontFamily->"Verdana", CellTags->"RotateAndZoomIn3D"], Cell[BoxData[ TooltipBox[ RowBox[{ CheckboxBox[False], Cell[" Drag Locators"]}], RowBox[{"\"Drag any locator (\"", GraphicsBox[ LocatorBox[ Scaled[{0.5, 0.5}]], ImageSize -> 20], "\", etc.) to move it around.\""}], ActionDelay->0.35]], "ControlSuggestions", FontFamily->"Verdana", CellTags->"DragLocators"], Cell[BoxData[ TooltipBox[ RowBox[{ CheckboxBox[False], Cell[" Create and Delete Locators"]}], RowBox[{"\"Insert a new locator in the graphic by holding down the \"", FrameBox[ "Alt", Background -> GrayLevel[0.9], FrameMargins -> 2, FrameStyle -> GrayLevel[0.9]], "\" key\\nand clicking where you want it to be. Delete a locator by \ clicking it\\nwhile holding down the \"", FrameBox[ "Alt", Background -> GrayLevel[0.9], FrameMargins -> 2, FrameStyle -> GrayLevel[0.9]], "\" key.\""}], ActionDelay->0.35]], "ControlSuggestions", FontFamily->"Verdana", CellTags->"CreateAndDeleteLocators"], Cell[BoxData[ TooltipBox[ RowBox[{ CheckboxBox[True], Cell[" Slider Zoom"]}], RowBox[{"\"Hold down the \"", FrameBox[ "Alt", Background -> GrayLevel[0.9], FrameMargins -> 2, FrameStyle -> GrayLevel[0.9]], "\" key while moving a slider to make fine adjustments in the slider \ value.\\nHold \"", FrameBox[ "Ctrl", Background -> GrayLevel[0.9], FrameMargins -> 2, FrameStyle -> GrayLevel[0.9]], "\" and/or \"", FrameBox[ "Shift", Background -> GrayLevel[0.9], FrameMargins -> 2, FrameStyle -> GrayLevel[0.9]], "\" at the same time as \"", FrameBox[ "Alt", Background -> GrayLevel[0.9], FrameMargins -> 2, FrameStyle -> GrayLevel[0.9]], "\" to make ever finer adjustments.\""}], ActionDelay->0.35]], "ControlSuggestions", FontFamily->"Verdana", CellTags->"SliderZoom"], Cell[BoxData[ TooltipBox[ RowBox[{ CheckboxBox[False], Cell[" Gamepad Controls"]}], "\"Control this Demonstration with a gamepad or other\\nhuman interface \ device connected to your computer.\"", ActionDelay->0.35]], "ControlSuggestions", FontFamily->"Verdana", CellTags->"GamepadControls"], Cell[BoxData[ TooltipBox[ RowBox[{ CheckboxBox[False], Cell[" Automatic Animation"]}], RowBox[{"\"Animate a slider in this Demonstration by clicking the\"", AdjustmentBox[ Cell[ GraphicsData[ "CompressedBitmap", "eJzzTSzJSM1NLMlMTlRwL0osyMhMLlZwyy8CCjEzMjAwcIKwAgOI/R/IhBKc\n\ /4EAyGAG0f+nTZsGwgysIJIRKsWKLAXGIHFmEpUgLADxWUAkI24jZs+eTaEt\n\ IG+wQKRmzJgBlYf5lhEA30OqWA=="], "Graphics", ImageSize -> {9, 9}, ImageMargins -> 0], BoxBaselineShift -> 0.1839080459770115, BoxMargins -> {{0., 0.}, {-0.1839080459770115, 0.1839080459770115}}], "\"button\\nnext to the slider, and then clicking the play button that \ appears.\\nAnimate all controls by selecting \"", StyleBox["Autorun", FontWeight -> "Bold"], "\" from the\"", AdjustmentBox[ Cell[ GraphicsData[ "CompressedBitmap", "eJyNULENwyAQfEySIlMwTVJlCGRFsosokeNtqBmDBagoaZjAI1C8/8GUUUC6\n\ 57h7cQ8PvU7Pl17nUav7oj/TPH7V7b2QJAUAXBkKmCPRowxICy64bRvGGNF7\n\ X8CctGoDSN4xhIDGGDhzFXwUh3/ClBKrDQPmnGXtI6u0OOd+tZBVUqy1xSaH\n\ UqiK6pPe4XdEdAz6563tx/gejuORGMxJaz8mdpJn7hc="], "Graphics", ImageSize -> {10, 10}, ImageMargins -> 0], BoxBaselineShift -> 0.1839080459770115, BoxMargins -> {{0., 0.}, {-0.1839080459770115, 0.1839080459770115}}], "\"menu.\""}], ActionDelay->0.35]], "ControlSuggestions", FontFamily->"Verdana", CellTags->"AutomaticAnimation"], Cell[BoxData[ TooltipBox[ RowBox[{ CheckboxBox[False], Cell[" Bookmark Animation"]}], RowBox[{ "\"See a prepared animation of this Demonstration by selecting\\n\"", StyleBox["Animate Bookmarks", FontWeight -> "Bold"], "\" from the\"", AdjustmentBox[ Cell[ GraphicsData[ "CompressedBitmap", "eJyNULENwyAQfEySIlMwTVJlCGRFsosokeNtqBmDBagoaZjAI1C8/8GUUUC6\n\ 57h7cQ8PvU7Pl17nUav7oj/TPH7V7b2QJAUAXBkKmCPRowxICy64bRvGGNF7\n\ X8CctGoDSN4xhIDGGDhzFXwUh3/ClBKrDQPmnGXtI6u0OOd+tZBVUqy1xSaH\n\ UqiK6pPe4XdEdAz6563tx/gejuORGMxJaz8mdpJn7hc="], "Graphics", ImageSize -> {10, 10}, ImageMargins -> 0], BoxBaselineShift -> 0.1839080459770115, BoxMargins -> {{0., 0.}, {-0.1839080459770115, 0.1839080459770115}}], "\"menu.\""}], ActionDelay->0.35]], "ControlSuggestions", FontFamily->"Verdana", CellTags->"BookmarkAnimation"] }, Open ]], Cell[CellGroupData[{ Cell["", "SearchTermsSection"], Cell["stochastic process", "SearchTerms", CellChangeTimes->{ 3.35696210375764*^9, {3.3714320871358323`*^9, 3.3714320941203413`*^9}}, CellID->25098696], Cell["square lattice", "SearchTerms", CellChangeTimes->{ 3.35696210375764*^9, {3.371432095307864*^9, 3.3714320974016542`*^9}, { 3.3714327393046036`*^9, 3.3714327399139905`*^9}}, CellID->531471537], Cell["lattice walk", "SearchTerms", CellChangeTimes->{ 3.35696210375764*^9, {3.371432097620409*^9, 3.371432105089302*^9}}, CellID->371681159], Cell["markov process", "SearchTerms", CellChangeTimes->{ 3.35696210375764*^9, {3.3714321059955697`*^9, 3.371432108339364*^9}}, CellID->29320284], Cell["Brownian motion", "SearchTerms", CellChangeTimes->{ 3.35696210375764*^9, {3.371432457049185*^9, 3.3714324593929796`*^9}}, CellID->439350321] }, Open ]], Cell[CellGroupData[{ Cell["", "RelatedLinksSection"], Cell[TextData[ButtonBox["Random Walk", BaseStyle->"Hyperlink", ButtonData->{ URL["http://mathworld.wolfram.com/RandomWalk.html"], None}]], "RelatedLinks", CellChangeTimes->{ 3.35696210375764*^9, {3.370810639938633*^9, 3.370810664613542*^9}, { 3.370810699314251*^9, 3.370810700667511*^9}}, CellID->1008121416], Cell[TextData[ButtonBox["Random Walk--2-Dimensional", BaseStyle->"Hyperlink", ButtonData->{ URL["http://mathworld.wolfram.com/RandomWalk2-Dimensional.html"], None}]], "RelatedLinks", CellChangeTimes->{ 3.35696210375764*^9, {3.370810708442309*^9, 3.370810750705896*^9}}, CellID->1998147529], Cell[TextData[ButtonBox["Random Walks", BaseStyle->"Hyperlink", ButtonData->{ URL["http://www.wolframscience.com/nksonline/page-977c-text"], None}]], "RelatedLinks", CellChangeTimes->{ 3.35696210375764*^9, {3.36941054495653*^9, 3.36941057509596*^9}}, CellID->542381655] }, Open ]], Cell[CellGroupData[{ Cell["", "AuthorSection"], Cell[TextData[{ "Contributed by: ", ButtonBox["Stephen Wolfram", BaseStyle->"Hyperlink", ButtonData->{ URL["http://demonstrations.wolfram.com/author.html?author=Stephen+\ Wolfram"], None}, ButtonNote-> "http://demonstrations.wolfram.com/author.html?author=Stephen+Wolfram"] }], "Author", CellChangeTimes->{ 3.35696210375764*^9, {3.36941041584762*^9, 3.36941042382806*^9}}, CellID->4722136] }, Open ]], Cell[CellGroupData[{ Cell["", "NotesSection"], Cell["Created by Stephen Wolfram", "RevisionNotes", CellTags->"CreationDate", CellID->1460828470], Cell[TextData[{ "Modified by Catherine Boucher on ", Cell["Thursday", "RevDay"], "\[NegativeThinSpace], ", Cell["March", "RevMonth"], Cell["23", "RevDate"], ", ", Cell["2006", "RevYear"], ", at ", Cell["15:29:35", "RevTime"], "\[LineSeparator]Updated to current template." }], "RevisionNotes", CellID->151748273], Cell[TextData[{ "Modified by Catherine Boucher on ", Cell["Wednesday", "RevDay"], "\[NegativeThinSpace], ", Cell["March", "RevMonth"], Cell["29", "RevDate"], ", ", Cell["2006", "RevYear"], ", at ", Cell["13:12:30", "RevTime"], "\[LineSeparator]Updated to current template." }], "RevisionNotes", CellChangeTimes->{{3.35264475237596*^9, 3.35264475948639*^9}}, CellID->145698146] }, Open ]] }, Open ]] }, WindowSize->{711, 852}, WindowMargins->{{6, Automatic}, {Automatic, 0}}, ShowSelection->True, FrontEndVersion->"6.0 for Microsoft Windows (32-bit) (June 19, 2007)", StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "Demonstration.nb", CharacterEncoding -> "WindowsANSI"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "ResizeImages"->{ Cell[24632, 557, 310, 8, 70, "ControlSuggestions", CellTags->"ResizeImages"]}, "RotateAndZoomIn3D"->{ Cell[24945, 567, 677, 16, 70, "ControlSuggestions", CellTags->"RotateAndZoomIn3D"]}, "DragLocators"->{ Cell[25625, 585, 339, 11, 70, "ControlSuggestions", CellTags->"DragLocators"]}, "CreateAndDeleteLocators"->{ Cell[25967, 598, 636, 15, 70, "ControlSuggestions", CellTags->"CreateAndDeleteLocators"]}, "SliderZoom"->{ Cell[26606, 615, 842, 21, 70, "ControlSuggestions", CellTags->"SliderZoom"]}, "GamepadControls"->{ Cell[27451, 638, 303, 8, 70, "ControlSuggestions", CellTags->"GamepadControls"]}, "AutomaticAnimation"->{ Cell[27757, 648, 1411, 31, 70, "ControlSuggestions", CellTags->"AutomaticAnimation"]}, "BookmarkAnimation"->{ Cell[29171, 681, 881, 21, 70, "ControlSuggestions", CellTags->"BookmarkAnimation"]}, "CreationDate"->{ Cell[32456, 792, 99, 2, 70, "RevisionNotes", CellTags->"CreationDate", CellID->1460828470]} } *) (*CellTagsIndex CellTagsIndex->{ {"ResizeImages", 33691, 839}, {"RotateAndZoomIn3D", 33799, 842}, {"DragLocators", 33908, 845}, {"CreateAndDeleteLocators", 34023, 848}, {"SliderZoom", 34136, 851}, {"GamepadControls", 34241, 854}, {"AutomaticAnimation", 34353, 857}, {"BookmarkAnimation", 34469, 860}, {"CreationDate", 34578, 863} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 206, 4, 70, "DemoTitle", CellID->700863240], Cell[799, 29, 33, 0, 70, "InitializationSection"], Cell[CellGroupData[{ Cell[857, 33, 29, 0, 70, "ManipulateSection"], Cell[CellGroupData[{ Cell[911, 37, 4379, 116, 70, "Input", CellID->1496021318], Cell[5293, 155, 3716, 71, 70, "Output", CellID->314179704] }, {2}]] }, Open ]], Cell[CellGroupData[{ Cell[9055, 232, 36, 0, 70, "ManipulateCaptionSection"], Cell[9094, 234, 313, 7, 70, "ManipulateCaption", CellID->70610328] }, Open ]], Cell[CellGroupData[{ Cell[9444, 246, 28, 0, 70, "ThumbnailSection"], Cell[9475, 248, 3741, 72, 70, "Output", CellID->135449672] }, Open ]], Cell[CellGroupData[{ Cell[13253, 325, 28, 0, 70, "SnapshotsSection"], Cell[13284, 327, 3720, 71, 70, "Output", CellID->182999172], Cell[17007, 400, 3738, 72, 70, "Output", CellID->281623397], Cell[20748, 474, 3742, 72, 70, "Output", CellID->579172243] }, Open ]], Cell[24505, 549, 26, 0, 70, "DetailsSection"], Cell[24534, 551, 33, 0, 70, "ImplementationSection"], Cell[CellGroupData[{ Cell[24592, 555, 37, 0, 70, "ControlSuggestionsSection"], Cell[24632, 557, 310, 8, 70, "ControlSuggestions", CellTags->"ResizeImages"], Cell[24945, 567, 677, 16, 70, "ControlSuggestions", CellTags->"RotateAndZoomIn3D"], Cell[25625, 585, 339, 11, 70, "ControlSuggestions", CellTags->"DragLocators"], Cell[25967, 598, 636, 15, 70, "ControlSuggestions", CellTags->"CreateAndDeleteLocators"], Cell[26606, 615, 842, 21, 70, "ControlSuggestions", CellTags->"SliderZoom"], Cell[27451, 638, 303, 8, 70, "ControlSuggestions", CellTags->"GamepadControls"], Cell[27757, 648, 1411, 31, 70, "ControlSuggestions", CellTags->"AutomaticAnimation"], Cell[29171, 681, 881, 21, 70, "ControlSuggestions", CellTags->"BookmarkAnimation"] }, Open ]], Cell[CellGroupData[{ Cell[30089, 707, 30, 0, 70, "SearchTermsSection"], Cell[30122, 709, 154, 3, 70, "SearchTerms", CellID->25098696], Cell[30279, 714, 203, 4, 70, "SearchTerms", CellID->531471537], Cell[30485, 720, 145, 3, 70, "SearchTerms", CellID->371681159], Cell[30633, 725, 148, 3, 70, "SearchTerms", CellID->29320284], Cell[30784, 730, 150, 3, 70, "SearchTerms", CellID->439350321] }, Open ]], Cell[CellGroupData[{ Cell[30971, 738, 31, 0, 70, "RelatedLinksSection"], Cell[31005, 740, 324, 8, 70, "RelatedLinks", CellID->1008121416], Cell[31332, 750, 302, 7, 70, "RelatedLinks", CellID->1998147529], Cell[31637, 759, 282, 7, 70, "RelatedLinks", CellID->542381655] }, Open ]], Cell[CellGroupData[{ Cell[31956, 771, 25, 0, 70, "AuthorSection"], Cell[31984, 773, 408, 12, 70, "Author", CellID->4722136] }, Open ]], Cell[CellGroupData[{ Cell[32429, 790, 24, 0, 70, "NotesSection"], Cell[32456, 792, 99, 2, 70, "RevisionNotes", CellTags->"CreationDate", CellID->1460828470], Cell[32558, 796, 323, 12, 70, "RevisionNotes", CellID->151748273], Cell[32884, 810, 388, 13, 70, "RevisionNotes", CellID->145698146] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)