(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 10.2' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 23840, 677] NotebookOptionsPosition[ 20523, 575] NotebookOutlinePosition[ 20899, 591] CellTagsIndexPosition[ 20856, 588] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Introduction to Mathematica", "Title", CellChangeTimes->{{3.6660391054616375`*^9, 3.666039123583289*^9}}], Cell["Vito, March 2017", "Text", CellChangeTimes->{{3.6660391342891912`*^9, 3.6660391478536825`*^9}, { 3.6819866909501514`*^9, 3.6819866947018976`*^9}, {3.6991176523405695`*^9, 3.6991176586881323`*^9}}], Cell["Class 4", "Section", CellChangeTimes->{{3.6819872339244375`*^9, 3.6819872360021133`*^9}, { 3.6820930745612793`*^9, 3.6820930756238537`*^9}, 3.682095138063218*^9}], Cell[CellGroupData[{ Cell["Vectors and matrices", "Section", CellChangeTimes->{{3.666866193948423*^9, 3.6668662002564015`*^9}, { 3.6820930804964523`*^9, 3.6820930895665035`*^9}}], Cell[CellGroupData[{ Cell["Rectangular matrices", "Subsection", CellChangeTimes->{{3.6668690715678587`*^9, 3.666869074785453*^9}, { 3.682308525440036*^9, 3.6823085415728436`*^9}}], Cell[BoxData[ RowBox[{"rectangular", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"10", "*", "i"}], "+", "j"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "2"}], "}"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.58610932472606*^9, 3.586109381851059*^9}, 3.682308545674111*^9}], Cell[BoxData[ RowBox[{"TableForm", "[", RowBox[{"rectangular", ",", RowBox[{"TableHeadings", "\[Rule]", RowBox[{"{", RowBox[{"None", ",", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], "}"}]}]}], "]"}]], "Input", CellChangeTimes->{{3.666869090661817*^9, 3.6668690998683014`*^9}, { 3.6668691542362423`*^9, 3.6668692257005143`*^9}, {3.682308551843377*^9, 3.682308579958494*^9}}], Cell[BoxData[ RowBox[{"Dimensions", "[", "rectangular", "]"}]], "Input", CellChangeTimes->{{3.66686925240873*^9, 3.666869257795206*^9}, 3.682308595220558*^9}], Cell[BoxData[ RowBox[{"Length", "[", "rectangular", "]"}]], "Input", CellChangeTimes->{{3.666869263084894*^9, 3.666869267488183*^9}, 3.682308599636306*^9}], Cell[BoxData[ RowBox[{"Length", "[", RowBox[{"rectangular", "[", RowBox[{"[", "1", "]"}], "]"}], " ", "]"}]], "Input", CellChangeTimes->{{3.6668692699452085`*^9, 3.6668692785526085`*^9}, 3.682308603974989*^9}], Cell["Extracting one line is simple", "Text", CellChangeTimes->{{3.586109620163559*^9, 3.5861096283041825`*^9}, { 3.6823086123756504`*^9, 3.682308624046011*^9}}], Cell[BoxData[ RowBox[{"rectangular", "[", RowBox[{"[", "3", "]"}], "]"}]], "Input", CellChangeTimes->{{3.666869320249824*^9, 3.666869323006152*^9}, 3.682308629747741*^9}], Cell["\<\ Getting an element is a generalization of the indexing rule for single level \ lists\ \>", "Text", CellChangeTimes->{{3.586109636585434*^9, 3.586109669585434*^9}, { 3.6823086356884084`*^9, 3.6823086659824657`*^9}}], Cell[BoxData[ RowBox[{"rectangular", "[", RowBox[{"[", RowBox[{"3", ",", "2"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.66686934478911*^9, 3.666869349094931*^9}, 3.6823086687067184`*^9}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"rectangular", "[", RowBox[{"[", RowBox[{"2", ",", "3"}], "]"}], "]"}], " "}]], "Input", CellChangeTimes->{{3.666869358451232*^9, 3.66686941684011*^9}, { 3.682308675088564*^9, 3.6823086837939277`*^9}}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"Part", "::", "partw"}], "MessageName"], ":", " ", "\<\"Part \[NoBreak]\\!\\(\\*RowBox[{\\\"3\\\"}]\\)\[NoBreak] of \ \[NoBreak]\\!\\(\\*RowBox[{\\\"{\\\", RowBox[{\\\"21\\\", \\\",\\\", \\\"22\\\ \"}], \\\"}\\\"}]\\)\[NoBreak] does not exist. \\!\\(\\*ButtonBox[\\\"\ \[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/partw\\\", ButtonNote -> \ \\\"Part::partw\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.6668822797990694`*^9, 3.667033791215582*^9, 3.6820936815385494`*^9, 3.6823086762108383`*^9, 3.6823087355816355`*^9, 3.6823149336395273`*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"MessageList", "[", RowBox[{"-", "1"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{ RowBox[{ RowBox[{"MessageList", "[", "n", "]"}], " ", "will", " ", "ask", " ", "for", " ", "messages", " ", "from", " ", "instruction", " ", RowBox[{"In", "[", "n", "]"}]}], ";", " ", RowBox[{"the", " ", "-", RowBox[{"1", " ", "means", " ", "\"\\""}]}]}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.6668698068967457`*^9, 3.666869818928957*^9}, { 3.6670341554914293`*^9, 3.667034199584874*^9}, {3.6823087225493126`*^9, 3.6823088052723937`*^9}}], Cell["Getting a column seems weird at the beginning ", "Text", CellChangeTimes->{{3.586109705444809*^9, 3.586109719772934*^9}, { 3.682308817358671*^9, 3.682308832014282*^9}}], Cell[BoxData[ RowBox[{"rectangular", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.5861097238979344`*^9, 3.586109729194809*^9}, 3.6823088364504976`*^9}], Cell[BoxData[ RowBox[{"MessageList", "[", RowBox[{"-", "1"}], "]"}]], "Input", CellChangeTimes->{{3.666869835576912*^9, 3.6668698391485195`*^9}, { 3.6670341654774265`*^9, 3.667034203356772*^9}, {3.6823088419353867`*^9, 3.682308842750789*^9}}], Cell["\<\ Last output is a void list. Even if it is void, it is an object, it exists, \ and it is possible to include it in subsequent commands\ \>", "Text", CellChangeTimes->{{3.6823088695566463`*^9, 3.682308932182022*^9}}], Cell[BoxData[ RowBox[{"rectangular", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.5861097238979344`*^9, 3.586109729194809*^9}, { 3.666869462242732*^9, 3.6668694623586855`*^9}, 3.682308849419431*^9}], Cell[BoxData[ RowBox[{"m", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"11", ",", "12"}], "}"}], ",", RowBox[{"{", RowBox[{"21", ",", "22"}], "}"}]}], "}"}]}]], "Input", CellChangeTimes->{ 3.666869472098768*^9, {3.68230895244427*^9, 3.6823089653271804`*^9}}], Cell[BoxData[ RowBox[{"rectangular", ".", "m"}]], "Input", CellChangeTimes->{{3.6668694758562875`*^9, 3.6668695044976616`*^9}, 3.682308969390927*^9}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"m", ".", "rectangular"}]], "Input", CellChangeTimes->{{3.666869507898158*^9, 3.666869509529929*^9}, 3.6823089759754505`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"Dot", "::", "dotsh"}], "MessageName"], ":", " ", "\<\"Tensors \[NoBreak]\\!\\(\\*RowBox[{\\\"{\\\", \ RowBox[{RowBox[{\\\"{\\\", RowBox[{\\\"11\\\", \\\",\\\", \\\"12\\\"}], \\\"}\ \\\"}], \\\",\\\", RowBox[{\\\"{\\\", RowBox[{\\\"21\\\", \\\",\\\", \\\"22\\\ \"}], \\\"}\\\"}]}], \\\"}\\\"}]\\)\[NoBreak] and \[NoBreak]\\!\\(\\*RowBox[{\ \\\"{\\\", RowBox[{RowBox[{\\\"{\\\", RowBox[{\\\"11\\\", \\\",\\\", \\\"12\\\ \"}], \\\"}\\\"}], \\\",\\\", RowBox[{\\\"{\\\", RowBox[{\\\"21\\\", \ \\\",\\\", \\\"22\\\"}], \\\"}\\\"}], \\\",\\\", RowBox[{\\\"{\\\", \ RowBox[{\\\"31\\\", \\\",\\\", \\\"32\\\"}], \\\"}\\\"}], \\\",\\\", RowBox[{\ \\\"{\\\", RowBox[{\\\"41\\\", \\\",\\\", \\\"42\\\"}], \\\"}\\\"}]}], \ \\\"}\\\"}]\\)\[NoBreak] have incompatible shapes. \\!\\(\\*ButtonBox[\\\"\ \[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/Dot/dotsh\\\", ButtonNote -> \ \\\"Dot::dotsh\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.666882279902338*^9, 3.667033791315854*^9, 3.682093681719458*^9, 3.68230897694648*^9, 3.682314933808646*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"Transpose", "[", "rectangular", "]"}], "//", "MatrixForm"}]], "Input", CellChangeTimes->{{3.6668698779201*^9, 3.666869901788313*^9}, 3.682308982651268*^9}] }, Open ]], Cell[CellGroupData[{ Cell["Back to the square matrices", "Subsection", CellChangeTimes->{{3.666869917286407*^9, 3.6668699261261606`*^9}, { 3.6823089894377627`*^9, 3.6823090013027554`*^9}}], Cell[BoxData[ RowBox[{"Inverse", "[", "m", "]"}]], "Input", CellChangeTimes->{{3.6668699292804985`*^9, 3.6668699328347936`*^9}}], Cell[BoxData[ RowBox[{"m", ".", RowBox[{"Inverse", "[", "m", "]"}]}]], "Input", CellChangeTimes->{{3.6668699367659297`*^9, 3.666869940320856*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"N", "[", "m", "]"}], ".", RowBox[{"Inverse", "[", RowBox[{"N", "[", "m", "]"}], " ", "]"}]}]], "Input", CellChangeTimes->{{3.6668699552794194`*^9, 3.6668699737951403`*^9}}], Cell[BoxData[ RowBox[{"Chop", "[", "%", "]"}]], "Input", CellChangeTimes->{{3.6668699782296104`*^9, 3.6668699825694437`*^9}}], Cell[BoxData[ RowBox[{"d", "=", RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}]}]], "Input", CellChangeTimes->{{3.6823090175777407`*^9, 3.6823090213481045`*^9}}], Cell[BoxData[ RowBox[{"p", "=", RowBox[{"LinearSolve", "[", RowBox[{"m", ",", "d"}], "]"}]}]], "Input", CellChangeTimes->{{3.6823090231954775`*^9, 3.6823090486434975`*^9}}], Cell[BoxData[ RowBox[{"m", ".", "p"}]], "Input", CellChangeTimes->{{3.682309052907494*^9, 3.682309056878361*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"m", ".", "p"}], "\[Equal]", "d"}]], "Input", CellChangeTimes->{{3.6823090613945117`*^9, 3.682309063763095*^9}}], Cell[BoxData[ RowBox[{"Eigenvalues", "[", "m", "]"}]], "Input", CellChangeTimes->{{3.666869992923236*^9, 3.6668699977961373`*^9}}], Cell[BoxData[ RowBox[{"Eigenvectors", "[", "m", "]"}]], "Input", CellChangeTimes->{{3.6668700026686263`*^9, 3.6668700082877736`*^9}}], Cell[BoxData[ RowBox[{"r", "=", RowBox[{"Eigensystem", "[", "m", "]"}]}]], "Input", CellChangeTimes->{{3.666870011053521*^9, 3.666870029287456*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"r", "[", RowBox[{"[", "1", "]"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{"just", " ", "the", " ", "eigenvalues"}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.6668700324148755`*^9, 3.6668700333621707`*^9}, { 3.682309260189253*^9, 3.6823092706219873`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"r", "[", RowBox[{"[", "2", "]"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{"just", " ", "the", " ", "eigenvectors"}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.666870037082029*^9, 3.666870038121274*^9}, { 3.682309276138508*^9, 3.6823092815723605`*^9}}], Cell["\<\ One possibility for decomposing a return-values which is a multiple level \ list is giving a structured target for the assignment, example:\ \>", "Text", CellChangeTimes->{{3.6823091197168274`*^9, 3.6823092411143603`*^9}, { 3.6823151002548456`*^9, 3.682315145657078*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"{", RowBox[{"v1", ",", "v2"}], "}"}]}], "}"}], "=", RowBox[{"Eigensystem", "[", "m", "]"}]}]], "Input", CellChangeTimes->{{3.6668701694561663`*^9, 3.666870198352992*^9}}], Cell[BoxData["\[Lambda]"], "Input", CellChangeTimes->{{3.6668702050041866`*^9, 3.666870205272899*^9}}], Cell[BoxData["v1"], "Input", CellChangeTimes->{{3.6668702112462316`*^9, 3.6668702116622148`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"m", ".", "v1"}], "//", "FullSimplify"}]], "Input", CellChangeTimes->{{3.666870219970218*^9, 3.6668702469762497`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"\[Lambda]", " ", "v1"}], "//", "FullSimplify"}]], "Input", CellChangeTimes->{{3.6668702274627476`*^9, 3.666870260764535*^9}}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Operations with lists: generating new vectors and new matrices from lists \ \>", "Section", CellChangeTimes->{{3.666870309347675*^9, 3.666870342841636*^9}, { 3.682311439149308*^9, 3.6823114654938745`*^9}}], Cell["Joining two lists is straightforward", "Text", CellChangeTimes->{{3.586109877132309*^9, 3.586109884944809*^9}, { 3.6823114693653374`*^9, 3.6823114816514587`*^9}}], Cell[BoxData[ RowBox[{"a", "=", RowBox[{"Range", "[", RowBox[{"11", ",", "14"}], "]"}]}]], "Input", CellChangeTimes->{{3.682311513894214*^9, 3.682311520530534*^9}}], Cell[BoxData[ RowBox[{"b", "=", RowBox[{"Range", "[", RowBox[{ RowBox[{"-", "0.7"}], ",", "0.5", ",", ".33"}], "]"}]}]], "Input", CellChangeTimes->{{3.6823115242145324`*^9, 3.6823115514209285`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Join", "[", RowBox[{"a", ",", "b"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{ "all", " ", "elements", " ", "in", " ", "the", " ", "same", " ", "list"}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.6668703805753303`*^9, 3.666870384147911*^9}, { 3.666883274000182*^9, 3.6668832988377037`*^9}, {3.6823114879542613`*^9, 3.6823114977042294`*^9}}], Cell["now, in two different lines, forming a matrix", "Text", CellChangeTimes->{{3.6668832627377443`*^9, 3.6668832702962704`*^9}, { 3.682311570126882*^9, 3.6823115920190916`*^9}}], Cell[BoxData[ RowBox[{"Join", "[", RowBox[{"{", RowBox[{"a", ",", "b"}], "}"}], "]"}]], "Input", CellChangeTimes->{{3.6668832344273777`*^9, 3.6668832464240937`*^9}}], Cell["\<\ It is possible to join two lists, eliminating repeated elements\ \>", "Text", CellChangeTimes->{{3.666870398560439*^9, 3.666870409168497*^9}, { 3.682311662118614*^9, 3.6823116922136097`*^9}}], Cell[BoxData[ RowBox[{"i1", "=", RowBox[{"RandomInteger", "[", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "10"}], "}"}], ",", "6"}], "]"}]}]], "Input", CellChangeTimes->{{3.6668704121009226`*^9, 3.666870442617361*^9}, { 3.6823116951453457`*^9, 3.682311698782095*^9}}], Cell[BoxData[ RowBox[{"i2", "=", RowBox[{"RandomInteger", "[", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "10"}], "}"}], ",", "6"}], "]"}]}]], "Input", CellChangeTimes->{{3.6668704275890136`*^9, 3.666870439267531*^9}, { 3.6823117022817793`*^9, 3.6823117058138323`*^9}}], Cell[BoxData[ RowBox[{"Join", "[", RowBox[{"i1", ",", "i2"}], "]"}]], "Input", CellChangeTimes->{{3.666870451527505*^9, 3.666870455778307*^9}}], Cell[BoxData[ RowBox[{"Length", "[", "%", "]"}]], "Input", CellChangeTimes->{{3.666870457732229*^9, 3.6668704628022137`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Union", "[", RowBox[{"i1", ",", "i2"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{ "we", " ", "sorted", " ", "12", " ", "numbers", " ", "from", " ", "1", " ", "to", " ", "10", " ", "but", " ", "likely", " ", "a", " ", "few", " ", "numbers", " ", "will", " ", "not", " ", "be", " ", "sampled"}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.666870464872845*^9, 3.666870469344569*^9}, { 3.682311727250108*^9, 3.682311804854471*^9}}], Cell[BoxData[ RowBox[{"Length", "[", "%", "]"}]], "Input", CellChangeTimes->{{3.6668704771652765`*^9, 3.6668704810010333`*^9}}], Cell["Adding a column to a matrix is tricky", "Text", CellChangeTimes->{{3.586110043038559*^9, 3.586110048241684*^9}, { 3.682311832812401*^9, 3.682311843066121*^9}, {3.682311881330665*^9, 3.682311884302275*^9}}], Cell[BoxData[ RowBox[{"f", "=", RowBox[{"Range", "[", RowBox[{"31", ",", "34"}], "]"}]}]], "Input", CellChangeTimes->{{3.666870558567953*^9, 3.6668705673040495`*^9}, { 3.6670343444127836`*^9, 3.6670343478700094`*^9}}], Cell[BoxData[ RowBox[{"t", "=", RowBox[{"Join", "[", RowBox[{"rectangular", ",", RowBox[{"Transpose", "[", RowBox[{"{", "f", "}"}], "]"}], ",", "2"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{ RowBox[{"Last", " ", "parameter", " ", "tells", " ", RowBox[{"Join", "[", " ", "]"}], " ", "to", " ", "add", " ", "the", " ", "list", " ", "at", " ", "its", " ", "2", "nd", " ", RowBox[{"level", ".", "\[IndentingNewLine]", "The"}], " ", "added", " ", "list", " ", "MUST", " ", "have", " ", "two", " ", "indices"}], ",", " ", "\[IndentingNewLine]", RowBox[{ "then", " ", "we", " ", "added", " ", "extra", " ", "brackets", " ", "to", " ", "f"}], ",", " ", RowBox[{ RowBox[{"{", "f", "}"}], ".", "\[IndentingNewLine]", "Remember"}], ",", " ", RowBox[{ RowBox[{ "Mathematica", " ", "does", " ", "not", " ", "distinguish", " ", "a", " ", "row", " ", "vector", " ", "from", " ", "a", " ", "column", " ", "vector"}], " ", "-", " ", RowBox[{ "both", " ", "are", " ", "single", " ", "level", " ", "lists"}]}], ",", " ", "which", ",", " ", RowBox[{"at", " ", "end"}], ",", " ", RowBox[{"is", " ", "natural", " ", "and", " ", RowBox[{"convenient", "."}]}]}], "*)"}]}]], "Input", CellChangeTimes->{{3.586110053976059*^9, 3.586110154304184*^9}, { 3.586110184351059*^9, 3.586110280210434*^9}, {3.586110343772934*^9, 3.586110344304184*^9}, {3.6668705437384377`*^9, 3.666870639706212*^9}, { 3.6823119013069696`*^9, 3.6823119443056173`*^9}, {3.682312281267168*^9, 3.6823124798567734`*^9}, {3.682312599372781*^9, 3.682312636486033*^9}}], Cell[BoxData[ RowBox[{"t", "//", "MatrixForm"}]], "Input", CellChangeTimes->{{3.666870654405961*^9, 3.666870661157984*^9}}], Cell["It is possible to eliminate dimensions", "Text", CellChangeTimes->{{3.6668706900829945`*^9, 3.666870695671714*^9}, { 3.682312648484084*^9, 3.6823126620911503`*^9}}], Cell[BoxData[ RowBox[{"s", "=", RowBox[{"Flatten", "[", "t", "]"}]}]], "Input", CellChangeTimes->{{3.666870673483468*^9, 3.666870675785844*^9}, { 3.666870718141924*^9, 3.6668707222838607`*^9}}], Cell["and group elements", "Text", CellChangeTimes->{{3.6668707040123897`*^9, 3.6668707094324512`*^9}, { 3.6823126690273695`*^9, 3.6823126772432294`*^9}}], Cell[BoxData[ RowBox[{"Partition", "[", RowBox[{"s", ",", "4"}], "]"}]], "Input", CellChangeTimes->{{3.666870726748993*^9, 3.6668707346233873`*^9}}], Cell[BoxData[ RowBox[{"Partition", "[", RowBox[{"s", ",", "2"}], "]"}]], "Input", CellChangeTimes->{{3.66687074034548*^9, 3.666870746306445*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Partition", "[", RowBox[{"s", ",", "5"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{ RowBox[{ "throws", " ", "away", " ", "the", " ", "elements", " ", "that", " ", RowBox[{"don", "'"}], "t", " ", "fit", " ", "in", " ", "the", " ", "matrix"}], ";", RowBox[{ "there", " ", "are", " ", "options", " ", "to", " ", "avoid", " ", "that"}]}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.666870749057397*^9, 3.666870794937756*^9}, { 3.6668708992688084`*^9, 3.666870910709882*^9}, {3.6823126901929483`*^9, 3.6823127459256735`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["Exerc\[IAcute]cio", "Section", CellChangeTimes->{{3.6823127822240195`*^9, 3.6823127844092264`*^9}, { 3.6991184044766607`*^9, 3.6991184064756975`*^9}}], Cell["\<\ 5) A fun\[CCedilla]\[ATilde]o densidade de probabilidade uniforme Investigar a distribui\[CCedilla]\[ATilde]o do erro de arredondamento na soma \ de um n\[UAcute]mero grande de parcelas i. Sorteie um conjunto de n\[UAcute]meros aleat\[OAcute]rios reais u com \ 12 elementos; sorteie valores maiores que 1. ii. Crie outro conjunto com os valores de u arredondados de forma a \ apresentarem uma \[UAcute]nica casa decimal. iii. Determine a diferen\[CCedilla]a entre a soma de todos os elementos de u \ e a soma de todos os elementos do conjunto arredondado iv. Re\[UAcute]na todos os itens anteriores em uma \[UAcute]nica sequencia de \ instru\[CCedilla]\[OTilde]es, separadas por ; v. Fa\[CCedilla]a uma tabela com um n\[UAcute]mero grande dos erros de \ arredondamento vi. Histograme a tabela e verifiique se o resultado combina com a previs\ \[ATilde]o te\[OAcute]rica. vii. Coloque a instru\[CCedilla]\[ATilde]o Table dentro de Histogram e \ explore a depend\[EHat]ncia do erro com o n\[UAcute]mero de parcelas da soma. \ \>", "Text", CellChangeTimes->{{3.6823128134362707`*^9, 3.6823133624919786`*^9}, { 3.6823142897374783`*^9, 3.682314337563176*^9}, {3.6823149503178635`*^9, 3.6823149919953594`*^9}, {3.699117541967653*^9, 3.699117575821026*^9}, { 3.699118256933425*^9, 3.6991183548255463`*^9}}] }, Open ]] }, Open ]] }, WindowSize->{1012, 725}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, Magnification:>1.3 Inherited, 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, 112, 1, 131, "Title"], Cell[695, 25, 208, 3, 39, "Text"], Cell[906, 30, 172, 2, 91, "Section"], Cell[CellGroupData[{ Cell[1103, 36, 160, 2, 71, "Section"], Cell[CellGroupData[{ Cell[1288, 42, 161, 2, 61, "Subsection"], Cell[1452, 46, 390, 11, 39, "Input"], Cell[1845, 59, 452, 11, 39, "Input"], Cell[2300, 72, 164, 3, 39, "Input"], Cell[2467, 77, 161, 3, 39, "Input"], Cell[2631, 82, 222, 5, 39, "Input"], Cell[2856, 89, 164, 2, 39, "Text"], Cell[3023, 93, 179, 4, 39, "Input"], Cell[3205, 99, 227, 5, 39, "Text"], Cell[3435, 106, 204, 5, 39, "Input"], Cell[CellGroupData[{ Cell[3664, 115, 248, 6, 39, "Input"], Cell[3915, 123, 677, 12, 29, "Message"] }, Open ]], Cell[4607, 138, 637, 15, 65, "Input"], Cell[5247, 155, 177, 2, 39, "Text"], Cell[5427, 159, 209, 5, 39, "Input"], Cell[5639, 166, 252, 5, 39, "Input"], Cell[5894, 173, 225, 4, 64, "Text"], Cell[6122, 179, 255, 5, 39, "Input"], Cell[6380, 186, 294, 9, 39, "Input"], Cell[6677, 197, 155, 3, 39, "Input"], Cell[CellGroupData[{ Cell[6857, 204, 153, 3, 39, "Input"], Cell[7013, 209, 1155, 18, 29, "Message"] }, Open ]], Cell[8183, 230, 198, 5, 39, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[8418, 240, 170, 2, 61, "Subsection"], Cell[8591, 244, 130, 2, 39, "Input"], Cell[8724, 248, 151, 3, 39, "Input"], Cell[8878, 253, 215, 5, 39, "Input"], Cell[9096, 260, 127, 2, 39, "Input"], Cell[9226, 264, 166, 4, 39, "Input"], Cell[9395, 270, 181, 4, 39, "Input"], Cell[9579, 276, 115, 2, 39, "Input"], Cell[9697, 280, 147, 3, 39, "Input"], Cell[9847, 285, 132, 2, 39, "Input"], Cell[9982, 289, 135, 2, 39, "Input"], Cell[10120, 293, 153, 3, 39, "Input"], Cell[10276, 298, 306, 7, 39, "Input"], Cell[10585, 307, 303, 7, 39, "Input"], Cell[10891, 316, 284, 5, 64, "Text"], Cell[11178, 323, 263, 7, 39, "Input"], Cell[11444, 332, 103, 1, 39, "Input"], Cell[11550, 335, 98, 1, 39, "Input"], Cell[11651, 338, 153, 3, 39, "Input"], Cell[11807, 343, 161, 3, 39, "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[12017, 352, 218, 4, 145, "Section"], Cell[12238, 358, 171, 2, 39, "Text"], Cell[12412, 362, 173, 4, 39, "Input"], Cell[12588, 368, 211, 5, 39, "Input"], Cell[12802, 375, 401, 10, 39, "Input"], Cell[13206, 387, 182, 2, 39, "Text"], Cell[13391, 391, 174, 4, 39, "Input"], Cell[13568, 397, 204, 4, 39, "Text"], Cell[13775, 403, 285, 7, 39, "Input"], Cell[14063, 412, 287, 7, 39, "Input"], Cell[14353, 421, 148, 3, 39, "Input"], Cell[14504, 426, 127, 2, 39, "Input"], Cell[14634, 430, 494, 11, 65, "Input"], Cell[15131, 443, 129, 2, 39, "Input"], Cell[15263, 447, 217, 3, 39, "Text"], Cell[15483, 452, 228, 5, 39, "Input"], Cell[15714, 459, 1671, 35, 165, "Input"], Cell[17388, 496, 125, 2, 39, "Input"], Cell[17516, 500, 173, 2, 39, "Text"], Cell[17692, 504, 200, 4, 39, "Input"], Cell[17895, 510, 157, 2, 39, "Text"], Cell[18055, 514, 153, 3, 39, "Input"], Cell[18211, 519, 150, 3, 39, "Input"], Cell[18364, 524, 609, 15, 65, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[19010, 544, 159, 2, 91, "Section"], Cell[19172, 548, 1323, 23, 313, "Text"] }, Open ]] }, Open ]] } ] *)