(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 50896, 1204] NotebookOptionsPosition[ 46621, 1130] NotebookOutlinePosition[ 47127, 1148] CellTagsIndexPosition[ 47084, 1145] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ StyleBox[ RowBox[{"Monte", " ", "Carlo", " ", "Integration"}], "Title"]], "Input", CellChangeTimes->{{3.480718717359375*^9, 3.480718721421875*^9}},ExpressionUUID->"17d1b58f-ebed-46df-9485-\ 1c02d6ec3666"], Cell[BoxData[ StyleBox[ RowBox[{"Unit", " ", "Circle"}], "Subtitle"]], "Input", CellChangeTimes->{{3.48072255028125*^9, 3.4807225564375*^9}},ExpressionUUID->"ad159b8f-698f-4124-bad1-c4432fb905e3"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"num", " ", "=", "40000"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Clear", "[", "inlist", "]"}], ";", " ", RowBox[{"Clear", "[", "outlist", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"inlist", " ", "=", " ", RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{" ", RowBox[{ RowBox[{"outlist", " ", "=", " ", RowBox[{"{", "}"}]}], ";"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"numin", " ", "=", " ", "0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m", " ", "=", " ", "1"}], ",", " ", RowBox[{"m", " ", "\[LessEqual]", " ", "num"}], ",", " ", RowBox[{"m", "++"}], ",", "\[IndentingNewLine]", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", " ", "=", " ", RowBox[{"2", RowBox[{"(", RowBox[{ RowBox[{"Random", "[", "]"}], "-", ".5"}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"y", " ", "=", " ", RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{"Random", "[", "]"}], "-", ".5"}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"x", "^", "2"}], " ", "+", " ", RowBox[{"y", "^", "2"}]}], " ", "\[LessEqual]", " ", "1"}], ",", RowBox[{"loc", " ", "=", "1"}], ",", RowBox[{"loc", " ", "=", " ", "2"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"loc", " ", "\[Equal]", " ", "1"}], ",", " ", RowBox[{"inlist", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"inlist", ",", " ", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], "]"}]}], ",", " ", RowBox[{"outlist", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"outlist", ",", " ", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"numin", " ", "=", " ", RowBox[{"numin", " ", "+", " ", "2", "-", "loc"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"percentage", "[", "m", "]"}], " ", "=", " ", RowBox[{"1.0", " ", RowBox[{"numin", " ", "/", " ", "m"}]}]}], ";"}], "\[IndentingNewLine]", "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"cut", "[", RowBox[{"dataset_", ",", " ", "number_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", " ", "=", " ", "1"}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", " ", RowBox[{"Floor", "[", "number", "]"}]}], ",", " ", RowBox[{"i", "++"}], ",", " ", RowBox[{"temp", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"temp", ",", RowBox[{"dataset", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "temp", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"cut", "[", RowBox[{"inlist", ",", "5"}], "]"}]}], "Input", CellChangeTimes->{{3.480718756359375*^9, 3.480718785*^9}, { 3.480718818203125*^9, 3.480718879390625*^9}, {3.48071891053125*^9, 3.48071907640625*^9}, {3.48071910921875*^9, 3.480719118375*^9}, { 3.480719205609375*^9, 3.48071925475*^9}, 3.4807218993125*^9, { 3.480722003109375*^9, 3.48072200421875*^9}, {3.480722930015625*^9, 3.480722930140625*^9}, {3.48072297175*^9, 3.48072323671875*^9}, { 3.4807232930625*^9, 3.480723309546875*^9}, 3.480723404703125*^9, { 3.4807235448125*^9, 3.48072354490625*^9}, {3.48072363009375*^9, 3.48072367646875*^9}, 3.48072383046875*^9, 3.480723887671875*^9}, CellLabel-> "In[135]:=",ExpressionUUID->"5f543de9-0319-4899-b07c-4b75984c95e3"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.12837781724084207`", ",", "0.8695794925053273`"}], "}"}], ",", RowBox[{"{", RowBox[{"0.0352250106155354`", ",", RowBox[{"-", "0.03365488134729211`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.5499579564088648`", ",", RowBox[{"-", "0.1511421635971042`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.03799990781849283`"}], ",", "0.8020882327437029`"}], "}"}], ",", RowBox[{"{", RowBox[{"0.17356563393246627`", ",", RowBox[{"-", "0.4018133347442212`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{{3.480723073*^9, 3.48072307825*^9}, {3.480723271546875*^9, 3.480723310953125*^9}, 3.480723406390625*^9, 3.48072356634375*^9, 3.48072370890625*^9, 3.4807238329375*^9, 3.48072391325*^9, 3.480807394859375*^9, 3.8582601602608957`*^9, 3.891459958614377*^9, 3.891502048796543*^9}, CellLabel-> "Out[142]=",ExpressionUUID->"70d08a4e-02ed-41af-a830-8f74d0415787"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"percentage", "[", "7000", "]"}]], "Input", CellChangeTimes->{{3.480723769765625*^9, 3.480723780578125*^9}, { 3.4807240228125*^9, 3.48072402340625*^9}},ExpressionUUID->"dbe287ea-a7c9-4308-b356-\ d70614c69108"], Cell[BoxData["0.7831428571428571`"], "Output", CellChangeTimes->{{3.480723773578125*^9, 3.4807237811875*^9}, { 3.4807240241875*^9, 3.480724051515625*^9}},ExpressionUUID->"0b29c4b9-d0a9-4348-98ff-\ 92a71b153bd8"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", " ", RowBox[{"1.0", " ", "Pi"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"cut", "[", RowBox[{"inlist", ",", "numdo"}], "]"}], ",", " ", RowBox[{"cut", "[", RowBox[{"outlist", ",", "numdo"}], "]"}]}], "}"}], ",", RowBox[{"PlotStyle", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{"Red", ",", "Blue"}], "}"}]}], ",", RowBox[{"AspectRatio", " ", "\[Rule]", " ", "1"}], ",", " ", RowBox[{"PlotLabel", " ", "\[Rule]", " ", RowBox[{"4", " ", RowBox[{"percentage", "[", RowBox[{"Floor", "[", "numdo", "]"}], "]"}]}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"numdo", ",", "20", ",", RowBox[{".2", "num"}]}], "}"}]}], "]"}]}], "Input", CellChangeTimes->{{3.480719159078125*^9, 3.48071916596875*^9}, { 3.480719222265625*^9, 3.480719226828125*^9}, {3.480719265703125*^9, 3.480719308546875*^9}, {3.480719341765625*^9, 3.480719358984375*^9}, { 3.4807213539375*^9, 3.4807214551875*^9}, {3.480721497921875*^9, 3.480721545875*^9}, {3.480721670890625*^9, 3.480721748484375*^9}, { 3.48072181446875*^9, 3.480721818234375*^9}, {3.480721862640625*^9, 3.480721876328125*^9}, {3.48072207096875*^9, 3.480722276921875*^9}, { 3.480723226359375*^9, 3.480723259796875*^9}, {3.480723345375*^9, 3.48072336009375*^9}, {3.48072347065625*^9, 3.48072347134375*^9}, { 3.480723684484375*^9, 3.48072370309375*^9}, 3.4807237513125*^9, { 3.480723803390625*^9, 3.48072380534375*^9}, {3.480723835953125*^9, 3.4807238368125*^9}, 3.480723877078125*^9, {3.48072416025*^9, 3.48072416325*^9}, {3.480724417296875*^9, 3.480724418484375*^9}, { 3.480724460046875*^9, 3.480724477078125*^9}, {3.480807354234375*^9, 3.480807358703125*^9}}, CellLabel->"In[9]:=",ExpressionUUID->"21deabad-9fd5-4213-92f5-f46b46172291"], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Plot of randomly chosen points inside and outside unit circle, \ whose area is \"\>", "\[InvisibleSpace]", "3.141592653589793`"}], SequenceForm[ "Plot of randomly chosen points inside and outside unit circle, whose area \ is ", 3.141592653589793], Editable->False]], "Print", CellChangeTimes->{ 3.4807222800625*^9, 3.480723263296875*^9, 3.480723316140625*^9, 3.480723360796875*^9, 3.480723411875*^9, 3.4807234721875*^9, 3.48072371103125*^9, 3.48072375203125*^9, 3.480723806265625*^9, 3.480723845703125*^9, 3.4807238780625*^9, 3.480723964453125*^9, 3.480724052625*^9, {3.48072413859375*^9, 3.480724163796875*^9}, 3.48072441903125*^9, {3.480724461703125*^9, 3.4807244873125*^9}, 3.4808073591875*^9, 3.480807588046875*^9, 3.858260164343506*^9, 3.891459975105672*^9}, CellLabel-> "During evaluation of \ In[9]:=",ExpressionUUID->"8880b013-6724-4955-b3ca-9abce68270f0"], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`numdo$$ = 2000, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[$CellContext`numdo$$], 20, 8000.}}, Typeset`size$$ = { 360., {183., 188.13819046037338`}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`numdo$$ = 20}, "ControllerVariables" :> {}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> ListPlot[{ $CellContext`cut[$CellContext`inlist, $CellContext`numdo$$], $CellContext`cut[$CellContext`outlist, $CellContext`numdo$$]}, PlotStyle -> {Red, Blue}, AspectRatio -> 1, PlotLabel -> 4 $CellContext`percentage[ Floor[$CellContext`numdo$$]]], "Specifications" :> {{$CellContext`numdo$$, 20, 8000.}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{649., {213.63403328722342`, 219.36596671277658`}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UndoTrackedVariables:>{Typeset`show$$, Typeset`bookmarkMode$$}, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{ 3.48072375209375*^9, 3.4807238063125*^9, 3.480723845765625*^9, 3.480723878109375*^9, 3.480723964515625*^9, 3.4807240526875*^9, { 3.48072413865625*^9, 3.48072416384375*^9}, 3.48072441909375*^9, { 3.480724461765625*^9, 3.480724487390625*^9}, 3.48080735925*^9, 3.480807588109375*^9, {3.4809739070625*^9, 3.48097392171875*^9}, 3.8582601643739834`*^9, 3.8914599752092915`*^9, 3.8915020138666697`*^9}, CellLabel->"Out[10]=",ExpressionUUID->"5be445d2-b26d-48e2-a821-0f510c95805f"] }, Open ]], Cell[BoxData[ RowBox[{"\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.4807225745*^9, 3.4807225748125*^9}, { 3.891502140282503*^9, 3.891502140831526*^9}},ExpressionUUID->"26f1eb00-5813-4bca-bae4-\ 3559fce8a72d"], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{ RowBox[{"Ellipse", " ", RowBox[{"x", "^", "2"}]}], " ", "+", " ", RowBox[{"4", " ", RowBox[{"y", "^", "2"}]}]}], " ", "=", " ", "1"}], "Subtitle"]], "Input", CellChangeTimes->{{3.48072255028125*^9, 3.480722587296875*^9}},ExpressionUUID->"2c9d7b52-079f-42a4-8eec-\ 2560f2c6bea7"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"num2", " ", "=", "40000"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Clear", "[", "inlist2", "]"}], ";", " ", RowBox[{"Clear", "[", "outlist2", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"inlist2", " ", "=", " ", RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{" ", RowBox[{ RowBox[{"outlist2", " ", "=", " ", RowBox[{"{", "}"}]}], ";"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"numin", " ", "=", " ", "0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m", " ", "=", " ", "1"}], ",", " ", RowBox[{"m", " ", "\[LessEqual]", " ", "num2"}], ",", " ", RowBox[{"m", "++"}], ",", "\[IndentingNewLine]", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", " ", "=", " ", RowBox[{"2", RowBox[{"(", RowBox[{ RowBox[{"Random", "[", "]"}], "-", ".5"}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"y", " ", "=", " ", RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{"Random", "[", "]"}], "-", ".5"}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"x", "^", "2"}], " ", "+", " ", RowBox[{"4", " ", RowBox[{"y", "^", "2"}]}]}], " ", "\[LessEqual]", " ", "1"}], ",", RowBox[{"loc", " ", "=", "1"}], ",", RowBox[{"loc", " ", "=", " ", "2"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"loc", " ", "\[Equal]", " ", "1"}], ",", " ", RowBox[{"inlist2", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"inlist2", ",", " ", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], "]"}]}], ",", " ", RowBox[{"outlist2", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"outlist2", ",", " ", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"numin", " ", "=", " ", RowBox[{"numin", " ", "+", " ", "2", "-", "loc"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"percentage2", "[", "m", "]"}], " ", "=", " ", RowBox[{"1.0", " ", RowBox[{"numin", " ", "/", " ", "m"}]}]}], ";"}], "\[IndentingNewLine]", "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"cut", "[", RowBox[{"dataset_", ",", " ", "number_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", " ", "=", " ", "1"}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", " ", RowBox[{"Floor", "[", "number", "]"}]}], ",", " ", RowBox[{"i", "++"}], ",", " ", RowBox[{"temp", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"temp", ",", RowBox[{"dataset", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "temp", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"cut", "[", RowBox[{"inlist2", ",", "5"}], "]"}]}], "Input", CellChangeTimes->{{3.480718756359375*^9, 3.480718785*^9}, { 3.480718818203125*^9, 3.480718879390625*^9}, {3.48071891053125*^9, 3.48071907640625*^9}, {3.48071910921875*^9, 3.480719118375*^9}, { 3.480719205609375*^9, 3.48071925475*^9}, 3.4807218993125*^9, { 3.480722003109375*^9, 3.48072200421875*^9}, {3.480722597203125*^9, 3.480722597515625*^9}, {3.48072266790625*^9, 3.480722682203125*^9}, { 3.48072279078125*^9, 3.48072279096875*^9}, {3.48072390696875*^9, 3.480723952828125*^9}, {3.480724229734375*^9, 3.48072423*^9}, { 3.480807385015625*^9, 3.4808074054375*^9}, 3.4808075395625*^9}, CellLabel-> "In[143]:=",ExpressionUUID->"3054f6f9-8af8-40e6-8e76-6678634c0522"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.577189515437037`"}], ",", "0.0023583638292759`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.580754818019491`"}], ",", "0.28999530009698704`"}], "}"}], ",", RowBox[{"{", RowBox[{"0.6683512177804798`", ",", RowBox[{"-", "0.11306675548069323`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.9399944842285818`"}], ",", "0.12183138438699981`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.6687605126310665`"}], ",", "0.1833159595010745`"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.48072421403125*^9, 3.480724248203125*^9, 3.480807398828125*^9, 3.48080753384375*^9, 3.480807564421875*^9, 3.85826022605009*^9, 3.891459998460666*^9, 3.891502111359033*^9}, CellLabel-> "Out[150]=",ExpressionUUID->"6caed241-2236-49ad-8d37-2a51f53d8db7"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", " ", RowBox[{"1.0", " ", RowBox[{"Pi", "/", "2"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"cut", "[", RowBox[{"inlist2", ",", "numdo"}], "]"}], ",", " ", RowBox[{"cut", "[", RowBox[{"outlist2", ",", "numdo"}], "]"}]}], "}"}], ",", RowBox[{"PlotStyle", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{"Red", ",", "Blue"}], "}"}]}], ",", RowBox[{"AspectRatio", " ", "\[Rule]", " ", "1"}], ",", " ", RowBox[{"PlotLabel", " ", "\[Rule]", " ", RowBox[{"4", " ", RowBox[{"percentage2", "[", RowBox[{"Floor", "[", "numdo", "]"}], "]"}]}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"numdo", ",", "20", ",", RowBox[{".2", "num2"}]}], "}"}]}], "]"}]}], "Input", CellChangeTimes->{{3.480719159078125*^9, 3.48071916596875*^9}, { 3.480719222265625*^9, 3.480719226828125*^9}, {3.480719265703125*^9, 3.480719308546875*^9}, {3.480719341765625*^9, 3.480719358984375*^9}, { 3.4807213539375*^9, 3.4807214551875*^9}, {3.480721497921875*^9, 3.480721545875*^9}, {3.480721670890625*^9, 3.480721748484375*^9}, { 3.48072181446875*^9, 3.480721818234375*^9}, {3.480721862640625*^9, 3.480721876328125*^9}, {3.48072207096875*^9, 3.480722276921875*^9}, { 3.4807226058125*^9, 3.480722613953125*^9}, 3.480722644640625*^9, { 3.4807226856875*^9, 3.480722719609375*^9}, 3.4807227705*^9, { 3.480724180703125*^9, 3.480724199625*^9}, {3.4807243871875*^9, 3.480724398328125*^9}, 3.48080739734375*^9, {3.480807624484375*^9, 3.480807626609375*^9}}, CellLabel-> "In[151]:=",ExpressionUUID->"aa9f8e96-4748-4d34-aaee-d49143c1c931"], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Plot of randomly chosen points inside and outside ellipse x^2 \ + 4 y^2 = 1, whose area is \"\>", "\[InvisibleSpace]", "1.5707963267948966`"}], SequenceForm[ "Plot of randomly chosen points inside and outside ellipse x^2 + 4 y^2 = 1, \ whose area is ", 1.5707963267948966`], Editable->False]], "Print", CellChangeTimes->{ 3.4807222800625*^9, 3.480722646296875*^9, {3.4807226925*^9, 3.480722770828125*^9}, 3.4807228775625*^9, 3.480724217640625*^9, 3.480724253546875*^9, {3.4807243293125*^9, 3.48072435934375*^9}, 3.480724399203125*^9, 3.480807627515625*^9, {3.858260217078809*^9, 3.858260228166994*^9}, 3.891460027561715*^9, 3.891502115804355*^9}, CellLabel-> "During evaluation of \ In[151]:=",ExpressionUUID->"252a0823-5bb7-4463-98cb-6de261c7ba2c"], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`numdo$$ = 9000, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[$CellContext`numdo$$], 20, 8000.}}, Typeset`size$$ = { 360., {183., 188.16525683123712`}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`numdo$$ = 20}, "ControllerVariables" :> {}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> ListPlot[{ $CellContext`cut[$CellContext`inlist2, $CellContext`numdo$$], $CellContext`cut[$CellContext`outlist2, $CellContext`numdo$$]}, PlotStyle -> {Red, Blue}, AspectRatio -> 1, PlotLabel -> 4 $CellContext`percentage2[ Floor[$CellContext`numdo$$]]], "Specifications" :> {{$CellContext`numdo$$, 20, 8000.}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{649., {213.63403328722342`, 219.36596671277658`}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UndoTrackedVariables:>{Typeset`show$$, Typeset`bookmarkMode$$}, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{ 3.480722236578125*^9, 3.480722280109375*^9, 3.48072264634375*^9, { 3.480722692515625*^9, 3.480722770828125*^9}, {3.480722877578125*^9, 3.480722921890625*^9}, 3.480724217671875*^9, {3.480724253546875*^9, 3.48072435934375*^9}, 3.480724399203125*^9, 3.4808076275625*^9, { 3.48080796203125*^9, 3.48080800734375*^9}, {3.4809739258125*^9, 3.48097396275*^9}, {3.4809740905625*^9, 3.48097412834375*^9}, { 3.858260217106982*^9, 3.8582602281951647`*^9}, 3.891460027639797*^9, { 3.8915021158512316`*^9, 3.8915021190663958`*^9}}, CellLabel-> "Out[152]=",ExpressionUUID->"94a397bc-887d-4fb5-b512-07c254cd6261"] }, Open ]], Cell[BoxData[""], "Input", CellChangeTimes->{ 3.48080604271875*^9},ExpressionUUID->"e9999c0f-e28d-4f2b-8537-097f491b78c3"], Cell[BoxData[ StyleBox[ RowBox[{"General", " ", "Region"}], "Subtitle"]], "Input", CellChangeTimes->{{3.48072255028125*^9, 3.480722587296875*^9}, { 3.48080604496875*^9, 3.4808060465625*^9}},ExpressionUUID->"2fb3b8c6-8aef-4091-9922-fbd1730a57bd"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"numn", " ", "=", "40000"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"randpoints", " ", "=", " ", RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m", " ", "=", " ", "1"}], ",", " ", RowBox[{"m", " ", "\[LessEqual]", " ", "numn"}], ",", " ", RowBox[{"m", "++"}], ",", "\[IndentingNewLine]", RowBox[{"randpoints", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"randpoints", ",", " ", RowBox[{"{", RowBox[{ RowBox[{"2", RowBox[{"(", RowBox[{ RowBox[{"Random", "[", "]"}], "-", ".5"}], ")"}]}], ",", " ", RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{"Random", "[", "]"}], "-", ".5"}], ")"}]}]}], "}"}]}], "]"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"randpoints", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}]}], "Input", CellChangeTimes->{{3.4808066425*^9, 3.4808066435625*^9}, 3.480806992734375*^9, {3.48080708915625*^9, 3.480807097640625*^9}, { 3.480807566671875*^9, 3.480807569*^9}, 3.480807666109375*^9}, CellLabel->"In[36]:=",ExpressionUUID->"d5ac1392-03ef-4baf-b436-643e65accdbc"], Cell[BoxData["0.39688228108222146`"], "Output", CellChangeTimes->{{3.480807094171875*^9, 3.48080709865625*^9}, 3.4808076595625*^9, 3.48080770696875*^9, 3.48080781003125*^9, 3.8582602588159776`*^9, 3.891470286655875*^9}, CellLabel->"Out[39]=",ExpressionUUID->"d1aa56b6-6704-4d95-868d-701c5233f42b"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"Clear", "[", "inlistn", "]"}], ";", " ", RowBox[{"Clear", "[", "outlistn", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"inlistn", "=", " ", RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"outlistn", "=", " ", RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"numin", " ", "=", " ", "0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m", " ", "=", " ", "1"}], ",", " ", RowBox[{"m", " ", "\[LessEqual]", " ", "numn"}], ",", " ", RowBox[{"m", "++"}], ",", "\[IndentingNewLine]", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", " ", "=", " ", RowBox[{"randpoints", "[", RowBox[{"[", RowBox[{"m", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"y", " ", "=", " ", RowBox[{"randpoints", "[", RowBox[{"[", RowBox[{"m", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"16", " ", RowBox[{"x", "^", "2"}]}], " ", "-", " ", "1"}], " ", "\[GreaterEqual]", " ", RowBox[{"4", " ", RowBox[{"y", "^", "2"}]}]}], ",", RowBox[{"loc", " ", "=", "1"}], ",", RowBox[{"loc", " ", "=", " ", "2"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"loc", " ", "\[Equal]", " ", "1"}], ",", " ", RowBox[{"inlistn", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"inlistn", ",", " ", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], "]"}]}], ",", " ", RowBox[{"outlistn", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"outlistn", ",", " ", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"numin", " ", "=", " ", RowBox[{"numin", " ", "+", " ", "2", "-", "loc"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"percentagen", "[", "m", "]"}], " ", "=", " ", RowBox[{"1.0", " ", RowBox[{"numin", " ", "/", " ", "m"}]}]}], ";"}], "\[IndentingNewLine]", "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"cut", "[", RowBox[{"dataset_", ",", " ", "number_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", " ", "=", " ", "1"}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", " ", RowBox[{"Floor", "[", "number", "]"}]}], ",", " ", RowBox[{"i", "++"}], ",", " ", RowBox[{"temp", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"temp", ",", RowBox[{"dataset", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "temp", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"cut", "[", RowBox[{"inlistn", ",", "5"}], "]"}]}], "Input", CellChangeTimes->{{3.480718756359375*^9, 3.480718785*^9}, { 3.480718818203125*^9, 3.480718879390625*^9}, {3.48071891053125*^9, 3.48071907640625*^9}, {3.48071910921875*^9, 3.480719118375*^9}, { 3.480719205609375*^9, 3.48071925475*^9}, 3.4807218993125*^9, { 3.480722003109375*^9, 3.48072200421875*^9}, {3.480722597203125*^9, 3.480722597515625*^9}, {3.48072266790625*^9, 3.480722682203125*^9}, { 3.48072279078125*^9, 3.48072279096875*^9}, {3.48072390696875*^9, 3.480723952828125*^9}, {3.480724229734375*^9, 3.48072423*^9}, { 3.480806073953125*^9, 3.480806126046875*^9}, {3.480806598359375*^9, 3.480806641125*^9}, {3.480806760046875*^9, 3.480806788859375*^9}, { 3.4808070189375*^9, 3.480807060125*^9}, {3.48080712775*^9, 3.48080712815625*^9}, {3.4808071911875*^9, 3.480807215921875*^9}, 3.4808075721875*^9}, CellLabel->"In[40]:=",ExpressionUUID->"d96cb498-adde-4a5c-80fd-ec5b952a65e5"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.3866970574464007`"}], ",", "0.39688228108222146`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.9705883909050042`"}], ",", RowBox[{"-", "0.634328509819482`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.48735487657722987`"}], ",", "0.7836760014064972`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.8786340491149741`"}], ",", RowBox[{"-", "0.5561947841230722`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.8622458643994488`"}], ",", "0.5752352481727201`"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{ 3.48072421403125*^9, 3.480724248203125*^9, 3.48080678453125*^9, { 3.480806987421875*^9, 3.48080704059375*^9}, 3.480807131859375*^9, { 3.4808071925*^9, 3.480807216984375*^9}, {3.480807646171875*^9, 3.4808076615*^9}, 3.48080782921875*^9, 3.8582602621209173`*^9, { 3.891470267965127*^9, 3.891470296871323*^9}}, CellLabel->"Out[46]=",ExpressionUUID->"3d3b1604-ca12-415b-91d9-04fbcfbc7430"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{ "Print", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"cut", "[", RowBox[{"inlistn", ",", "numdo"}], "]"}], ",", " ", RowBox[{"cut", "[", RowBox[{"outlistn", ",", "numdo"}], "]"}]}], "}"}], ",", RowBox[{"PlotStyle", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{"Red", ",", "Blue"}], "}"}]}], ",", RowBox[{"AspectRatio", " ", "\[Rule]", " ", "1"}], ",", " ", RowBox[{"PlotLabel", " ", "\[Rule]", " ", RowBox[{"4", " ", RowBox[{"percentagen", "[", RowBox[{"Floor", "[", "numdo", "]"}], "]"}]}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"numdo", ",", "20", ",", RowBox[{".2", "numn"}]}], "}"}]}], "]"}]}], "Input", CellChangeTimes->{{3.480719159078125*^9, 3.48071916596875*^9}, { 3.480719222265625*^9, 3.480719226828125*^9}, {3.480719265703125*^9, 3.480719308546875*^9}, {3.480719341765625*^9, 3.480719358984375*^9}, { 3.4807213539375*^9, 3.4807214551875*^9}, {3.480721497921875*^9, 3.480721545875*^9}, {3.480721670890625*^9, 3.480721748484375*^9}, { 3.48072181446875*^9, 3.480721818234375*^9}, {3.480721862640625*^9, 3.480721876328125*^9}, {3.48072207096875*^9, 3.480722276921875*^9}, { 3.4807226058125*^9, 3.480722613953125*^9}, 3.480722644640625*^9, { 3.4807226856875*^9, 3.480722719609375*^9}, 3.4807227705*^9, { 3.480724180703125*^9, 3.480724199625*^9}, {3.4807243871875*^9, 3.480724398328125*^9}, {3.480807144171875*^9, 3.480807168046875*^9}, 3.480807582609375*^9, {3.4808076425*^9, 3.480807642671875*^9}}, CellLabel->"In[34]:=",ExpressionUUID->"8cf4507a-2679-4079-a910-6c55e6c7e889"], Cell[BoxData["\<\"Plot of randomly chosen points inside and outside.\"\>"], \ "Print", CellChangeTimes->{ 3.4807222800625*^9, 3.480722646296875*^9, {3.4807226925*^9, 3.480722770828125*^9}, 3.4807228775625*^9, 3.480724217640625*^9, 3.480724253546875*^9, {3.4807243293125*^9, 3.48072435934375*^9}, 3.480724399203125*^9, {3.4808071509375*^9, 3.480807217921875*^9}, 3.480807737421875*^9, 3.480807829234375*^9, 3.858260265743635*^9}, CellLabel-> "During evaluation of \ In[34]:=",ExpressionUUID->"343f0b39-dfaf-41fb-950d-baeef165aa20"], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`numdo$$ = 3090., Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[$CellContext`numdo$$], 20, 8000.}}, Typeset`size$$ = { 360., {183., 188.06818247058476`}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`numdo$$ = 20}, "ControllerVariables" :> {}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> ListPlot[{ $CellContext`cut[$CellContext`inlistn, $CellContext`numdo$$], $CellContext`cut[$CellContext`outlistn, $CellContext`numdo$$]}, PlotStyle -> {Red, Blue}, AspectRatio -> 1, PlotLabel -> 4 $CellContext`percentagen[ Floor[$CellContext`numdo$$]]], "Specifications" :> {{$CellContext`numdo$$, 20, 8000.}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{649., {213.63403328722342`, 219.36596671277658`}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UndoTrackedVariables:>{Typeset`show$$, Typeset`bookmarkMode$$}, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{ 3.480722236578125*^9, 3.480722280109375*^9, 3.48072264634375*^9, { 3.480722692515625*^9, 3.480722770828125*^9}, {3.480722877578125*^9, 3.480722921890625*^9}, 3.480724217671875*^9, {3.480724253546875*^9, 3.48072435934375*^9}, 3.480724399203125*^9, {3.480807150953125*^9, 3.4808072179375*^9}, 3.4808077374375*^9, 3.48080782928125*^9, { 3.4808901795625*^9, 3.48089018878125*^9}, 3.4808903145625*^9, { 3.4809738771875*^9, 3.480973898296875*^9}, 3.858260265777426*^9}, CellLabel->"Out[35]=",ExpressionUUID->"5d9ed247-a887-4726-b5a1-2b04ab8d5232"], Cell[BoxData[ TemplateBox[{ "Part", "partd", "\"Part specification \\!\\(\\*RowBox[{\\\"inlistn\\\", \\\"\ \[LeftDoubleBracket]\\\", \\\"1\\\", \\\"\[RightDoubleBracket]\\\"}]\\) is \ longer than depth of object.\"", 2, 21, 1, 30664578980203052088, "Local"}, "MessageTemplate"]], "Message", "MSG", CellChangeTimes->{3.8914700163754997`*^9}, CellLabel->"",ExpressionUUID->"1d7911ab-8bde-4889-be23-bf5d4d3b0db6"], Cell[BoxData[ TemplateBox[{ "Part", "partd", "\"Part specification \\!\\(\\*RowBox[{\\\"inlistn\\\", \\\"\ \[LeftDoubleBracket]\\\", \\\"2\\\", \\\"\[RightDoubleBracket]\\\"}]\\) is \ longer than depth of object.\"", 2, 21, 2, 30664578980203052088, "Local"}, "MessageTemplate"]], "Message", "MSG", CellChangeTimes->{3.891470016453531*^9}, CellLabel->"",ExpressionUUID->"256aefb0-602e-4be6-b6be-1f0c628d9c9a"], Cell[BoxData[ TemplateBox[{ "Part", "partd", "\"Part specification \\!\\(\\*RowBox[{\\\"inlistn\\\", \\\"\ \[LeftDoubleBracket]\\\", \\\"3\\\", \\\"\[RightDoubleBracket]\\\"}]\\) is \ longer than depth of object.\"", 2, 21, 3, 30664578980203052088, "Local"}, "MessageTemplate"]], "Message", "MSG", CellChangeTimes->{3.891470016469147*^9}, CellLabel->"",ExpressionUUID->"31260243-6025-472b-ab9c-d48c38387cf0"], Cell[BoxData[ TemplateBox[{ "General", "stop", "\"Further output of \\!\\(\\*StyleBox[RowBox[{\\\"Part\\\", \\\"::\\\", \ \\\"partd\\\"}], \\\"MessageName\\\"]\\) will be suppressed during this \ calculation.\"", 2, 21, 4, 30664578980203052088, "Local"}, "MessageTemplate"]], "Message", "MSG", CellChangeTimes->{3.8914700164847584`*^9}, CellLabel->"",ExpressionUUID->"28920d16-f493-47be-868e-985555a4d8e6"] }, Open ]], Cell[TextData[StyleBox["Fibonacci Monte Carlo Integration", "Title"]], "Text", CellChangeTimes->{{3.8914700194828467`*^9, 3.8914700311257577`*^9}},ExpressionUUID->"f507e430-1afc-44ad-939a-\ 1ae08f54516a"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"gm", " ", "=", " ", RowBox[{ RowBox[{"(", RowBox[{"1", " ", "+", " ", RowBox[{"Sqrt", "[", "5", "]"}]}], ")"}], "/", "2"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"xmove", " ", "=", " ", RowBox[{"Sqrt", "[", RowBox[{"1", "/", RowBox[{"(", RowBox[{"2", " ", "+", " ", "gm"}], ")"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymove", " ", "=", " ", RowBox[{"xmove", " ", "gm"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Simplify", "[", RowBox[{"1", " ", "-", " ", RowBox[{"xmove", "^", "2"}], " ", "-", " ", RowBox[{"ymove", "^", "2"}]}], "]"}]}], "Input", CellChangeTimes->{{3.891470039519079*^9, 3.8914700511743236`*^9}, { 3.891470156409422*^9, 3.8914702088562765`*^9}}, CellLabel->"In[47]:=",ExpressionUUID->"a89dc0c7-9232-4cbe-a110-7ac9827204e2"], Cell[BoxData["0"], "Output", CellChangeTimes->{{3.8914701985278735`*^9, 3.8914702097788715`*^9}, 3.891498167641156*^9}, CellLabel->"Out[50]=",ExpressionUUID->"c1c333cc-4680-49e3-99b2-8f3a6e09862c"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"num4", "=", "40000"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Clear", "[", "inlist4", "]"}], ";", " ", RowBox[{"Clear", "[", "outlist4", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"inlist4", " ", "=", " ", RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{" ", RowBox[{ RowBox[{"outlist4", " ", "=", " ", RowBox[{"{", "}"}]}], ";"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"numin", " ", "=", " ", "0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"xcoord", " ", "=", " ", "0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m", " ", "=", " ", "1"}], ",", " ", RowBox[{"m", " ", "\[LessEqual]", " ", "num4"}], ",", " ", RowBox[{"m", "++"}], ",", "\[IndentingNewLine]", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"xcoord", " ", "=", " ", RowBox[{"xcoord", " ", "+", " ", "xmove"}]}], ";", "\[IndentingNewLine]", RowBox[{"x", " ", "=", " ", RowBox[{"Mod", "[", " ", RowBox[{"xcoord", ",", " ", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"y", " ", "=", " ", RowBox[{"Mod", "[", RowBox[{ RowBox[{"gm", " ", "xcoord"}], ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"inlist4", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"inlist4", ",", " ", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"cut", "[", RowBox[{"dataset_", ",", " ", "number_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", " ", "=", " ", "1"}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", " ", RowBox[{"Floor", "[", "number", "]"}]}], ",", " ", RowBox[{"i", "++"}], ",", " ", RowBox[{"temp", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"temp", ",", RowBox[{"dataset", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "temp", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"cut", "[", RowBox[{"inlist2", ",", "5"}], "]"}]}], "Input", CellChangeTimes->{{3.480718756359375*^9, 3.480718785*^9}, { 3.480718818203125*^9, 3.480718879390625*^9}, {3.48071891053125*^9, 3.48071907640625*^9}, {3.48071910921875*^9, 3.480719118375*^9}, { 3.480719205609375*^9, 3.48071925475*^9}, 3.4807218993125*^9, { 3.480722003109375*^9, 3.48072200421875*^9}, {3.480722597203125*^9, 3.480722597515625*^9}, {3.48072266790625*^9, 3.480722682203125*^9}, { 3.48072279078125*^9, 3.48072279096875*^9}, {3.48072390696875*^9, 3.480723952828125*^9}, {3.480724229734375*^9, 3.48072423*^9}, { 3.480807385015625*^9, 3.4808074054375*^9}, 3.4808075395625*^9, { 3.891471279506879*^9, 3.891471283665343*^9}, {3.89147133559249*^9, 3.8914713942914457`*^9}, {3.8914714349519663`*^9, 3.891471443249292*^9}, { 3.891473626586276*^9, 3.8914736622237473`*^9}, 3.891498027823031*^9, { 3.8914980978340797`*^9, 3.8914980981285734`*^9}, {3.8914981717340617`*^9, 3.8914981798532343`*^9}, 3.8914995209573126`*^9, 3.891499589820443*^9, { 3.891499794697052*^9, 3.891499795332408*^9}, {3.8914998699279337`*^9, 3.891499899773036*^9}, {3.8915000269676237`*^9, 3.891500039005722*^9}, { 3.891500166524193*^9, 3.8915001902291837`*^9}, {3.8915002535691586`*^9, 3.8915002539963536`*^9}, 3.891500304284634*^9}, CellLabel-> "In[126]:=",ExpressionUUID->"d77a1e4c-52d6-4f83-8ca3-5435645844aa"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.2556969426668112`", ",", RowBox[{"-", "0.4103796662779454`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.5697760986696889`", ",", RowBox[{"-", "0.22966043669114855`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.5815472818497556`"}], ",", RowBox[{"-", "0.14534489583527654`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.443185299601778`", ",", "0.17286616844987557`"}], "}"}], ",", RowBox[{"{", RowBox[{"0.042133308914081846`", ",", RowBox[{"-", "0.14437667122173325`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{ 3.891499599405984*^9, 3.891499811426416*^9, 3.8914999023822517`*^9, 3.891500044259307*^9, {3.891500171037465*^9, 3.8915001958468847`*^9}, 3.891500257063367*^9, 3.891500350459025*^9}, CellLabel-> "Out[134]=",ExpressionUUID->"c2948699-16f6-4ce5-852d-835f02aa08fa"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{ "Print", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"cut", "[", RowBox[{"inlist4", ",", "numdo"}], "]"}], ",", RowBox[{"PlotStyle", " ", "\[Rule]", " ", RowBox[{"{", "Red", "}"}]}], ",", RowBox[{"AspectRatio", " ", "\[Rule]", " ", "1"}]}], "]"}], ",", RowBox[{"{", RowBox[{"numdo", ",", "1", ",", RowBox[{".2", "numn"}]}], "}"}]}], "]"}]}], "Input", CellChangeTimes->{{3.8914996695978384`*^9, 3.8914997165375757`*^9}, { 3.8914997620153713`*^9, 3.89149976370234*^9}}, CellLabel-> "In[124]:=",ExpressionUUID->"25f4e730-f095-4a09-9dfc-aecc654882d1"], Cell[BoxData["\<\"Plot of randomly chosen points inside and outside.\"\>"], \ "Print", CellChangeTimes->{ 3.891499624678399*^9, 3.891499717635977*^9, 3.8914997645927505`*^9, 3.891499904745205*^9, {3.8915001730550823`*^9, 3.891500196585554*^9}, 3.8915002571117897`*^9}, CellLabel-> "During evaluation of \ In[124]:=",ExpressionUUID->"7d1fbcfa-7ffe-42e3-b345-93dbe7b56cdc"], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`numdo$$ = 1680.5819407090676`, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[$CellContext`numdo$$], 1, 8000.}}, Typeset`size$$ = { 360., {176., 181.27050867080692`}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`numdo$$ = 1}, "ControllerVariables" :> {}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> ListPlot[ $CellContext`cut[$CellContext`inlist4, $CellContext`numdo$$], PlotStyle -> {Red}, AspectRatio -> 1], "Specifications" :> {{$CellContext`numdo$$, 1, 8000.}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{649., {206.63403328722342`, 212.36596671277658`}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UndoTrackedVariables:>{Typeset`show$$, Typeset`bookmarkMode$$}, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{{3.8914996247146854`*^9, 3.891499639387955*^9}, { 3.8914997176672287`*^9, 3.8914997273306165`*^9}, 3.8914997646240435`*^9, 3.8914998234595933`*^9, 3.8914999047764835`*^9, 3.891499937398634*^9, { 3.8915001730863466`*^9, 3.89150019660164*^9}, {3.891500257126384*^9, 3.891500263543019*^9}}, CellLabel-> "Out[125]=",ExpressionUUID->"956b33cb-8856-49f1-ad95-9ad2f934dfdd"] }, Open ]] }, WindowSize->{829.8, 568.8}, WindowMargins->{{139.2, Automatic}, {Automatic, 0}}, PrivateNotebookOptions->{"VersionedStylesheet"->{"Default.nb"[8.] -> False}}, ShowSelection->True, FrontEndVersion->"13.2 for Microsoft Windows (64-bit) (January 30, 2023)", StyleDefinitions->"Default.nb", ExpressionUUID->"350b36bb-6441-44fb-8546-f995467bbd64" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[545, 20, 225, 5, 69, "Input",ExpressionUUID->"17d1b58f-ebed-46df-9485-1c02d6ec3666"], Cell[773, 27, 203, 4, 43, "Input",ExpressionUUID->"ad159b8f-698f-4124-bad1-c4432fb905e3"], Cell[CellGroupData[{ Cell[1001, 35, 4165, 102, 390, "Input",ExpressionUUID->"5f543de9-0319-4899-b07c-4b75984c95e3"], Cell[5169, 139, 1014, 24, 32, "Output",ExpressionUUID->"70d08a4e-02ed-41af-a830-8f74d0415787"] }, Open ]], Cell[CellGroupData[{ Cell[6220, 168, 238, 5, 28, "Input",ExpressionUUID->"dbe287ea-a7c9-4308-b356-d70614c69108"], Cell[6461, 175, 217, 4, 32, "Output",ExpressionUUID->"0b29c4b9-d0a9-4348-98ff-92a71b153bd8"] }, Open ]], Cell[CellGroupData[{ Cell[6715, 184, 2102, 43, 67, "Input",ExpressionUUID->"21deabad-9fd5-4213-92f5-f46b46172291"], Cell[8820, 229, 953, 19, 22, "Print",ExpressionUUID->"8880b013-6724-4955-b3ca-9abce68270f0"], Cell[9776, 250, 2285, 43, 452, "Output",ExpressionUUID->"5be445d2-b26d-48e2-a821-0f510c95805f"] }, Open ]], Cell[12076, 296, 274, 6, 86, "Input",ExpressionUUID->"26f1eb00-5813-4bca-bae4-3559fce8a72d"], Cell[12353, 304, 351, 10, 43, "Input",ExpressionUUID->"2c9d7b52-079f-42a4-8eec-2560f2c6bea7"], Cell[CellGroupData[{ Cell[12729, 318, 4209, 103, 390, "Input",ExpressionUUID->"3054f6f9-8af8-40e6-8e76-6678634c0522"], Cell[16941, 423, 935, 26, 32, "Output",ExpressionUUID->"6caed241-2236-49ad-8d37-2a51f53d8db7"] }, Open ]], Cell[CellGroupData[{ Cell[17913, 454, 1934, 42, 67, "Input",ExpressionUUID->"aa9f8e96-4748-4d34-aaee-d49143c1c931"], Cell[19850, 498, 826, 16, 22, "Print",ExpressionUUID->"252a0823-5bb7-4463-98cb-6de261c7ba2c"], Cell[20679, 516, 2420, 46, 452, "Output",ExpressionUUID->"94a397bc-887d-4fb5-b512-07c254cd6261"] }, Open ]], Cell[23114, 565, 125, 2, 28, "Input",ExpressionUUID->"e9999c0f-e28d-4f2b-8537-097f491b78c3"], Cell[23242, 569, 254, 5, 43, "Input",ExpressionUUID->"2fb3b8c6-8aef-4091-9922-fbd1730a57bd"], Cell[CellGroupData[{ Cell[23521, 578, 1281, 32, 105, "Input",ExpressionUUID->"d5ac1392-03ef-4baf-b436-643e65accdbc"], Cell[24805, 612, 307, 4, 32, "Output",ExpressionUUID->"d1aa56b6-6704-4d95-868d-701c5233f42b"] }, Open ]], Cell[CellGroupData[{ Cell[25149, 621, 4319, 101, 371, "Input",ExpressionUUID->"d96cb498-adde-4a5c-80fd-ec5b952a65e5"], Cell[29471, 724, 1113, 29, 32, "Output",ExpressionUUID->"3d3b1604-ca12-415b-91d9-04fbcfbc7430"] }, Open ]], Cell[CellGroupData[{ Cell[30621, 758, 1851, 38, 67, "Input",ExpressionUUID->"8cf4507a-2679-4079-a910-6c55e6c7e889"], Cell[32475, 798, 552, 10, 22, "Print",ExpressionUUID->"343f0b39-dfaf-41fb-950d-baeef165aa20"], Cell[33030, 810, 2360, 44, 452, "Output",ExpressionUUID->"5d9ed247-a887-4726-b5a1-2b04ab8d5232"], Cell[35393, 856, 421, 8, 28, "Message",ExpressionUUID->"1d7911ab-8bde-4889-be23-bf5d4d3b0db6"], Cell[35817, 866, 419, 8, 28, "Message",ExpressionUUID->"256aefb0-602e-4be6-b6be-1f0c628d9c9a"], Cell[36239, 876, 419, 8, 28, "Message",ExpressionUUID->"31260243-6025-472b-ab9c-d48c38387cf0"], Cell[36661, 886, 417, 8, 28, "Message",ExpressionUUID->"28920d16-f493-47be-868e-985555a4d8e6"] }, Open ]], Cell[37093, 897, 208, 3, 73, "Text",ExpressionUUID->"f507e430-1afc-44ad-939a-1ae08f54516a"], Cell[CellGroupData[{ Cell[37326, 904, 889, 24, 86, "Input",ExpressionUUID->"a89dc0c7-9232-4cbe-a110-7ac9827204e2"], Cell[38218, 930, 203, 3, 32, "Output",ExpressionUUID->"c1c333cc-4680-49e3-99b2-8f3a6e09862c"] }, Open ]], Cell[CellGroupData[{ Cell[38458, 938, 3974, 88, 371, "Input",ExpressionUUID->"d77a1e4c-52d6-4f83-8ca3-5435645844aa"], Cell[42435, 1028, 934, 23, 52, "Output",ExpressionUUID->"c2948699-16f6-4ce5-852d-835f02aa08fa"] }, Open ]], Cell[CellGroupData[{ Cell[43406, 1056, 792, 20, 48, "Input",ExpressionUUID->"25f4e730-f095-4a09-9dfc-aecc654882d1"], Cell[44201, 1078, 385, 8, 22, "Print",ExpressionUUID->"7d1fbcfa-7ffe-42e3-b345-93dbe7b56cdc"], Cell[44589, 1088, 2016, 39, 438, "Output",ExpressionUUID->"956b33cb-8856-49f1-ad95-9ad2f934dfdd"] }, Open ]] } ] *)