(* 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[ 13462, 382] NotebookOptionsPosition[ 11095, 321] NotebookOutlinePosition[ 11427, 337] CellTagsIndexPosition[ 11384, 334] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Basic Examples", "Subsection", CellID->462042388], Cell["Here are the 5 integer partitions of 4:", "Text", CellChangeTimes->{{3.764094160463354*^9, 3.76409417409651*^9}, { 3.7640956229962997`*^9, 3.764095626075741*^9}}, CellID->2090272336], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"IntegerPartitions", "[", "4", "]"}]], "Input", CellChangeTimes->{{3.764095628557434*^9, 3.7640956288436613`*^9}}, CellLabel->"In[111]:=", CellID->1490974711], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", "4", "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "1", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "1", ",", "1", ",", "1"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.764094177803855*^9, 3.764095629695785*^9}, CellLabel->"Out[111]=", CellID->1560896536] }, Open ]], Cell["They all pass the test for being an integer partition:", "Text", CellChangeTimes->{{3.764094181894696*^9, 3.764094203949287*^9}}, CellID->13078159], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ StyleBox[ StyleBox[ FrameBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->Rational[10, 13] Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ StyleBox["\<\"IntegerPartitionQ\"\>", "ResourceFunctionLabel"], ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited]} }]], "ResourceFunctionFrame"], FrameBoxOptions->{Background->GrayLevel[0.5, 0.15], BaseStyle->{ "StandardForm", LineSpacing -> {0, 0}, LineBreakWithin -> False}, FrameMargins->{{3, 3}, {0, 0}}, FrameStyle->Directive[ GrayLevel[0.5, 0.35], AbsoluteThickness[0.5]], RoundingRadius->4}, GridBoxOptions->{FrameStyle->GrayLevel[1, 0], GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxFrame->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0.25}}, "Rows" -> {-0.1, {}, 0}}}], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "\"IntegerPartitionQ\""}], ResourceFunction["IntegerPartitionQ"], BoxID -> "IntegerPartitionQ", Selectable->False], "/@", RowBox[{"IntegerPartitions", "[", "4", "]"}]}]], "Input", CellChangeTimes->{{3.764094039547263*^9, 3.764094106338304*^9}, { 3.764095633757793*^9, 3.7640956340035963`*^9}}, CellLabel->"In[112]:=", CellID->443871870], Cell[BoxData[ RowBox[{"{", RowBox[{"True", ",", "True", ",", "True", ",", "True", ",", "True"}], "}"}]], "Output", CellChangeTimes->{{3.764094051700733*^9, 3.764094101278233*^9}, 3.764094143785784*^9, 3.764095635079358*^9}, CellLabel->"Out[112]=", CellID->2141881465] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ InterpretationBox[Cell["\t", "ExampleDelimiter"], $Line = 0; Null]], "ExampleDelimiter", CellID->136285305], Cell["The parts all have to be integers:", "Text", CellChangeTimes->{{3.764094296730083*^9, 3.7640943280809593`*^9}}, CellID->1305732154], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ StyleBox[ StyleBox[ FrameBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->Rational[10, 13] Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ StyleBox["\<\"IntegerPartitionQ\"\>", "ResourceFunctionLabel"], ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited]} }]], "ResourceFunctionFrame"], FrameBoxOptions->{Background->GrayLevel[0.5, 0.15], BaseStyle->{ "StandardForm", LineSpacing -> {0, 0}, LineBreakWithin -> False}, FrameMargins->{{3, 3}, {0, 0}}, FrameStyle->Directive[ GrayLevel[0.5, 0.35], AbsoluteThickness[0.5]], RoundingRadius->4}, GridBoxOptions->{FrameStyle->GrayLevel[1, 0], GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxFrame->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0.25}}, "Rows" -> {-0.1, {}, 0}}}], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "\"IntegerPartitionQ\""}], ResourceFunction["IntegerPartitionQ"], BoxID -> "IntegerPartitionQ", Selectable->False], "[", RowBox[{"{", RowBox[{"3.", ",", "3", ",", "1"}], "}"}], "]"}]], "Input", CellChangeTimes->{{3.764094309082307*^9, 3.764094320953319*^9}}, CellLabel->"In[110]:=", CellID->954711353], Cell[BoxData["False"], "Output", CellChangeTimes->{3.7640943226415567`*^9}, CellLabel->"Out[110]=", CellID->1512492289] }, Open ]], Cell["The parts have to be positive:", "Text", CellChangeTimes->{{3.7640942243574953`*^9, 3.7640942324523163`*^9}, { 3.764094364743672*^9, 3.764094370167718*^9}}, CellID->2064568719], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ StyleBox[ StyleBox[ FrameBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->Rational[10, 13] Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ StyleBox["\<\"IntegerPartitionQ\"\>", "ResourceFunctionLabel"], ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited]} }]], "ResourceFunctionFrame"], FrameBoxOptions->{Background->GrayLevel[0.5, 0.15], BaseStyle->{ "StandardForm", LineSpacing -> {0, 0}, LineBreakWithin -> False}, FrameMargins->{{3, 3}, {0, 0}}, FrameStyle->Directive[ GrayLevel[0.5, 0.35], AbsoluteThickness[0.5]], RoundingRadius->4}, GridBoxOptions->{FrameStyle->GrayLevel[1, 0], GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxFrame->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0.25}}, "Rows" -> {-0.1, {}, 0}}}], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "\"IntegerPartitionQ\""}], ResourceFunction["IntegerPartitionQ"], BoxID -> "IntegerPartitionQ", Selectable->False], "[", RowBox[{"{", RowBox[{"2", ",", "1", ",", "0"}], "}"}], "]"}]], "Input", CellChangeTimes->{{3.764094212989819*^9, 3.76409421842099*^9}}, CellLabel->"In[108]:=", CellID->806555239], Cell[BoxData["False"], "Output", CellChangeTimes->{3.764094220076614*^9}, CellLabel->"Out[108]=", CellID->2066726071] }, Open ]], Cell["The parts have to be in weakly decreasing order:", "Text", CellChangeTimes->{{3.764094252123477*^9, 3.7640942788746557`*^9}}, CellID->2028958639], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ StyleBox[ StyleBox[ FrameBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->Rational[10, 13] Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ StyleBox["\<\"IntegerPartitionQ\"\>", "ResourceFunctionLabel"], ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited]} }]], "ResourceFunctionFrame"], FrameBoxOptions->{Background->GrayLevel[0.5, 0.15], BaseStyle->{ "StandardForm", LineSpacing -> {0, 0}, LineBreakWithin -> False}, FrameMargins->{{3, 3}, {0, 0}}, FrameStyle->Directive[ GrayLevel[0.5, 0.35], AbsoluteThickness[0.5]], RoundingRadius->4}, GridBoxOptions->{FrameStyle->GrayLevel[1, 0], GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxFrame->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0.25}}, "Rows" -> {-0.1, {}, 0}}}], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "\"IntegerPartitionQ\""}], ResourceFunction["IntegerPartitionQ"], BoxID -> "IntegerPartitionQ", Selectable->False], "[", RowBox[{"{", RowBox[{"3", ",", "1", ",", "2"}], "}"}], "]"}]], "Input", CellChangeTimes->{{3.764094238796846*^9, 3.7640942468840647`*^9}}, CellLabel->"In[109]:=", CellID->244345023], Cell[BoxData["False"], "Output", CellChangeTimes->{3.764094249298295*^9}, CellLabel->"Out[109]=", CellID->336291928] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->Automatic, WindowMargins->Automatic, Visible->False, FrontEndVersion->"12.0 for Microsoft Windows (64-bit) (April 8, 2019)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 56, 1, 70, "Subsection",ExpressionUUID->"2b199630-acdd-43eb-9b93-dee80ea833fb", CellID->462042388], Cell[639, 25, 192, 3, 70, "Text",ExpressionUUID->"2daf4cf8-6f41-4513-83bb-9bad1aa6596d", CellID->2090272336], Cell[CellGroupData[{ Cell[856, 32, 184, 4, 70, "Input",ExpressionUUID->"5de5f0b6-8430-49e7-92b0-76ea1d4acaa6", CellID->1490974711], Cell[1043, 38, 463, 14, 70, "Output",ExpressionUUID->"9247d91f-26b3-43cb-ba12-d6a9e0b121f4", CellID->1560896536] }, Open ]], Cell[1521, 55, 155, 2, 70, "Text",ExpressionUUID->"0db60812-6efd-4264-b7af-8ee33c227c6d", CellID->13078159], Cell[CellGroupData[{ Cell[1701, 61, 2013, 49, 70, "Input",ExpressionUUID->"bb94fbe1-7783-4633-be01-fecc58d4474a", CellID->443871870], Cell[3717, 112, 281, 7, 70, "Output",ExpressionUUID->"81406fbc-818e-4ba7-9223-09ecde6839b2", CellID->2141881465] }, Open ]], Cell[CellGroupData[{ Cell[4035, 124, 125, 3, 70, "ExampleDelimiter",ExpressionUUID->"f4590e37-51d4-4da2-8007-7d9d3f2ab1be", CellID->136285305], Cell[4163, 129, 139, 2, 70, "Text",ExpressionUUID->"68df9963-25b0-4f73-8f04-41641d027130", CellID->1305732154], Cell[CellGroupData[{ Cell[4327, 135, 1980, 49, 70, "Input",ExpressionUUID->"290aa317-bb11-4c35-b735-31019a69a0dd", CellID->954711353], Cell[6310, 186, 122, 3, 70, "Output",ExpressionUUID->"a394cd9c-8f88-449f-b7ec-9d82b2404d53", CellID->1512492289] }, Open ]], Cell[6447, 192, 186, 3, 70, "Text",ExpressionUUID->"4ebf5217-4d80-46fd-8aef-9e9a05d036b9", CellID->2064568719], Cell[CellGroupData[{ Cell[6658, 199, 1978, 49, 70, "Input",ExpressionUUID->"c8476824-fa45-4f03-8e72-87482cf40b95", CellID->806555239], Cell[8639, 250, 120, 3, 70, "Output",ExpressionUUID->"1d8a9148-a229-4574-bf4e-57e846ea5498", CellID->2066726071] }, Open ]], Cell[8774, 256, 153, 2, 70, "Text",ExpressionUUID->"f3417eea-088b-4d42-853f-bac1d931cd90", CellID->2028958639], Cell[CellGroupData[{ Cell[8952, 262, 1981, 49, 70, "Input",ExpressionUUID->"1a4297dd-9d2a-45eb-9b08-1acbab1af88f", CellID->244345023], Cell[10936, 313, 119, 3, 70, "Output",ExpressionUUID->"15846c6d-8ec1-4f44-af3e-9bb64f5d6e5f", CellID->336291928] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)