(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 7642, 243] NotebookOptionsPosition[ 6721, 206] NotebookOutlinePosition[ 7078, 222] CellTagsIndexPosition[ 7035, 219] WindowFrame->Normal ContainsDynamic->True *) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Lesson 2 Answers - Working with Cells and Notebooks", "Section", CellChangeTimes->{{3.460049885048273*^9, 3.460049888247829*^9}, { 3.460061786073359*^9, 3.460061799842352*^9}, {3.463231390908778*^9, 3.463231392976343*^9}, {3.463231441764318*^9, 3.463231443745244*^9}, { 3.465130301229298*^9, 3.4651303022900133`*^9}}], Cell[TextData[{ "Find out what you can about random numbers in ", StyleBox["Mathematica", FontSlant->"Italic"], ". Starting with the following questions:" }], "Text", CellChangeTimes->{{3.463230685795549*^9, 3.463230737303554*^9}, { 3.463230817505023*^9, 3.4632308213529873`*^9}}], Cell[TextData[{ "1) Find all ", StyleBox["Mathematica", FontSlant->"Italic"], " function names that contain ", StyleBox["Random", "Input"], "." }], "Text", CellChangeTimes->{{3.463230742354185*^9, 3.4632307430635138`*^9}, { 3.463230785384301*^9, 3.463230830352964*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"?", "*Random*"}]], "Input", CellChangeTimes->{{3.463230844982129*^9, 3.463230863130466*^9}}], Cell[BoxData[ DynamicModuleBox[{Typeset`open$$ = True}, PaneSelectorBox[{False-> RowBox[{ OpenerBox[Dynamic[Typeset`open$$], ImageSize->Small], StyleBox["System`", "InfoHeading"]}], True->GridBox[{ { RowBox[{ OpenerBox[Dynamic[Typeset`open$$], ImageSize->Small], StyleBox["System`", "InfoHeading"]}]}, {GridBox[{ { ButtonBox["BlockRandom", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`BlockRandom"}, ButtonNote->"System`"], ButtonBox["RandomChoice", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`RandomChoice"}, ButtonNote->"System`"], ButtonBox["RandomInteger", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`RandomInteger"}, ButtonNote->"System`"], ButtonBox["RandomReal", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`RandomReal"}, ButtonNote->"System`"], ButtonBox["RandomSeed", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`RandomSeed"}, ButtonNote->"System`"], ButtonBox["$RandomState", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`$RandomState"}, ButtonNote->"System`"]}, { ButtonBox["Random", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`Random"}, ButtonNote->"System`"], ButtonBox["RandomComplex", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`RandomComplex"}, ButtonNote->"System`"], ButtonBox["RandomPrime", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`RandomPrime"}, ButtonNote->"System`"], ButtonBox["RandomSample", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`RandomSample"}, ButtonNote->"System`"], ButtonBox["SeedRandom", BaseStyle->"InformationLink", ButtonData:>{"Info3463205664-7651452", "System`SeedRandom"}, ButtonNote->"System`"], ""} }, DefaultBaseStyle->"InfoGrid", GridBoxItemSize->{"Columns" -> {{ Scaled[0.15833333333333333`]}}}]} }, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}]}, Dynamic[Typeset`open$$], ImageSize->Automatic]]], "Print", "InfoCell", CellChangeTimes->{3.4632308643625174`*^9}] }, Open ]], Cell[TextData[{ "2) Find a ", StyleBox["Mathematica", FontSlant->"Italic"], " function that generates one random integer between 1 and 6", StyleBox[".", "Subsubsection"] }], "Text", CellChangeTimes->{{3.463230884354501*^9, 3.463230951418915*^9}, 3.463231170159836*^9}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], "]"}]], "Input", CellChangeTimes->{{3.4632309561569843`*^9, 3.4632309651874933`*^9}, { 3.463230996830522*^9, 3.463231000884075*^9}}, FontSlant->"Italic"], Cell[BoxData["3"], "Output", CellChangeTimes->{ 3.463230965960177*^9, {3.4632310276158943`*^9, 3.4632310327156057`*^9}}, FontSlant->"Italic"] }, Open ]], Cell[TextData[{ "3) Find a ", StyleBox["Mathematica", FontSlant->"Italic"], " function that generates one random real number (that is, a decimal \ approximation of a real number) between 1 and 6." }], "Text", CellChangeTimes->{{3.463231042414403*^9, 3.4632311045806713`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"RandomReal", "[", RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], "]"}]], "Input", CellChangeTimes->{{3.463231107234749*^9, 3.46323111524242*^9}}, FontSlant->"Italic"], Cell[BoxData["4.663912550771903`"], "Output", CellChangeTimes->{ 3.4632311161553297`*^9, {3.463231177193672*^9, 3.4632311797424707`*^9}}, FontSlant->"Italic"] }, Open ]], Cell[TextData[{ "4) Find a ", StyleBox["Mathematica", FontSlant->"Italic"], " function that generates a list of 20 random integers between 1 and 6. The \ output might look like" }], "Text", CellChangeTimes->{{3.463231182123507*^9, 3.463231228246002*^9}, { 3.46323126222418*^9, 3.463231302647208*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"RandomInteger", "[", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], ",", "20"}], "]"}]], "Input", CellChangeTimes->{{3.463231306337494*^9, 3.463231317831848*^9}}, FontSlant->"Italic"], Cell[BoxData[ RowBox[{"{", RowBox[{ "6", ",", "5", ",", "3", ",", "1", ",", "2", ",", "6", ",", "2", ",", "6", ",", "6", ",", "6", ",", "1", ",", "3", ",", "1", ",", "5", ",", "4", ",", "1", ",", "2", ",", "5", ",", "1", ",", "4"}], "}"}]], "Output", CellChangeTimes->{{3.463231318822317*^9, 3.463231334005512*^9}}, FontSlant->"Italic"] }, Open ]] }, Open ]] }, WindowSize->{948, 876}, WindowMargins->{{25, Automatic}, {Automatic, 0}}, ShowSelection->True, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (April 20, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 331, 4, 67, "Section"], Cell[924, 29, 288, 7, 26, "Text"], Cell[1215, 38, 279, 9, 26, "Text"], Cell[CellGroupData[{ Cell[1519, 51, 117, 2, 27, "Input"], Cell[1639, 55, 2720, 67, 76, "Print"] }, Open ]], Cell[4374, 125, 279, 8, 27, "Text"], Cell[CellGroupData[{ Cell[4678, 137, 254, 6, 27, "Input"], Cell[4935, 145, 145, 3, 27, "Output"] }, Open ]], Cell[5095, 151, 281, 7, 26, "Text"], Cell[CellGroupData[{ Cell[5401, 162, 197, 5, 27, "Input"], Cell[5601, 169, 162, 3, 27, "Output"] }, Open ]], Cell[5778, 175, 308, 8, 26, "Text"], Cell[CellGroupData[{ Cell[6111, 187, 227, 6, 27, "Input"], Cell[6341, 195, 352, 7, 27, "Output"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)