(* 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[ 7169, 215] NotebookOptionsPosition[ 6810, 198] NotebookOutlinePosition[ 7158, 213] CellTagsIndexPosition[ 7115, 210] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[StyleBox["Membership function for spherical fuzzy clustering", FontColor->RGBColor[1, 0, 0]]], "Subsection", CellChangeTimes->{{3.8078777882984753`*^9, 3.8078777985842714`*^9}, { 3.8079374102859097`*^9, 3.8079374189803286`*^9}, 3.8208238187207546`*^9}, ExpressionUUID -> "faed3628-f28f-4c69-a795-7d403f0778e4"], Cell[BoxData[{ RowBox[{ RowBox[{ StyleBox["Input", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{"data", " ", "set", " ", "\[ScriptCapitalA]"}], " ", "\[Subset]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"centers", " ", SubscriptBox["c", "1"]}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox["\[TripleDot]", FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ SubscriptBox["c", "k"], " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"indexes", " ", "i"}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"j", ";"}], FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Output", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"membership", " ", "function", " ", SubscriptBox["u", "ij"]}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[";", FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Submodules", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"none", " ", "needed"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[" ", FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]"}], "Text", CellChangeTimes->{{3.808020288523261*^9, 3.8080202925725307`*^9}, { 3.808020378837097*^9, 3.8080203810859194`*^9}, {3.8080211979026384`*^9, 3.8080212268730516`*^9}, {3.808022244689043*^9, 3.808022251364231*^9}, { 3.8080275344638968`*^9, 3.8080275349642467`*^9}, {3.8080275876633015`*^9, 3.8080276021795835`*^9}, 3.8208454541326246`*^9, {3.8208459364089966`*^9, 3.820846010931651*^9}, {3.8208460433888593`*^9, 3.820846044919302*^9}, { 3.820846077323097*^9, 3.8208461117173495`*^9}, {3.8223141367053514`*^9, 3.822314146860162*^9}}, FontSize->12, ExpressionUUID -> "4ceb525b-cf41-4fba-8109-c42d1949b360"], Cell[BoxData[{ RowBox[{ RowBox[{"q", "=", "2"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"mu", "[", RowBox[{"A_", ",", "cen_", ",", "i_", ",", "j_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"uu", ",", RowBox[{"Ii", "=", RowBox[{"{", "}"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Equal]", RowBox[{"cen", "[", RowBox[{"[", "s", "]"}], "]"}]}], ",", RowBox[{"Ii", "=", RowBox[{"Append", "[", RowBox[{"Ii", ",", "s"}], "]"}]}]}], "]"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", "cen", "]"}]}], "}"}]}], "]"}], ";", " ", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ii", "\[Equal]", RowBox[{"{", "}"}]}], ",", "\[IndentingNewLine]", RowBox[{"uu", "=", RowBox[{"1", "/", RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"cen", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], "^", "2"}], "/", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"cen", "[", RowBox[{"[", "s", "]"}], "]"}]}], "]"}], "^", "2"}]}], ")"}], "^", RowBox[{"(", RowBox[{"1", "/", RowBox[{"(", RowBox[{"q", "-", "1"}], ")"}]}], ")"}]}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", "cen", "]"}]}], "}"}]}], "]"}]}]}], ",", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"MemberQ", "[", RowBox[{"Ii", ",", "j"}], "]"}], ",", RowBox[{"uu", "=", RowBox[{"1", "/", RowBox[{"Length", "[", "Ii", "]"}]}]}], ",", RowBox[{"uu", "=", "0"}]}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", "uu"}]}], "\[IndentingNewLine]", "]"}]}]}], "Input", CellChangeTimes->{{3.808020288523261*^9, 3.8080202925725307`*^9}, { 3.808020378837097*^9, 3.8080203810859194`*^9}, {3.8080211979026384`*^9, 3.8080212268730516`*^9}, {3.808022244689043*^9, 3.808022251364231*^9}, { 3.8080275344638968`*^9, 3.8080275349642467`*^9}, {3.8080275876633015`*^9, 3.8080276021795835`*^9}, 3.8208454541326246`*^9, {3.8208459364089966`*^9, 3.820846010931651*^9}, {3.8208460433888593`*^9, 3.820846044919302*^9}, { 3.820846077323097*^9, 3.8208461117173495`*^9}, 3.8223141367053514`*^9}, ExpressionUUID -> "4ceb525b-cf41-4fba-8109-c42d1949b360"] }, 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, 331, 4, 49, "Subsection"], Cell[914, 28, 2710, 84, 85, "Text"], Cell[3627, 114, 3167, 81, 202, "Input"] }, Open ]] } ] *)