(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 11.1' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 11537, 351] NotebookOptionsPosition[ 8563, 278] NotebookOutlinePosition[ 8937, 294] CellTagsIndexPosition[ 8894, 291] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Problema 4.2", "Section", CellChangeTimes->{{3.7185484370633545`*^9, 3.7185484400636773`*^9}},ExpressionUUID->"b5598339-3cf3-4a4e-8c8a-\ ebc2704c2e5c"], Cell[CellGroupData[{ Cell["caso teste, com poucos valores e resultados bem conhecidos", \ "Subsection", CellChangeTimes->{{3.718549531165355*^9, 3.71854954060387*^9}},ExpressionUUID->"39e49f24-ef64-474a-98f8-\ 83f5377a47f8"], Cell[BoxData[ RowBox[{"nmax", "=", "5"}]], "Input", CellChangeTimes->{{3.718549453391369*^9, 3.7185494546102495`*^9}},ExpressionUUID->"d92fa987-90c7-46f1-aabe-\ 5fdbc82571d2"], Cell[BoxData[ RowBox[{"u", "=", RowBox[{"Flatten", "[", " ", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"nx", ",", "ny", ",", "nz", ",", RowBox[{ RowBox[{"nx", "^", "2"}], "+", RowBox[{"ny", "^", "2"}], "+", RowBox[{"nz", "^", "2"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"nx", ",", "nmax"}], "}"}], ",", RowBox[{"{", RowBox[{"ny", ",", "nmax"}], "}"}], ",", RowBox[{"{", RowBox[{"nz", ",", "nmax"}], "}"}]}], "]"}], ",", "2"}], " ", "]"}]}]], "Input",ExpressionUUID->"e35f6e97-ee2c-4f14-8eaf-6a6b679be6d8"], Cell[BoxData[ RowBox[{"v", "=", RowBox[{"SortBy", "[", RowBox[{"u", ",", "Last"}], "]"}]}]], "Input",ExpressionUUID->"e730aedb-\ f3bb-4257-88f9-8872119bd284"], Cell[BoxData[ RowBox[{"w", "=", RowBox[{"CountsBy", "[", RowBox[{"v", ",", "Last"}], "]"}]}]], "Input",ExpressionUUID->"7886cff6-\ 56c4-4766-ade2-aeab9dd3bde1"], Cell[BoxData[ RowBox[{"Union", "[", " ", RowBox[{"Values", "[", "w", "]"}], " ", "]"}]], "Input",ExpressionUUID->\ "7e375f2b-2e7b-4615-827c-367fdd30c9e1"], Cell[BoxData[ RowBox[{"Histogram", "[", RowBox[{"Values", "[", "w", "]"}], "]"}]], "Input",ExpressionUUID->\ "d86755c6-da65-4c85-84af-f0f5f563abcd"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Com um limite superior maior - haver\[AAcute] algum outro caso de \ coincidencia?\ \>", "Subsection", CellChangeTimes->{{3.718549563450076*^9, 3.718549580170624*^9}},ExpressionUUID->"97dab7a3-b614-4a02-8a6e-\ de224284f7ea"], Cell[BoxData[ RowBox[{"nmax", "=", "10"}]], "Input", CellChangeTimes->{{3.718548510196217*^9, 3.718548514368541*^9}, { 3.718548668369472*^9, 3.718548668869526*^9}},ExpressionUUID->"9269e8e2-2851-43a4-a679-\ 408eba0f5717"], Cell[BoxData[ RowBox[{ RowBox[{"u", "=", RowBox[{"Flatten", "[", " ", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"nx", ",", "ny", ",", "nz", ",", RowBox[{ RowBox[{"nx", "^", "2"}], "+", RowBox[{"ny", "^", "2"}], "+", RowBox[{"nz", "^", "2"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"nx", ",", "nmax"}], "}"}], ",", RowBox[{"{", RowBox[{"ny", ",", "nmax"}], "}"}], ",", RowBox[{"{", RowBox[{"nz", ",", "nmax"}], "}"}]}], "]"}], ",", "2"}], " ", "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.7185484446110415`*^9, 3.718548519634732*^9}, { 3.7185485729685907`*^9, 3.7185485825633726`*^9}, 3.718548659305998*^9},ExpressionUUID->"edf1a932-c7cd-4a17-b67e-\ f9104b098181"], Cell[BoxData[ RowBox[{ RowBox[{"v", "=", RowBox[{"SortBy", "[", RowBox[{"u", ",", "Last"}], "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.718548529448287*^9, 3.7185485523726263`*^9}, { 3.718548627693224*^9, 3.718548628224531*^9}, 3.7185486621188*^9},ExpressionUUID->"3ccff3e0-d04c-4909-b61e-30a6080218cf"], Cell[BoxData[ RowBox[{"w", "=", RowBox[{"CountsBy", "[", RowBox[{"v", ",", "Last"}], "]"}]}]], "Input", CellChangeTimes->{{3.7185485990807734`*^9, 3.7185486768078794`*^9}, { 3.7185487378769445`*^9, 3.7185487382051053`*^9}},ExpressionUUID->"1a7025a2-86cf-4c80-8355-\ 479cbd3bd1fb"], Cell[BoxData[ RowBox[{"Union", "[", " ", RowBox[{"Values", "[", "w", "]"}], " ", "]"}]], "Input", CellChangeTimes->{{3.7185487030607014`*^9, 3.718548706654838*^9}, { 3.7185487420492687`*^9, 3.7185487525816507`*^9}},ExpressionUUID->"54e75f31-f9c2-4cf5-84dc-\ fe1254769476"], Cell[BoxData[ RowBox[{"Histogram", "[", RowBox[{"Values", "[", "w", "]"}], "]"}]], "Input", CellChangeTimes->{{3.718548799852358*^9, 3.718548807634444*^9}},ExpressionUUID->"f32ebe05-d854-4de4-93e0-\ d6e36f21ffc5"], Cell[BoxData[ RowBox[{"Select", "[", RowBox[{"w", ",", RowBox[{ RowBox[{"#", "\[Equal]", "7"}], "&"}]}], "]"}]], "Input", CellChangeTimes->{{3.7185489479151506`*^9, 3.7185490028741837`*^9}},ExpressionUUID->"337431d5-b095-4374-8340-\ 33efb280aa54"], Cell[BoxData[ RowBox[{"Select", "[", RowBox[{"u", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "4", "]"}], "]"}], "\[Equal]", "75"}], "&"}]}], "]"}]], "Input", CellChangeTimes->{{3.718549007999735*^9, 3.7185490248921766`*^9}},ExpressionUUID->"f2ae4bb1-23e7-4729-946b-\ 488a6f152074"], Cell[BoxData[ RowBox[{"1", "+", RowBox[{"5", "^", "2"}], "+", RowBox[{"7", "^", "2"}]}]], "Input", CellChangeTimes->{{3.7185490341119184`*^9, 3.718549041940884*^9}},ExpressionUUID->"2cf0ce44-d805-4ae5-ba26-\ 9f37be857dc3"] }, Open ]], Cell[CellGroupData[{ Cell["buscando todas as configura\[CCedilla]\[OTilde]es at\[EAcute] uma \ energia m\[AAcute]xima dada", "Subsection", CellChangeTimes->{{3.7185495927344747`*^9, 3.71854962631621*^9}},ExpressionUUID->"948139e3-bfe8-41b6-a19e-\ ae6a95cb090f"], Cell[BoxData[ RowBox[{"Ceiling", "[", " ", RowBox[{"Sqrt", "[", "300", "]"}], " ", "]"}]], "Input", CellChangeTimes->{{3.7185491613756*^9, 3.7185491833467116`*^9}},ExpressionUUID->"c73b4a63-efad-4a3d-8e37-\ 9e51852ecffe"], Cell[BoxData[ RowBox[{ RowBox[{"u300", "=", RowBox[{"(", RowBox[{ RowBox[{"nmax", "=", "18"}], ";", RowBox[{"Flatten", "[", " ", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"nx", ",", "ny", ",", "nz", ",", RowBox[{ RowBox[{"nx", "^", "2"}], "+", RowBox[{"ny", "^", "2"}], "+", RowBox[{"nz", "^", "2"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"nx", ",", "nmax"}], "}"}], ",", RowBox[{"{", RowBox[{"ny", ",", "nmax"}], "}"}], ",", RowBox[{"{", RowBox[{"nz", ",", "nmax"}], "}"}]}], "]"}], ",", "2"}], " ", "]"}]}], ")"}]}], ";"}]], "Input", CellChangeTimes->{{3.7185492016768074`*^9, 3.718549215068872*^9}},ExpressionUUID->"75fd6528-7e42-4bb5-8e25-\ 5cd58047154c"], Cell[BoxData[ RowBox[{ RowBox[{"v300", "=", RowBox[{"Select", "[", RowBox[{"u300", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "4", "]"}], "]"}], "\[LessEqual]", "300"}], "&"}]}], "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.7185492311643524`*^9, 3.7185492423999352`*^9}, { 3.7185492929834986`*^9, 3.7185493172517323`*^9}},ExpressionUUID->"a51dae74-2546-428e-9015-\ 5a8b0edfae53"], Cell[BoxData[ RowBox[{"Length", "[", "v300", "]"}]], "Input", CellChangeTimes->{{3.7185493243931255`*^9, 3.718549327190301*^9}},ExpressionUUID->"dd9ca59a-25bd-4014-b726-\ b75c7bd5d6ba"], Cell[BoxData[ RowBox[{"w300", "=", RowBox[{"CountsBy", "[", RowBox[{"v300", ",", "Last"}], "]"}]}]], "Input", CellChangeTimes->{{3.7185493404573526`*^9, 3.7185493449422092`*^9}},ExpressionUUID->"1ab514c7-78fb-4a38-bf3d-\ f11e1c58942e"], Cell[BoxData[ RowBox[{"Union", "[", " ", RowBox[{"Values", "[", "w300", "]"}], " ", "]"}]], "Input", CellChangeTimes->{{3.71854936122521*^9, 3.7185493615533705`*^9}},ExpressionUUID->"f59c288a-c19d-4cc8-85f0-\ 1caddd12ec48"], Cell[BoxData[ RowBox[{"Histogram", "[", RowBox[{ RowBox[{"Values", "[", "w300", "]"}], ",", RowBox[{"{", "1", "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.71854937713317*^9, 3.718549384258936*^9}},ExpressionUUID->"e43c57be-72e4-4a91-9218-\ 539390209c93"] }, Open ]] }, Open ]] }, WindowSize->{758, 833}, WindowMargins->{{573, Automatic}, {64, Automatic}}, Magnification:>0.9 Inherited, FrontEndVersion->"11.1 for Microsoft Windows (64-bit) (April 18, 2017)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 161, 3, 62, "Section", "ExpressionUUID" -> \ "b5598339-3cf3-4a4e-8c8a-ebc2704c2e5c"], Cell[CellGroupData[{ Cell[766, 29, 207, 4, 45, "Subsection", "ExpressionUUID" -> \ "39e49f24-ef64-474a-98f8-83f5377a47f8"], Cell[976, 35, 180, 4, 28, "Input", "ExpressionUUID" -> \ "d92fa987-90c7-46f1-aabe-5fdbc82571d2"], Cell[1159, 41, 643, 18, 28, "Input", "ExpressionUUID" -> \ "e35f6e97-ee2c-4f14-8eaf-6a6b679be6d8"], Cell[1805, 61, 166, 4, 28, "Input", "ExpressionUUID" -> \ "e730aedb-f3bb-4257-88f9-8872119bd284"], Cell[1974, 67, 168, 4, 28, "Input", "ExpressionUUID" -> \ "7886cff6-56c4-4766-ade2-aeab9dd3bde1"], Cell[2145, 73, 158, 3, 28, "Input", "ExpressionUUID" -> \ "7e375f2b-2e7b-4615-827c-367fdd30c9e1"], Cell[2306, 78, 152, 3, 28, "Input", "ExpressionUUID" -> \ "d86755c6-da65-4c85-84af-f0f5f563abcd"] }, Open ]], Cell[CellGroupData[{ Cell[2495, 86, 237, 6, 45, "Subsection", "ExpressionUUID" -> \ "97dab7a3-b614-4a02-8a6e-de224284f7ea"], Cell[2735, 94, 228, 5, 28, "Input", "ExpressionUUID" -> \ "9269e8e2-2851-43a4-a679-408eba0f5717"], Cell[2966, 101, 826, 23, 28, "Input", "ExpressionUUID" -> \ "edf1a932-c7cd-4a17-b67e-f9104b098181"], Cell[3795, 126, 326, 7, 28, "Input", "ExpressionUUID" -> \ "3ccff3e0-d04c-4909-b61e-30a6080218cf"], Cell[4124, 135, 294, 7, 28, "Input", "ExpressionUUID" -> \ "1a7025a2-86cf-4c80-8355-479cbd3bd1fb"], Cell[4421, 144, 282, 6, 28, "Input", "ExpressionUUID" -> \ "54e75f31-f9c2-4cf5-84dc-fe1254769476"], Cell[4706, 152, 221, 5, 28, "Input", "ExpressionUUID" -> \ "f32ebe05-d854-4de4-93e0-d6e36f21ffc5"], Cell[4930, 159, 263, 7, 28, "Input", "ExpressionUUID" -> \ "337431d5-b095-4374-8340-33efb280aa54"], Cell[5196, 168, 323, 10, 28, "Input", "ExpressionUUID" -> \ "f2ae4bb1-23e7-4729-946b-488a6f152074"], Cell[5522, 180, 233, 6, 28, "Input", "ExpressionUUID" -> \ "2cf0ce44-d805-4ae5-ba26-9f37be857dc3"] }, Open ]], Cell[CellGroupData[{ Cell[5792, 191, 244, 4, 45, "Subsection", "ExpressionUUID" -> \ "948139e3-bfe8-41b6-a19e-ae6a95cb090f"], Cell[6039, 197, 229, 5, 28, "Input", "ExpressionUUID" -> \ "c73b4a63-efad-4a3d-8e37-9e51852ecffe"], Cell[6271, 204, 867, 25, 47, "Input", "ExpressionUUID" -> \ "75fd6528-7e42-4bb5-8e25-5cd58047154c"], Cell[7141, 231, 443, 13, 28, "Input", "ExpressionUUID" -> \ "a51dae74-2546-428e-9015-5a8b0edfae53"], Cell[7587, 246, 190, 4, 28, "Input", "ExpressionUUID" -> \ "dd9ca59a-25bd-4014-b726-b75c7bd5d6ba"], Cell[7780, 252, 247, 6, 28, "Input", "ExpressionUUID" -> \ "1ab514c7-78fb-4a38-bf3d-f11e1c58942e"], Cell[8030, 260, 231, 5, 28, "Input", "ExpressionUUID" -> \ "f59c288a-c19d-4cc8-85f0-1caddd12ec48"], Cell[8264, 267, 271, 7, 28, "Input", "ExpressionUUID" -> \ "e43c57be-72e4-4a91-9218-539390209c93"] }, Open ]] }, Open ]] } ] *)