(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 12.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 18438, 424] NotebookOptionsPosition[ 18070, 407] NotebookOutlinePosition[ 18418, 422] CellTagsIndexPosition[ 18375, 419] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[StyleBox["Generating data from a circle-arc oval", FontColor->RGBColor[1, 0, 0]]], "Subsubsection", CellChangeTimes->{{3.6799959272424545`*^9, 3.6799959714925165`*^9}, { 3.680187880725844*^9, 3.6801878813658447`*^9}, {3.6801879133558893`*^9, 3.6801879169258947`*^9}, {3.680188161286237*^9, 3.6801881618662376`*^9}, { 3.680188252966365*^9, 3.6801882616863775`*^9}, {3.6801883076464415`*^9, 3.680188367706526*^9}, {3.68018854232677*^9, 3.680188555186788*^9}, { 3.680188645956915*^9, 3.6801887056379986`*^9}, {3.6801889273883095`*^9, 3.680188930058313*^9}, {3.680189244018752*^9, 3.6801892847288094`*^9}, { 3.6801893580589123`*^9, 3.680189359168914*^9}, {3.680189420118999*^9, 3.6801894397690268`*^9}, {3.6801894730990734`*^9, 3.6801895437291718`*^9}, {3.6801900734149265`*^9, 3.680190086304945*^9}, { 3.6801901868050857`*^9, 3.6801903182252693`*^9}, {3.6801903981653814`*^9, 3.6801904303854265`*^9}, {3.680190477125492*^9, 3.6801906342057123`*^9}, { 3.680190665865756*^9, 3.6801906674757586`*^9}, {3.680191007020167*^9, 3.680191145620361*^9}, {3.680191176980405*^9, 3.6801912085004487`*^9}, { 3.680191325810613*^9, 3.680191412160734*^9}, {3.680191481260831*^9, 3.6801914918608456`*^9}, {3.6801915407409143`*^9, 3.6801916609210825`*^9}, {3.680191718901163*^9, 3.680191724661172*^9}, { 3.680191798661275*^9, 3.6801918474213433`*^9}, {3.6801920336116037`*^9, 3.680192064282647*^9}, {3.680192966581046*^9, 3.680193025731129*^9}, { 3.680193071341193*^9, 3.680193073591196*^9}, {3.6801931694413304`*^9, 3.6801931716413336`*^9}, {3.680193204341379*^9, 3.680193221921404*^9}, { 3.6801932521514463`*^9, 3.680193327011551*^9}, {3.6801934502717237`*^9, 3.680193456331732*^9}, {3.6801935486538625`*^9, 3.68019367538404*^9}, { 3.6802229763031774`*^9, 3.6802230363632617`*^9}, {3.6802233314036746`*^9, 3.680223369553728*^9}, {3.6802234540458508`*^9, 3.6802234659658675`*^9}, { 3.680223573446018*^9, 3.6802236119760723`*^9}, 3.6802245810804358`*^9, { 3.680224788350726*^9, 3.680224788880727*^9}, {3.68022576742412*^9, 3.68022578184414*^9}, 3.680225916668332*^9, {3.6802259495283785`*^9, 3.680225953498384*^9}, {3.680226611300305*^9, 3.6802266283203287`*^9}, 3.6807540138389945`*^9, {3.81062018635697*^9, 3.8106202074909267`*^9}, { 3.8222736699285183`*^9, 3.8222736732804747`*^9}, 3.822276130701008*^9, 3.8222764463652487`*^9}, ExpressionUUID -> "99b3be41-1c7d-4efb-9c0f-b7e6646fae69"], Cell[BoxData[{ StyleBox[ RowBox[{ RowBox[{ StyleBox["Input", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], " ", RowBox[{"center", " ", "C"}]}], ",", " ", RowBox[{"radius", " ", "r"}], ",", " ", RowBox[{"number", " ", StyleBox[ SubscriptBox["n", "p"], FontSlant->"Italic"], " ", "of", " ", "points", " ", "per", " ", "unit", " ", "square"}], ",", " ", RowBox[{"standard", " ", "deviation", " ", "\[Sigma]"}], ",", RowBox[{"number", " ", StyleBox[ SubscriptBox["n", "r"], FontSlant->"Italic"], " ", "of", " ", "points", " ", "generated", " ", "from", " ", "a", " ", "normal", " ", "distribution", " ", "in", " ", "the", " ", "neighborhood", " ", "of", " ", "each", " ", "point"}]}], FontColor->RGBColor[0, 0, 1]], "\n", StyleBox[ RowBox[{ RowBox[{ StyleBox["a", FontSlant->"Italic"], " ", "\[Element]", " ", RowBox[{"CAoval", RowBox[{"(", RowBox[{ StyleBox["arc", FontSlant->"Italic"], RowBox[{"(", RowBox[{"C", ",", "R", ",", SubscriptBox["\[Alpha]", "1"], ",", SubscriptBox["\[Alpha]", "2"]}], ")"}]}], ")"}], " ", "with", " ", "radius", " ", "R", " ", "and", " ", "arcs", " ", SubscriptBox["\[Alpha]", "1"]}]}], ",", RowBox[{ SubscriptBox["\[Alpha]", "2"], ";"}]}], FontColor->RGBColor[0, 0, 1]], "\[IndentingNewLine]", StyleBox[ RowBox[{ RowBox[{ StyleBox["Output", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], " ", RowBox[{"data", " ", "set"}]}], ",", " ", RowBox[{ RowBox[{"circle", "-", RowBox[{"arc", " ", "oval", " ", "CAoval", RowBox[{"(", RowBox[{ RowBox[{ StyleBox["arc", FontSlant->"Italic"], RowBox[{"(", RowBox[{"C", ",", "R", ",", SubscriptBox["\[Alpha]", "1"], ",", SubscriptBox["\[Alpha]", "2"]}], ")"}]}], ",", "r"}], ")"}]}]}], ";"}]}], FontColor->RGBColor[0, 0, 1]], "\[IndentingNewLine]", StyleBox[ RowBox[{ StyleBox["Submodules", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], " ", RowBox[{"none", " ", "needed", " "}]}], FontColor->RGBColor[0, 0, 1]], "\[IndentingNewLine]"}], "Text", CellChangeTimes->{{3.6799959272424545`*^9, 3.6799959714925165`*^9}, { 3.680187880725844*^9, 3.6801878813658447`*^9}, {3.6801879133558893`*^9, 3.6801879169258947`*^9}, {3.680188161286237*^9, 3.6801881618662376`*^9}, { 3.680188252966365*^9, 3.6801882616863775`*^9}, {3.6801883076464415`*^9, 3.680188367706526*^9}, {3.68018854232677*^9, 3.680188555186788*^9}, { 3.680188645956915*^9, 3.6801887056379986`*^9}, {3.6801889273883095`*^9, 3.680188930058313*^9}, {3.680189244018752*^9, 3.6801892847288094`*^9}, { 3.6801893580589123`*^9, 3.680189359168914*^9}, {3.680189420118999*^9, 3.6801894397690268`*^9}, {3.6801894730990734`*^9, 3.6801895437291718`*^9}, {3.6801900734149265`*^9, 3.680190086304945*^9}, { 3.6801901868050857`*^9, 3.6801903182252693`*^9}, {3.6801903981653814`*^9, 3.6801904303854265`*^9}, {3.680190477125492*^9, 3.6801906342057123`*^9}, { 3.680190665865756*^9, 3.6801906674757586`*^9}, {3.680191007020167*^9, 3.680191145620361*^9}, {3.680191176980405*^9, 3.6801912085004487`*^9}, { 3.680191325810613*^9, 3.680191412160734*^9}, {3.680191481260831*^9, 3.6801914918608456`*^9}, {3.6801915407409143`*^9, 3.6801916609210825`*^9}, {3.680191718901163*^9, 3.680191724661172*^9}, { 3.680191798661275*^9, 3.6801918474213433`*^9}, {3.6801920336116037`*^9, 3.680192064282647*^9}, {3.680192966581046*^9, 3.680193025731129*^9}, { 3.680193071341193*^9, 3.680193073591196*^9}, {3.6801931694413304`*^9, 3.6801931716413336`*^9}, {3.680193204341379*^9, 3.680193221921404*^9}, { 3.6801932521514463`*^9, 3.680193327011551*^9}, {3.6801934502717237`*^9, 3.680193456331732*^9}, {3.6801935486538625`*^9, 3.68019367538404*^9}, { 3.6802229763031774`*^9, 3.6802230363632617`*^9}, {3.6802233314036746`*^9, 3.680223369553728*^9}, {3.6802234540458508`*^9, 3.6802234659658675`*^9}, { 3.680223573446018*^9, 3.6802236119760723`*^9}, 3.6802245810804358`*^9, { 3.680224788350726*^9, 3.680224788880727*^9}, {3.68022576742412*^9, 3.68022578184414*^9}, 3.680225916668332*^9, {3.6802259495283785`*^9, 3.680225953498384*^9}, {3.680226611300305*^9, 3.6802266249203243`*^9}, { 3.6803192562639866`*^9, 3.680319259459597*^9}, {3.680323526767522*^9, 3.680323532564666*^9}, {3.681178043042704*^9, 3.6811780432927375`*^9}, { 3.8106202118283577`*^9, 3.8106202163739934`*^9}, {3.81062025582215*^9, 3.8106203134258823`*^9}, {3.810620365714431*^9, 3.8106203716352015`*^9}, { 3.8106204076250334`*^9, 3.810620442976353*^9}, 3.810643826124235*^9, 3.8222751549967785`*^9, {3.8222752111379347`*^9, 3.8222752149997272`*^9}, { 3.8222752635631237`*^9, 3.822275367832741*^9}, {3.8222754003841553`*^9, 3.822275401952034*^9}, {3.822275445902254*^9, 3.8222755044187336`*^9}, { 3.8222761666858826`*^9, 3.8222762290907154`*^9}, {3.8222762614196243`*^9, 3.822276334277472*^9}, {3.822276384690976*^9, 3.822276431989893*^9}, { 3.822287320295639*^9, 3.8222873259638023`*^9}, 3.8222873680798993`*^9}, FontSize->12, ExpressionUUID -> "cd705a8e-6091-464f-8c7d-77623549b419"], Cell[BoxData[ RowBox[{ RowBox[{"DataOval", "[", RowBox[{ "a_", ",", "b_", ",", "r_", ",", "np_", ",", "sigma_", ",", "nr_", ",", RowBox[{"Ind_:", "0"}]}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"Del", ",", RowBox[{"del", "=", RowBox[{".2", "r"}]}], ",", "Nr", ",", "data", ",", RowBox[{"pi", "=", RowBox[{"{", "}"}]}], ",", RowBox[{"pod", "=", RowBox[{"{", "}"}]}], ",", "Pod", ",", "circle"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"a", ":", " ", RowBox[{ "the", " ", "left", " ", "edge", " ", "of", " ", "the", " ", "segment"}]}], ";", " ", RowBox[{"b", ":", " ", RowBox[{ "the", " ", "right", " ", "edge", " ", "of", " ", "the", " ", "segment"}]}], ";", " ", RowBox[{"r", ":", " ", RowBox[{"radius", " ", "of", " ", "generalized", " ", "circle"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"np", ":", " ", RowBox[{ "number", " ", "of", " ", "points", " ", "per", " ", "unit", " ", "square"}]}], ";", "\[IndentingNewLine]", RowBox[{"sigma", ":", " ", RowBox[{ "parameter", " ", "from", " ", "the", " ", "normaln", " ", "distribution"}]}], ";", "\[IndentingNewLine]", RowBox[{"nr", ":", " ", RowBox[{ "number", " ", "of", " ", "points", " ", "generated", " ", "from", " ", "a", " ", "normal", " ", "distribution", " ", "in", " ", "the", " ", "neighborhood", " ", "of", " ", "each", " ", "data", " ", "point", " ", RowBox[{"pod", "[", RowBox[{"[", "i", "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"Ind", ":", " ", RowBox[{ RowBox[{"If", " ", "Ind"}], " ", "\[NotEqual]", " ", RowBox[{ "0", " ", "the", " ", "results", " ", "and", " ", "the", " ", "Figure", " ", "are", " ", RowBox[{"listed", "."}]}]}]}]}], "\[IndentingNewLine]", "*)"}], " ", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Defining", " ", "of", " ", "basic", " ", "points"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Del", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"a", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "r", "-", "del"}], ",", RowBox[{ RowBox[{"b", "[", RowBox[{"[", "1", "]"}], "]"}], "+", "r", "+", "del"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"a", "[", RowBox[{"[", "2", "]"}], "]"}], "-", "r", "-", "del"}], ",", RowBox[{ RowBox[{"b", "[", RowBox[{"[", "2", "]"}], "]"}], "+", "r", "+", "del"}]}], "}"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"Nr", "=", RowBox[{"Floor", "[", RowBox[{"np", " ", RowBox[{"Area", "[", RowBox[{"Rectangle", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Del", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], ",", RowBox[{"Del", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Del", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], ",", RowBox[{"Del", "[", RowBox[{"[", RowBox[{"2", ",", "2"}], "]"}], "]"}]}], "}"}]}], "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"data", "=", RowBox[{"RandomVariate", "[", RowBox[{ RowBox[{"UniformDistribution", "[", "Del", "]"}], ",", "Nr"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"Defining", " ", "[", "pod", "]"}], " ", "inside", " ", "of", " ", "a", " ", "circle", " ", "with", " ", "radius", " ", "r"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"dist", "[", RowBox[{ RowBox[{"data", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "a", ",", "b"}], "]"}], "\[LessEqual]", " ", "r"}], ",", RowBox[{"pod", "=", RowBox[{"AppendTo", "[", RowBox[{"pod", ",", RowBox[{"data", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"i", ",", "Nr"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"In", " ", "each", " ", RowBox[{"pod", "[", RowBox[{"[", "i", "]"}], "]"}], " ", "nr", " ", "points", " ", "from", " ", "normaln", " ", "distribution", " ", "are", " ", "added"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"pi", "=", RowBox[{"AppendTo", "[", RowBox[{"pi", ",", RowBox[{"RandomVariate", "[", RowBox[{ RowBox[{"MultinormalDistribution", "[", RowBox[{ RowBox[{"pod", "[", RowBox[{"[", "j", "]"}], "]"}], ",", RowBox[{"sigma", " ", RowBox[{"IdentityMatrix", "[", "2", "]"}]}]}], "]"}], ",", "nr"}], "]"}]}], "]"}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"Length", "[", "pod", "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Pod", "=", RowBox[{"Union", "[", RowBox[{"pod", ",", RowBox[{"Flatten", "[", RowBox[{"pi", ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", "Figure", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ind", "\[NotEqual]", " ", "0"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"slseg", "=", RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{ RowBox[{"dist", "[", RowBox[{ RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}], ",", "a", ",", "b"}], "]"}], "==", " ", "r"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"Del", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], ",", RowBox[{"Del", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"Del", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}], ",", RowBox[{"Del", "[", RowBox[{"[", RowBox[{"2", ",", "2"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"ContourStyle", "\[Rule]", RowBox[{"{", "Red", "}"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"slPod", "=", RowBox[{"ListPlot", "[", RowBox[{"Pod", ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{"PointSize", "[", ".005", "]"}], "}"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"Show", "[", RowBox[{"slseg", ",", "slPod", ",", RowBox[{"PlotRange", "\[Rule]", "Del"}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"Frame", "\[Rule]", "True"}], ",", RowBox[{"GridLines", "\[Rule]", "Automatic"}], ",", RowBox[{"ImageSize", "\[Rule]", "Small"}]}], "]"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{"a", ",", "b", ",", "r"}], "}"}], ",", "\"\<; Delta=\>\"", ",", "Del", ",", " ", "\"\<; |Pod|= \>\"", ",", RowBox[{"Length", "[", "Pod", "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "\t", "]"}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"Pod", ",", "slseg"}], "}"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.8034741973219137`*^9, 3.8034748686234045`*^9}, 3.803474969583545*^9, {3.803475121933424*^9, 3.803475142349815*^9}, { 3.803475249225938*^9, 3.803475249624898*^9}, {3.8034754813321304`*^9, 3.803475718914487*^9}, {3.8034757530272493`*^9, 3.803475756244643*^9}, { 3.8034758150034738`*^9, 3.803475838184081*^9}, {3.803475959987104*^9, 3.8034760204649353`*^9}, {3.8034760975053515`*^9, 3.803476120261479*^9}, { 3.803476192159752*^9, 3.80347622743464*^9}, {3.8034762608203793`*^9, 3.8034762868816333`*^9}, {3.803476355568011*^9, 3.803476408799664*^9}, 3.803476706028537*^9, {3.8034768531227026`*^9, 3.803476895166424*^9}, 3.8036131691199603`*^9, {3.8054613336595125`*^9, 3.8054613363109703`*^9}, { 3.8054616306260257`*^9, 3.8054616317974453`*^9}, {3.805461735649433*^9, 3.80546174650708*^9}, {3.8222756046573105`*^9, 3.82227593745363*^9}}, ExpressionUUID -> "1c10efbd-fed1-4a06-8aa9-a08214d400c7"] }, Open ]] }, WindowSize->{1536, 779}, WindowMargins->{{-8, Automatic}, {Automatic, -8}}, FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (September 21, 2016)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 2494, 34, 39, "Subsubsection"], Cell[3077, 58, 5412, 113, 103, "Text"], Cell[8492, 173, 9562, 231, 601, "Input"] }, Open ]] } ] *)