(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 48379, 2008]*) (*NotebookOutlinePosition[ 49307, 2039]*) (* CellTagsIndexPosition[ 49263, 2035]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Lists", "Title", Evaluatable->False, TextAlignment->Center, AspectRatioFixed->True], Cell[TextData[{ "Sean Mauch\nsean@caltech.edu\n", ButtonBox["http://www.its.caltech.edu/~sean", ButtonData:>{ URL[ "http://www.its.caltech.edu/~sean"], None}, ButtonStyle->"Hyperlink"], "\n", "This work is distributed under the GNU FDL. See ", ButtonBox["license.nb ", ButtonData:>{"license.nb", None}, ButtonStyle->"Hyperlink"], "for details." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Making Lists"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "You can make a list in ", StyleBox["Mathematica", FontSlant->"Italic"], " as follows" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(List[2, 3, 5]\)], "Input", AspectRatioFixed->True], Cell["An alternate notation, (and the one more often used), is", "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \({2, 3, 5}\)], "Input", AspectRatioFixed->True], Cell[TextData["The objects in a list need not have the same type."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \({2, 1\/2, 0.34, a, b \[Rule] 1\/3}\)], "Input", AspectRatioFixed->True], Cell[TextData["The objects in a list can even be other lists."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \({{1, 2}, {3, 4}}\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Most of the ", StyleBox["Mathematica", FontSlant->"Italic"], " built-in functions will take lists as arguments. The result is a list of \ the results of applying the function to each element of the list." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Sin[{1, 2, 3}]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Expand[{x + y, \((x + y)\)\^2, \((x + y)\)\^3}]\)], "Input"], Cell["\<\ When you perform an arithmetic relation between a scalar value and \ a list. The result is a list of the results of applying the arithmetic \ relation to each element of the list.\ \>", "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(5 + {1, 2, 3}\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(2 + 3\ {1, 2, 3}\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \({1, 2, 3}\^2\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(2\^{1, 2, 3}\)], "Input", AspectRatioFixed->True], Cell["\<\ You can also perform all the standard arithmetic operations on two \ lists of the same size. The result is a list of the same size where the \ operation is done component-wise.\ \>", "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \({1, 2, 3} + {4, 5, 6}\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \({1, 2, 3}\^{1, 2, 3}\)], "Input", AspectRatioFixed->True], Cell["\<\ It is an error to perform an arithmetic operation on lists of \ different sizes.\ \>", "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \({1, 2} + {2, 3, 4}\)], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell["Making Lists with Table[]", "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["The Table[] Function"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "The ", StyleBox["Table[]", "Input"], " function allows you to make lists where the elements of the list are a \ function of the index of the element." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Table[2\ i + 1, {i, 1, 5}]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "The previous expression returns a list of five elements where the ", Cell[BoxData[ \(TraditionalForm\`i\^th\)]], " element of the list has value ", Cell[BoxData[ \(TraditionalForm\`\((2 i + 1)\)\)]], "." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[TextData[{ "The next expression generates the fifth roots of unity. ", Cell[BoxData[ \(TraditionalForm\`n\)]], " is the iteration variable. The global definition of ", Cell[BoxData[ \(TraditionalForm\`n\)]], " is not changed by using it as an iteration variable." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Table[Exp[\(2\ \[Pi]\ I\ n\)\/5], {n, 0, 4}]\)], "Input", AspectRatioFixed->True], Cell["\<\ The iteration variable need not have integral values. An \ equivalent way of generating the fifth roots of unity is:\ \>", "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Table[Exp[I\ x], {x, 0, \(8\ \[Pi]\)\/5, \(2\ \[Pi]\)\/5}]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "The notation ", Cell[BoxData[ \(TraditionalForm \`{x, \ 0, \ \ \(8 \[Pi]\)\/5, \ \(2 \[Pi]\)\/5}\)]], " means: start ", Cell[BoxData[ \(TraditionalForm\`x\)]], " at the value 0, iterate while the value of ", Cell[BoxData[ \(TraditionalForm\`x\)]], " is less than or equal to ", Cell[BoxData[ \(TraditionalForm\`\(8 \[Pi]\ \)\/5\)]], " and increment the value of ", Cell[BoxData[ \(TraditionalForm\`x\)]], " by ", Cell[BoxData[ \(TraditionalForm\`\(2 \[Pi]\)\/5\)]], " after each iteration. An equivalent expression for the first input of \ this section is:" }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Table[i, {i, 3, 11, 2}]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "The general form of the iterator expression is: ", Cell[BoxData[ FormBox[ StyleBox[\({variable, \ initial, \ final, \ step}\), FontWeight->"Bold"], TraditionalForm]]], ". All of the arguments except ", StyleBox["final", FontWeight->"Bold"], " are optional. If you leave out ", StyleBox["step", FontWeight->"Bold"], " it is set to one by default. The default value of ", StyleBox["intial", FontWeight->"Bold"], " is also one. You can leave out ", StyleBox["variable", FontWeight->"Bold"], " if you have no need to use the value of the iterator variable. " }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[CellGroupData[{ Cell["Exercise 1", "Subsubsection"], Cell[TextData[{ "Make a list of 10 random real numbers in the range ", Cell[BoxData[ \(TraditionalForm\`\([0, 1]\)\)]], ". Make a list of the first 20 square numbers, i.e. 1, 4, 9, ..." }], "Text", TextJustification->1] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Formatting List Outputs", "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "The following input generates a list of 5 random numbers."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(rand = Table[Random[], {5}]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "To print the elements of a list in a vertical row, use the ", Cell[BoxData[ FormBox[ StyleBox[\(TableForm[]\), "Input"], TraditionalForm]]], " function in prefix or postfix form." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(TableForm[rand]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(rand // TableForm\)], "Input"], Cell[TextData[{ "Do not ", StyleBox["TableForm[]", FontWeight->"Bold"], " or similar functions in postfix form when you are making an assignment. \ To see why, execute the following two commands." }], "Text", TextJustification->1], Cell[BoxData[ \(rand = Table[Random[], {5}] // TableForm\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(rand + 5\)], "Input"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " does not add 5 to each element in the list as you would expect. This is \ because the variable rand is not a list. Since the postfix function \ operator, //, has a higher precedence than the assignment operator, =, the \ above input defining rand is equivalent to:" }], "Text", TextJustification->1], Cell[BoxData[ \(rand = TableForm[Table[Random[], {5}]]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Thus rand is not a list, it is the table form of a list. ", StyleBox["Mathematica", FontSlant->"Italic"], " knows how to do arithmetic with the former, but not the latter. The \ correct way to assign a list to the variable, rand, and display the output in \ table form is shown below." }], "Text", TextJustification->1], Cell[BoxData[ \(TableForm[rand = Table[Random[], {5}]]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(rand + 5\)], "Input"], Cell[BoxData[ \(rand + 5 // TableForm\)], "Input"], Cell[TextData[{ "The ", Cell[BoxData[ FormBox[ StyleBox[\(Short[]\), "Input"], TraditionalForm]]], " function is useful when working with long lists." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(rand = Table[Random[], {100}]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Short[rand]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "The ", Cell[BoxData[ \(TraditionalForm\`<< #>>\)]], " tells you that # terms have been omitted. The ", StyleBox["Short[]", "Input"], " function will work with any kind of expression. It produces a truncated \ ouput that is about one line long. ", StyleBox["Short[expression,n]", "Input"], " truncates the output to about ", Cell[BoxData[ \(TraditionalForm\`n\)]], " lines." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Short[rand, 3]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Clear[rand]\)], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell["Exercise 2", "Subsubsection"], Cell[TextData[{ "Make a list of the first twenty primes. Format the list into a vertical \ column. (Use the ", StyleBox["Prime[]", FontWeight->"Bold"], " function.)" }], "Text", TextJustification->1] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Multidimensional Tables"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ To make a multidimensional table, use multiple iterator \ expressions. The following two inputs are equivalent, but the second is \ more notationally convenient and clear.\ \>", "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Table[Table[10\ i + j, {j, 6}], {i, 5}]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Table[10\ i + j, {i, 5}, {j, 6}]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(TableForm[%]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Using two iterator expressions makes a list of lists. In the previous \ output, there is a list for each value of ", Cell[BoxData[ \(TraditionalForm\`i\)]], ". When you format the output with ", StyleBox["TableForm", "Input"], ", each of these lists becomes a row in the table. Thus the first iterator \ expression describes the number of rows and the second describes the number \ of columns." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[CellGroupData[{ Cell["Exercise 3", "Subsubsection"], Cell[TextData[{ "Make a two-dimensional table with 4 rows and 7 columns where the ", Cell[BoxData[ \(TraditionalForm\`\((i, j)\)\^th\)]], " element has the value ", Cell[BoxData[ \(TraditionalForm\`i\^2 - j\^2\)]], "." }], "Text", TextJustification->1] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Pieces of Lists"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Elements of a List"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "You can refer to a particular element of a list with the ", StyleBox["Part[]", "Input"], " function. The syntax is: ", StyleBox["Part[list,index]. ", "Input"], "The first element of the list has index 1." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(\(data = {1, 3, 5, 7, 9}; \)\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Part[data, 2]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "An alternative notation is: ", StyleBox["list[[index]]. ", "Input"], "To do subscripting you use double brackets, (singe brackets are for \ function arguments)." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(data[\([2]\)]\)], "Input"], Cell[TextData[ "To get the spiffy typeset version on the above input, type \ \"data\[EscapeKey][[\[EscapeKey]2\[EscapeKey]]]\[EscapeKey]\"."], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(data\[LeftDoubleBracket]2\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True], Cell["You can assign values to parts of a list.", "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(data\[LeftDoubleBracket]3\[RightDoubleBracket] = 25; \ndata\)], "Input",\ AspectRatioFixed->True], Cell[TextData[ "To get a list of certain elements of a list use the following syntax."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(data\[LeftDoubleBracket]{1, 2, 3}\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True], Cell["\<\ You can refer to a single element mulitple times. The subscripting \ syntax for this is:\ \>", "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(data\[LeftDoubleBracket]{1, 2, 1, 3, 1}\[RightDoubleBracket]\)], "Input",\ AspectRatioFixed->True], Cell[BoxData[ \(Clear[data]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " has functions for refering to the first and last elements of lists." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(ints = Table[i, {i, 10}]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(First[ints]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Last[ints]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Calling the ", StyleBox["Part[]", "Input"], " function with a negative index like: ", StyleBox["Part[list,-n] ", "Input"], "will give you the ", Cell[BoxData[ \(TraditionalForm\`n\^th\)]], " element from the end of the list." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(ints\[LeftDoubleBracket]\(-1\)\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(ints\[LeftDoubleBracket]\(-3\)\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Sublists of a List"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "Mathematica allows you to refer to a consecutive sequence of elements in a \ list with the ", StyleBox["Take[]", "Input"], " function." }], "Text", Evaluatable->False, TextAlignment->Left, TextJustification->1, AspectRatioFixed->True], Cell[TextData[{ "The following input gives you the first 5 elements of ", Cell[BoxData[ \(TraditionalForm\`ints\)]], "." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Take[ints, 5]\)], "Input", AspectRatioFixed->True], Cell["This input gives you the last three elements of ints.", "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Take[ints, \(-3\)]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "To get the sublist of the third through the seventh elements of ", StyleBox["ints", FontWeight->"Bold"], " use:" }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Take[ints, {3, 7}]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "You can use the same syntax to remove sublists from a list with the ", StyleBox["Drop[]", "Input"], " function." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[TextData[{ "This gives you ", StyleBox["ints", FontWeight->"Bold"], " with the first two elements dropped." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Drop[ints, 2]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "This gives you ", StyleBox["ints", FontWeight->"Bold"], " with the last four elements dropped." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Drop[ints, \(-4\)]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "This gives you ", StyleBox["ints", FontWeight->"Bold"], " with the second through fifth elements dropped." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Drop[ints, {2, 5}]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Finally, the ", StyleBox["Rest[]", "Input"], " function returns a list with the first element dropped. It is equivalent \ to ", StyleBox["Drop[list,1]", "Input"], "." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(Rest[ints]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Clear[ints]\)], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Lists of Lists"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "Lets say you have a list of ", Cell[BoxData[ \(TraditionalForm\`\((x, \ y)\)\)]], "-coordinates, (that is, a list of lists)." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(\(coords = {{1, 2}, {2, 3}, {3, 5}, {4, 7}, {5, 11}}; \)\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "The ", Cell[BoxData[ \(TraditionalForm\`i\^th\)]], " element of the above list is a list of two elements." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(coords\[LeftDoubleBracket]1\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "To refer to the ", Cell[BoxData[ \(TraditionalForm\`x - coordinate\)]], " of the first point use:" }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(\(coords\[LeftDoubleBracket]1 \[RightDoubleBracket]\)\[LeftDoubleBracket]1\[RightDoubleBracket]\)], "Input"], Cell["or, more succinctly,", "Text"], Cell[BoxData[ \(coords\[LeftDoubleBracket]1, 1\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Note that ", StyleBox["list[[i]][[j]], list[[i,j]]", "Input"], " and ", StyleBox["Part[list,i,j]", "Input"], " are equivalent. " }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[TextData[{ "The ", Cell[BoxData[ \(TraditionalForm\`y\)]], "-coordinate of the third point is" }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True], Cell[BoxData[ \(\(coords\[LeftDoubleBracket]3 \[RightDoubleBracket]\)\[LeftDoubleBracket]2\[RightDoubleBracket]\)], "Input"], Cell[BoxData[ \(coords\[LeftDoubleBracket]3, 2\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Part[coords, 3, 2]\)], "Input"], Cell[BoxData[ \(Clear[coords]\)], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell["Exercise 4", "Subsubsection"], Cell[TextData[{ "Make a list of the first 100 primes.\nUsing ", Cell[BoxData[ \(TraditionalForm\`First[]\)]], ", ", Cell[BoxData[ \(TraditionalForm\`Last[]\)]], ", ", Cell[BoxData[ \(TraditionalForm\`Part[]\)]], " and list subscripting do the following:\n\tGive the first prime.\n\tGive \ the last prime in the list.\n\tGive the ", Cell[BoxData[ \(TraditionalForm\`33\^rd\)]], " prime.\n\tMake a list of the ", Cell[BoxData[ \(TraditionalForm\`10\^th\)]], ", ", Cell[BoxData[ \(TraditionalForm\`20\^th\)]], " and ", Cell[BoxData[ \(TraditionalForm\`30\^th\)]], " primes.\n\tReplace the prime 47 in the list with the number 69.\n\tNow \ put 47 back in its proper place.\nUse ", Cell[BoxData[ \(TraditionalForm\`Take[]\)]], " and ", Cell[BoxData[ \(TraditionalForm\`Drop[]\)]], " to do the following:\n\tMake a list of the first ten primes.\n\tMake a \ list of the last 20 primes in the list.\n\tMake a list of the ", Cell[BoxData[ \(TraditionalForm\`34\^th\)]], " through ", Cell[BoxData[ \(TraditionalForm\`43\^rd\)]], " primes.\n\tMake a list of the first 50 primes in two different ways.\n\t\ Make a list of the first 99 primes excluding the prime 47.\n\tMake a list of \ the first 10 and the ", Cell[BoxData[ \(TraditionalForm\`91\^st\)]], " through ", Cell[BoxData[ \(TraditionalForm\`100\^th\)]], " primes." }], "Text", Evaluatable->False, TextJustification->1, AspectRatioFixed->True] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Functions on Lists", "Section"], Cell[CellGroupData[{ Cell["Set Operations", "Subsection"], Cell[TextData[{ "You can concatenate lists with the ", StyleBox["Join[]", FontWeight->"Bold"], " function." }], "Text"], Cell[BoxData[ \(\(?Join\)\)], "Input"], Cell[BoxData[ \(Join[{1, 3, 5, 7, 9}, {2, 3, 5, 7}]\)], "Input"], Cell[TextData[{ StyleBox["Length[]", FontWeight->"Bold"], " returns the number of elements in a list." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(Length[{a, b, c, d}]\)], "Input"], Cell[BoxData[ \(Length[{1, {1, 2}, 3}]\)], "Input"], Cell[TextData[{ "You think of lists as being sets of elements. ", StyleBox["Mathematica", FontSlant->"Italic"], " supplies the ", StyleBox["Union[]", FontWeight->"Bold"], " and ", StyleBox["Intersection[]", FontWeight->"Bold"], " functions for working with lists." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(\(?Union\)\)], "Input"], Cell[BoxData[ \(\(?Intersection\)\)], "Input"], Cell[BoxData[ \(Union[{1, 3, 5, 7, 9}, {2, 3, 5, 7}]\)], "Input"], Cell[BoxData[ \(Intersection[{1, 3, 5, 7, 9}, {2, 3, 5, 7}]\)], "Input"], Cell[TextData[{ "You can take differences of sets with ", StyleBox["Complement[]", FontWeight->"Bold"], ". " }], "Text"], Cell[BoxData[ \(\(?Complement\)\)], "Input"], Cell[BoxData[ \(Complement[{1, 3, 5, 7, 9}, {2, 3, 5, 7}]\)], "Input"], Cell[TextData[{ "Another useful function for lists is ", StyleBox["Split[]", FontWeight->"Bold"], ", which groups repeated elements." }], "Text"], Cell[BoxData[ \(\(?Split\)\)], "Input"], Cell[BoxData[ \(Split[{1, 2, 2, 3, 3, 3, 4, 4, 4, 4}]\)], "Input"], Cell[CellGroupData[{ Cell["Exercise 5", "Subsubsection"], Cell["\<\ Make a list of the integers between 1 and 100 inclusive that are \ divisible by neither 2 nor 3.\ \>", "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Exercise 6", "Subsubsection"], Cell[TextData[{ "To simulate 100 flips of a fair coin, make a table of random integers in \ the range ", Cell[BoxData[ \(TraditionalForm\`\([0, 1]\)\)]], ", (1 is heads, 0 is tails). What is the longest sequence of consecutive \ heads?" }], "Text"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Applying, Mapping and Selecting", "Subsection"], Cell[TextData[{ "The ", StyleBox["Apply[]", FontWeight->"Bold"], " function replaces the head of an expression. You can see the internal \ representation of a list with ", StyleBox["FullForm[]", FontWeight->"Bold"], "." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(FullForm[{1, 2, 3}]\)], "Input"], Cell[TextData[{ "For lists, ", StyleBox["List", FontWeight->"Bold"], " is the head of the expression and the elements of the list are arguments \ to ", StyleBox["List[]", FontWeight->"Bold"], ". You can change a list of elements to a function with those elements as \ arguments with the ", StyleBox["Apply[]", FontWeight->"Bold"], " function." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(\(?Apply\)\)], "Input"], Cell[BoxData[ \(Apply[f, {1, 2, 3}]\)], "Input"], Cell[TextData[{ "Since ", StyleBox["g", FontWeight->"Bold"], " is the head of ", StyleBox["g[1,2,3]", FontWeight->"Bold"], ", you can also use ", StyleBox["Apply[]", FontWeight->"Bold"], " to replace functions." }], "Text"], Cell[BoxData[ \(Apply[f, g[1, 2, 3]]\)], "Input"], Cell[TextData[{ "Use ", StyleBox["Map[]", FontWeight->"Bold"], " to map a function to each element of a list. Below we map the formal \ function ", StyleBox["f", FontWeight->"Bold"], " to each element of the list." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(Map[f, {1, 2, 3}]\)], "Input"], Cell["\<\ You can map built-in functions as well as user defined functions.\ \ \>", "Text"], Cell[BoxData[ \(Map[Sin, {1, \[Pi]\/2, 2, \[Pi]}]\)], "Input"], Cell[BoxData[ \(f[x_] := x\^2\)], "Input"], Cell[BoxData[ \(Map[f, {1, \[Pi]\/2, 2, \[Pi]}]\)], "Input"], Cell[BoxData[ \(Clear[f]\)], "Input"], Cell[TextData[{ "Instead of first defining the function ", Cell[BoxData[ \(TraditionalForm\`f(x) = x\^2\)]], " and then mapping ", Cell[BoxData[ \(TraditionalForm\`f\)]], " to a list, you can instead supply a pure function as the first argument \ of ", StyleBox["Map[]", FontWeight->"Bold"], "." }], "Text", TextJustification->1], Cell[BoxData[ \(Map[Function[x, x\^2], {1, \[Pi]\/2, 2, \[Pi]}]\)], "Input"], Cell[BoxData[ \(\(?Function\)\)], "Input"], Cell[TextData[{ "Pure functions allow you to use functions without storing them. Note that \ the ", Cell[BoxData[ FormBox[ StyleBox["x", FontWeight->"Bold"], TraditionalForm]]], " and ", Cell[BoxData[ FormBox[ StyleBox[\(x\^2\), FontWeight->"Bold"], TraditionalForm]]], " in ", StyleBox["Function[]", FontWeight->"Bold"], " below are local formal variables. They are independent of any use of the \ variable ", Cell[BoxData[ FormBox[ StyleBox["x", FontWeight->"Bold"], TraditionalForm]]], " outside ", StyleBox["Function[]", FontWeight->"Bold"], "." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(\(Function[x, x\^2]\)[x + y]\)], "Input"], Cell["\<\ Here is a pure function that returns the first element of a list.\ \ \>", "Text"], Cell[BoxData[ \(\(Function[x, x\[LeftDoubleBracket]1\[RightDoubleBracket]]\)[{1, 2, 3, 4}]\)], "Input"], Cell["We apply this pure function to a list of lists.", "Text"], Cell[BoxData[ \(Map[ Function[x, x\[LeftDoubleBracket]1\[RightDoubleBracket]], {{1, 2}, {3, 4}, {5, 6}}]\)], "Input"], Cell["\<\ The following is a boolean function which returns True if the \ argument is nonnegative and False otherwise.\ \>", "Text", TextJustification->1], Cell[BoxData[ \(f[x_] := x >= 0\)], "Input"], Cell[BoxData[ \(f[1]\)], "Input"], Cell[BoxData[ \(f[\(-1\)]\)], "Input"], Cell[BoxData[ \(Clear[f]\)], "Input"], Cell[TextData[{ "Here is how to write ", Cell[BoxData[ \(TraditionalForm\`f(1)\)]], " as a pure function." }], "Text"], Cell[BoxData[ \(\(Function[x, x >= 0]\)[1]\)], "Input"], Cell[TextData[{ "An alternate notation for pure functions is shown below. The ", StyleBox["#", FontWeight->"Bold"], " is the argument of the function. The ", StyleBox["&", FontWeight->"Bold"], " indicates that it is a pure function." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(\(\((# >= 0)\)&\)[1]\)], "Input"], Cell[BoxData[ \(f := \((# >= 0)\)&\)], "Input"], Cell[BoxData[ \(f[1]\)], "Input"], Cell[BoxData[ \(Clear[f]\)], "Input"], Cell["Here we map a boolean function on a list.", "Text"], Cell[BoxData[ \(Map[\((# >= 0)\)&, {\(-2\), \(-1\), 0, 1, 2}]\)], "Input"], Cell[TextData[{ "You can use the ", StyleBox["Select[]", FontWeight->"Bold"], " function to select the elements from a list that satisfy a boolean \ function." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(\(?Select\)\)], "Input"], Cell[BoxData[ \(num = Table[i, {i, 1, 50}]\)], "Input"], Cell["\<\ You can use built-in boolean functions to select the even numbers, \ or the prime numbers.\ \>", "Text"], Cell[BoxData[ \(Select[num, EvenQ]\)], "Input"], Cell[BoxData[ \(Select[num, PrimeQ]\)], "Input"], Cell[TextData[{ "You can also utilize user-defined functions in ", StyleBox["Select[]", FontWeight->"Bold"], ". Here are the numbers that are divisible by 2 but not by 3." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(Select[num, \((Mod[#, 2] == 0 && Mod[#, 3] != 0)\)&]\)], "Input"], Cell[BoxData[ \(Clear[num]\)], "Input"], Cell[CellGroupData[{ Cell["Exercise 7", "Subsubsection"], Cell[TextData[{ "Make a list of 10 real, random ", Cell[BoxData[ \(TraditionalForm\`\((x, y)\)\)]], " coordinates with ", Cell[BoxData[ \(TraditionalForm\`x, y \[Element] \([\(-1\), 1]\)\)]], ". Use the Map[] function to do the following:\n1) Make a list of the ", Cell[BoxData[ \(TraditionalForm\`x\)]], " coordinates.\n2) Make a list of the distance of the coordinates from the \ origin.\n3) Make a list of the of the coordinates with ", Cell[BoxData[ \(TraditionalForm\`x\)]], " and ", Cell[BoxData[ \(TraditionalForm\`y\)]], " switched." }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Exercise 8", "Subsubsection"], Cell[TextData[{ "Simulate 100 tosses of a die by making a table of random integers in the \ range ", Cell[BoxData[ \(TraditionalForm\`\([1, 6]\)\)]], ". How many 6's were rolled?" }], "Text", TextJustification->1] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Sorting", "Subsection"], Cell[TextData[{ "The ", StyleBox["Sort[]", FontWeight->"Bold"], " function sorts the elements of a list into canonical order. The elements \ of the list can be anything, even lists." }], "Text", TextJustification->1], Cell[BoxData[ \(Sort[{1, \[Pi], a, "\", {1, 2}}]\)], "Input"], Cell[BoxData[ \(\(?Sort\)\)], "Input"], Cell["\<\ Note that canonical order does not necessarily mean numerically \ increasing order when dealing with exact numbers.\ \>", "Text", TextJustification->1], Cell[BoxData[ \(Sort[{1, 2, 3, 4, \[Pi], Sin[1], 3\/2}]\)], "Input"], Cell["\<\ However canonical order does mean numerically increasing order when \ working with approximate numbers.\ \>", "Text", TextJustification->1], Cell[BoxData[ \(N[{1, 2, 3, 4, \[Pi], Sin[1], 3\/2}]\)], "Input"], Cell[BoxData[ \(Sort[%]\)], "Input"], Cell["\<\ A pure function of two arguments can be defined in the following \ manners. #1 and #2 are the first and second arguments of the function.\ \>", "Text", TextJustification->1], Cell[BoxData[ \(f = Function[{x, y}, 3 x + y\^2]\)], "Input"], Cell[BoxData[ \(f[x, y]\)], "Input"], Cell[BoxData[ \(f = \((3\ #1 + #2\^2)\)&\)], "Input"], Cell[BoxData[ \(f[x, y]\)], "Input"], Cell[BoxData[ \(Clear[f]\)], "Input"], Cell[TextData[{ "The ", StyleBox["Sort[]", FontWeight->"Bold"], " function can take a boolean function of two variables as a second \ argument. The list is ordered by comparing pairs of elements of the list. \ Here is a list sorted in ascending order." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(Sort[{4, \[Pi], 3, Sin[1], 2, 1/2, 2, 1}, \((#1 < #2)\)&]\)], "Input"], Cell["Here is a list sorted in descending order.", "Text", TextJustification->1], Cell[BoxData[ \(Sort[{4, \[Pi], 3, Sin[1], 2, 1/2, 2, 1}, \((#1 > #2)\)&]\)], "Input"], Cell["Here is a list sorted so that integers come first.", "Text"], Cell[BoxData[ \(Sort[{4, \[Pi], 3, Sin[1], 2, 1/2, 2, 1}, IntegerQ[#1]&]\)], "Input"], Cell["Here is a list sorted so that even numbers come first.", "Text"], Cell[BoxData[ \(Sort[{1, 2, 3, 4, 5, 6, 7, 8}, EvenQ[#1]&]\)], "Input"], Cell[CellGroupData[{ Cell["Exercise 9", "Subsubsection"], Cell[TextData[{ "Make a list of 10 real, random ", Cell[BoxData[ \(TraditionalForm\`\((x, y)\)\)]], " coordinates with ", Cell[BoxData[ \(TraditionalForm\`x, y \[Element] \([\(-1\), 1]\)\)]], ". Sort the list by increasing distance from the origin." }], "Text", TextJustification->1] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Manipulating the Dimensions of Lists", "Section"], Cell[TextData[{ "The ", StyleBox["Dimensions[]", FontWeight->"Bold"], " function gives a list of the dimensions of a list. Here is a list of 5 \ random real numbers." }], "Text", TextJustification->1], Cell[BoxData[ \(Table[Random[], {5}]\)], "Input"], Cell[BoxData[ \(Dimensions[%]\)], "Input"], Cell["\<\ Here is a list of 5 random real coordinates in 2-dimensional space.\ \ \>", "Text"], Cell[BoxData[ \(Table[{Random[], Random[]}, {i, 5}]\)], "Input"], Cell[BoxData[ \(Dimensions[%]\)], "Input"], Cell["Below we make a table of some positive lattice points.", "Text", TextJustification->1], Cell[BoxData[ \(Table[{i, j}, {i, 5}, {j, 5}]\)], "Input"], Cell[BoxData[ \(Dimensions[%]\)], "Input"], Cell[TextData[{ "You can transpose the first two elements in a list with the ", StyleBox["Transpose[]", FontWeight->"Bold"], " function. Below is a list of random coordinates in 2-dimensional space." }], "Text", TextJustification->1], Cell[BoxData[ \(Table[{Random[], Random[]}, {i, 5}]\)], "Input"], Cell["\<\ By transposing it we obtain a list whose two elements are lists of \ the x and y coordinates.\ \>", "Text", TextJustification->1], Cell[BoxData[ \(Transpose[%]\)], "Input"], Cell[TextData[{ "The ", StyleBox["Flatten[]", FontWeight->"Bold"], " function flattens out nested lists." }], "Text", TextJustification->1], Cell[BoxData[ \(Flatten[{1, {2}, {{3}, {4}}}]\)], "Input"], Cell["\<\ By supplying a second argument, you can specify that the list be \ flatten only to a given level. Below only the first level of the list is \ flattened.\ \>", "Text", TextJustification->1], Cell[BoxData[ \(Flatten[{1, {2}, {{3}, {4}}}, 1]\)], "Input"], Cell[TextData[{ "You can partition a list into sublists with the ", StyleBox["Partition[]", FontWeight->"Bold"], " function. Below we partition a list into subists of length three." }], "Text", TextJustification->1], Cell[BoxData[ \(Table[i, {i, 9}]\)], "Input"], Cell[BoxData[ \(Partition[%, 3]\)], "Input"], Cell[CellGroupData[{ Cell["Exercise 10", "Subsubsection"], Cell[TextData[{ "Pythagorean triples are three-tuples of positive integers ", Cell[BoxData[ \(TraditionalForm\`\((x, y, z)\)\)]], " that satisfy ", Cell[BoxData[ \(TraditionalForm\`x\^2 + y\^2 = z\^2\)]], ". How many Pythagorean triples satisfying ", Cell[BoxData[ \(TraditionalForm\`x \[LessEqual] 100\)]], " and ", Cell[BoxData[ \(TraditionalForm\`y \[LessEqual] 100\)]], " exist? Hints: First use the ", StyleBox["Table[]", FontWeight->"Bold"], " function to make a multi-dimensional list of all the tuples ", Cell[BoxData[ \(TraditionalForm\`\((x, y, \@\(x\^2 + y\^2\))\)\)]], " with ", Cell[BoxData[ \(TraditionalForm\`x \[LessEqual] 100\)]], " and ", Cell[BoxData[ \(TraditionalForm\`y \[LessEqual] 100\)]], ". Next flatten the first level of the list and select the tuples whose \ third element is an integer. You will use the ", StyleBox["IntegerQ[]", FontWeight->"Bold"], " for this." }], "Text", TextJustification->1] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Solutions"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell["Solution 1", "Subsubsection"], Cell[TextData[{ "Here is a list of ten random numbers. In the iterator expression, we \ explicitly state that the iterator variable is ", Cell[BoxData[ \(TraditionalForm\`i\)]], ", the starting point is 1, the final point is 10 and the increment is 1." }], "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(Table[Random[], {i, 1, 10, 1}]\)], "Input"], Cell["Here is a simpler way to write the iterator expression.", "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(Table[Random[], {10}]\)], "Input"], Cell["Here is a table of the first 20 square numbers.", "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(Table[n\^2, {n, 1, 20}]\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Solution 2", "Subsubsection"], Cell["Here is a list of the first 20 primes.", "Text", TextAlignment->Left, TextJustification->1], Cell[BoxData[ \(Table[Prime[i], {i, 20}] // TableForm\)], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell["Solution 3", "Subsubsection"], Cell[BoxData[ \(TableForm[Table[i\^2 - j\^2, {i, 4}, {j, 7}]]\)], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell["Solution 4", "Subsubsection"], Cell[TextData["Here is a list of the first 100 primes."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(primeList = Table[Prime[i], {i, 100}]\)], "Input", AspectRatioFixed->True], Cell[TextData["The first prime is"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(First[primeList]\)], "Input", AspectRatioFixed->True], Cell[TextData["The last prime in the list is"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(Last[primeList]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "The ", Cell[BoxData[ \(TraditionalForm\`33\^rd\)]], " prime is" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(primeList\[LeftDoubleBracket]33\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Here is a list of the ", Cell[BoxData[ \(TraditionalForm\`10\^th\)]], ", ", Cell[BoxData[ \(TraditionalForm\`20\^th\)]], " and ", Cell[BoxData[ \(TraditionalForm\`30\^th\)]], " primes." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(primeList\[LeftDoubleBracket]{10, 20, 30}\[RightDoubleBracket]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "47 is the ", Cell[BoxData[ \(TraditionalForm\`15\^th\)]], " prime. To replace 47 with 69 we do" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(primeList\[LeftDoubleBracket]15\[RightDoubleBracket] = 69\)], "Input", AspectRatioFixed->True], Cell["Now here is the \"revised\" primeList.", "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(primeList\)], "Input", AspectRatioFixed->True], Cell["To put 47 back in the right place we do:", "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(primeList\[LeftDoubleBracket]15\[RightDoubleBracket] = 47\)], "Input", AspectRatioFixed->True], Cell["Here is a list of the first 10 primes.", "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(Take[primeList, 10]\)], "Input", AspectRatioFixed->True], Cell["Here are the last 20 primes in the list.", "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(Take[primeList, \(-20\)]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Here are the ", Cell[BoxData[ \(TraditionalForm\`34\^th\)]], " through the ", Cell[BoxData[ \(TraditionalForm\`43\^rd\)]], " primes." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(Take[primeList, {34, 43}]\)], "Input", AspectRatioFixed->True], Cell[TextData["Here are lists of the first 50 primes."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(Take[primeList, 50]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Drop[primeList, \(-50\)]\)], "Input", AspectRatioFixed->True], Cell[TextData["Here is a list of the first 99 primes excluding 47."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(Drop[primeList, {15}]\)], "Input", AspectRatioFixed->True], Cell[TextData[{ "Here is a list of the first 10 and the ", Cell[BoxData[ \(TraditionalForm\`91\^st\)]], " through ", Cell[BoxData[ \(TraditionalForm\`100\^th\)]], " primes." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[BoxData[ \(Drop[primeList, {11, 90}]\)], "Input", AspectRatioFixed->True], Cell[BoxData[ \(Clear[primeList]\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Solution 5", "Subsubsection"], Cell[TextData[{ "The first argument of ", StyleBox["Complement[]", FontWeight->"Bold"], " is a list of the integers between 1 and 100. The second and third \ arguments are the lists of multiples of 2 and 3, respectively." }], "Text"], Cell[BoxData[ \(Complement[Table[i, {i, 1, 100}], Table[i, {i, 2, 100, 2}], Table[i, {i, 3, 100, 3}]]\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Solution 6", "Subsubsection"], Cell["First we make the table of heads and tails.", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(data = Table[Random[Integer], {100}]\)], "Input"], Cell[BoxData[ \({1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0}\)], "Output"] }, Open ]], Cell["Next we group the consecutive heads and tails.", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Split[data]\)], "Input"], Cell[BoxData[ \({{1}, {0, 0}, {1}, {0}, {1, 1}, {0, 0}, {1}, {0}, {1, 1, 1}, {0, 0}, { 1}, {0, 0}, {1}, {0, 0}, {1}, {0, 0, 0}, {1}, {0, 0}, {1, 1, 1}, {0, 0}, {1, 1}, {0, 0, 0, 0, 0, 0}, {1, 1, 1, 1, 1}, {0, 0}, {1, 1}, {0, 0}, {1, 1, 1, 1, 1, 1}, {0, 0}, {1}, {0, 0, 0, 0}, {1, 1, 1, 1, 1, 1}, {0, 0, 0}, {1, 1}, {0, 0}, {1}, {0}, {1}, {0, 0, 0}, {1, 1, 1, 1}, {0}, {1, 1}, {0}, {1, 1}, {0, 0, 0}, {1}, {0}}\)], "Output"] }, Open ]], Cell["\<\ Finally we remove the duplicates from the list and sort the \ elements.\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Union[%]\)], "Input"], Cell[BoxData[ \({{0}, {1}, {0, 0}, {1, 1}, {0, 0, 0}, {1, 1, 1}, {0, 0, 0, 0}, {1, 1, 1, 1}, {1, 1, 1, 1, 1}, {0, 0, 0, 0, 0, 0}, {1, 1, 1, 1, 1, 1}}\)], "Output"] }, Open ]], Cell["\<\ For this data set, the longest consecutive sequence of heads is \ 6.\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Solution 7", "Subsubsection"], Cell["First we make the list of coordinates.", "Text"], Cell[BoxData[ \(TableForm[ coords = Table[Random[Real, {\(-1\), 1}], {i, 1, 10}, {j, 1, 2}]]\)], "Input"], Cell[TextData[{ "Here is a list of the ", Cell[BoxData[ \(TraditionalForm\`x\)]], " coordinates." }], "Text"], Cell[BoxData[ \(TableForm[Map[Function[x, x[\([1]\)]], coords]]\)], "Input"], Cell["Here is a list of the distance from the origin.", "Text"], Cell[BoxData[ \(TableForm[Map[Function[x, \@\(x[\([1]\)]\^2 + x[\([2]\)]\^2\)], coords]] \)], "Input"], Cell[TextData[{ "Here is a list with the ", Cell[BoxData[ \(TraditionalForm\`x\)]], " and ", Cell[BoxData[ \(TraditionalForm\`y\)]], " coordinates switched." }], "Text"], Cell[BoxData[ \(TableForm[Map[Function[x, {x[\([2]\)], x[\([1]\)]}], coords]]\)], "Input"], Cell[BoxData[ \(Clear[coords]\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Solution 8", "Subsubsection"], Cell["Here is a table of the data.", "Text"], Cell[BoxData[ \(\(data = Table[Random[Integer, {1, 6}], {i, 1, 100}]; \)\)], "Input"], Cell["The number of 6's rolled is", "Text"], Cell[BoxData[ \(Length[Select[data, \((# == 6)\)&]]\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Solution 9", "Subsubsection"], Cell["Here is a table of the coordinates.", "Text"], Cell[BoxData[ \(Table[Random[Real, {\(-1\), 1}], {i, 1, 10}, {j, 1, 2}] // TableForm \)], "Input"], Cell["Here is the list sorted by distance from the origin.", "Text"], Cell[BoxData[ \(Sort[%, \((#1[\([1]\)]\^2 + #1[\([2]\)]\^2 < #2[\([1]\)]\^2 + #2[\([2]\)]\^2) \)&] // TableForm\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Solution 10", "Subsubsection"], Cell[BoxData[ \(Select[ Flatten[Table[{i, j, \@\(i\^2 + j\^2\)}, {i, 1, 100}, {j, 1, 100}], 1], \((IntegerQ[#[\([3]\)]])\)&]\)], "Input"], Cell[BoxData[ \(Length[%]\)], "Input"] }, Closed]] }, Closed]] }, Open ]] }, FrontEndVersion->"5.2 for Microsoft Windows", ScreenRectangle->{{0, 1680}, {0, 963}}, WindowToolbars->"EditBar", CellGrouping->Automatic, WindowSize->{756, 430}, WindowMargins->{{2, Automatic}, {Automatic, 5}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, 128}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, CharacterEncoding->"XAutomaticEncoding", Magnification->1.5 ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 95, 3, 141, "Title", Evaluatable->False], Cell[1874, 58, 439, 14, 125, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[2338, 76, 89, 2, 109, "Section", Evaluatable->False], Cell[2430, 80, 172, 7, 47, "Text", Evaluatable->False], Cell[2605, 89, 72, 2, 42, "Input"], Cell[2680, 93, 120, 2, 47, "Text", Evaluatable->False], Cell[2803, 97, 68, 2, 42, "Input"], Cell[2874, 101, 124, 2, 47, "Text", Evaluatable->False], Cell[3001, 105, 93, 2, 63, "Input"], Cell[3097, 109, 120, 2, 47, "Text", Evaluatable->False], Cell[3220, 113, 75, 2, 42, "Input"], Cell[3298, 117, 339, 10, 73, "Text", Evaluatable->False], Cell[3640, 129, 73, 2, 42, "Input"], Cell[3716, 133, 80, 1, 42, "Input"], Cell[3799, 136, 299, 8, 73, "Text", Evaluatable->False], Cell[4101, 146, 72, 2, 42, "Input"], Cell[4176, 150, 75, 2, 42, "Input"], Cell[4254, 154, 71, 2, 42, "Input"], Cell[4328, 158, 71, 2, 43, "Input"], Cell[4402, 162, 296, 8, 73, "Text", Evaluatable->False], Cell[4701, 172, 80, 2, 42, "Input"], Cell[4784, 176, 79, 2, 43, "Input"], Cell[4866, 180, 199, 7, 47, "Text", Evaluatable->False], Cell[5068, 189, 77, 2, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[5182, 196, 92, 2, 62, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[5299, 202, 100, 2, 68, "Subsection", Evaluatable->False], Cell[5402, 206, 280, 9, 74, "Text", Evaluatable->False], Cell[5685, 217, 85, 2, 42, "Input"], Cell[5773, 221, 350, 12, 73, "Text", Evaluatable->False], Cell[6126, 235, 400, 12, 73, "Text", Evaluatable->False], Cell[6529, 249, 103, 2, 63, "Input"], Cell[6635, 253, 236, 7, 73, "Text", Evaluatable->False], Cell[6874, 262, 117, 2, 63, "Input"], Cell[6994, 266, 754, 26, 109, "Text", Evaluatable->False], Cell[7751, 294, 82, 2, 42, "Input"], Cell[7836, 298, 744, 23, 125, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[8605, 325, 35, 0, 61, "Subsubsection"], Cell[8643, 327, 234, 6, 73, "Text"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[8926, 339, 93, 2, 42, "Subsection", Evaluatable->False], Cell[9022, 343, 132, 3, 47, "Text", Evaluatable->False], Cell[9157, 348, 86, 2, 42, "Input"], Cell[9246, 352, 333, 11, 73, "Text", Evaluatable->False], Cell[9582, 365, 74, 2, 42, "Input"], Cell[9659, 369, 50, 1, 42, "Input"], Cell[9712, 372, 243, 7, 73, "Text"], Cell[9958, 381, 99, 2, 42, "Input"], Cell[10060, 385, 41, 1, 42, "Input"], Cell[10104, 388, 375, 8, 99, "Text"], Cell[10482, 398, 97, 2, 42, "Input"], Cell[10582, 402, 350, 8, 99, "Text"], Cell[10935, 412, 97, 2, 42, "Input"], Cell[11035, 416, 41, 1, 42, "Input"], Cell[11079, 419, 54, 1, 42, "Input"], Cell[11136, 422, 240, 9, 47, "Text", Evaluatable->False], Cell[11379, 433, 88, 2, 42, "Input"], Cell[11470, 437, 70, 2, 42, "Input"], Cell[11543, 441, 532, 17, 102, "Text", Evaluatable->False], Cell[12078, 460, 73, 2, 42, "Input"], Cell[12154, 464, 70, 2, 42, "Input"], Cell[CellGroupData[{ Cell[12249, 470, 35, 0, 61, "Subsubsection"], Cell[12287, 472, 213, 7, 73, "Text"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[12549, 485, 103, 2, 42, "Subsection", Evaluatable->False], Cell[12655, 489, 292, 8, 73, "Text", Evaluatable->False], Cell[12950, 499, 98, 2, 42, "Input"], Cell[13051, 503, 91, 2, 42, "Input"], Cell[13145, 507, 71, 2, 42, "Input"], Cell[13219, 511, 537, 14, 126, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[13781, 529, 35, 0, 61, "Subsubsection"], Cell[13819, 531, 276, 9, 73, "Text"] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[14156, 547, 92, 2, 62, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[14273, 553, 98, 2, 68, "Subsection", Evaluatable->False], Cell[14374, 557, 340, 10, 75, "Text", Evaluatable->False], Cell[14717, 569, 87, 2, 42, "Input"], Cell[14807, 573, 72, 2, 42, "Input"], Cell[14882, 577, 292, 9, 74, "Text", Evaluatable->False], Cell[15177, 588, 46, 1, 42, "Input"], Cell[15226, 591, 197, 4, 47, "Text"], Cell[15426, 597, 105, 2, 42, "Input"], Cell[15534, 601, 152, 4, 47, "Text", Evaluatable->False], Cell[15689, 607, 120, 3, 68, "Input"], Cell[15812, 612, 147, 4, 47, "Text", Evaluatable->False], Cell[15962, 618, 113, 2, 42, "Input"], Cell[16078, 622, 208, 7, 47, "Text", Evaluatable->False], Cell[16289, 631, 121, 3, 42, "Input"], Cell[16413, 636, 70, 2, 42, "Input"], Cell[16486, 640, 247, 8, 47, "Text", Evaluatable->False], Cell[16736, 650, 83, 2, 42, "Input"], Cell[16822, 654, 70, 2, 42, "Input"], Cell[16895, 658, 69, 2, 42, "Input"], Cell[16967, 662, 370, 13, 74, "Text", Evaluatable->False], Cell[17340, 677, 110, 2, 42, "Input"], Cell[17453, 681, 110, 2, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[17600, 688, 98, 2, 42, "Subsection", Evaluatable->False], Cell[17701, 692, 265, 9, 75, "Text", Evaluatable->False], Cell[17969, 703, 216, 8, 47, "Text", Evaluatable->False], Cell[18188, 713, 72, 2, 42, "Input"], Cell[18263, 717, 141, 3, 47, "Text", Evaluatable->False], Cell[18407, 722, 77, 2, 42, "Input"], Cell[18487, 726, 223, 8, 47, "Text", Evaluatable->False], Cell[18713, 736, 77, 2, 42, "Input"], Cell[18793, 740, 219, 7, 48, "Text", Evaluatable->False], Cell[19015, 749, 206, 8, 47, "Text", Evaluatable->False], Cell[19224, 759, 72, 2, 42, "Input"], Cell[19299, 763, 206, 8, 47, "Text", Evaluatable->False], Cell[19508, 773, 77, 2, 42, "Input"], Cell[19588, 777, 217, 8, 47, "Text", Evaluatable->False], Cell[19808, 787, 77, 2, 42, "Input"], Cell[19888, 791, 278, 10, 75, "Text", Evaluatable->False], Cell[20169, 803, 69, 2, 42, "Input"], Cell[20241, 807, 70, 2, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[20348, 814, 94, 2, 42, "Subsection", Evaluatable->False], Cell[20445, 818, 238, 8, 47, "Text", Evaluatable->False], Cell[20686, 828, 115, 2, 42, "Input"], Cell[20804, 832, 219, 8, 47, "Text", Evaluatable->False], Cell[21026, 842, 107, 2, 42, "Input"], Cell[21136, 846, 211, 8, 47, "Text", Evaluatable->False], Cell[21350, 856, 139, 3, 42, "Input"], Cell[21492, 861, 36, 0, 47, "Text"], Cell[21531, 863, 110, 2, 42, "Input"], Cell[21644, 867, 239, 9, 48, "Text", Evaluatable->False], Cell[21886, 878, 195, 8, 47, "Text", Evaluatable->False], Cell[22084, 888, 139, 3, 42, "Input"], Cell[22226, 893, 110, 2, 42, "Input"], Cell[22339, 897, 51, 1, 42, "Input"], Cell[22393, 900, 72, 2, 42, "Input"], Cell[CellGroupData[{ Cell[22490, 906, 35, 0, 61, "Subsubsection"], Cell[22528, 908, 1528, 49, 411, "Text", Evaluatable->False] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[24117, 964, 37, 0, 62, "Section"], Cell[CellGroupData[{ Cell[24179, 968, 36, 0, 68, "Subsection"], Cell[24218, 970, 129, 5, 47, "Text"], Cell[24350, 977, 42, 1, 42, "Input"], Cell[24395, 980, 68, 1, 42, "Input"], Cell[24466, 983, 169, 6, 47, "Text"], Cell[24638, 991, 53, 1, 42, "Input"], Cell[24694, 994, 55, 1, 42, "Input"], Cell[24752, 997, 350, 13, 73, "Text"], Cell[25105, 1012, 43, 1, 42, "Input"], Cell[25151, 1015, 50, 1, 42, "Input"], Cell[25204, 1018, 69, 1, 42, "Input"], Cell[25276, 1021, 76, 1, 42, "Input"], Cell[25355, 1024, 131, 5, 47, "Text"], Cell[25489, 1031, 48, 1, 42, "Input"], Cell[25540, 1034, 74, 1, 42, "Input"], Cell[25617, 1037, 155, 5, 47, "Text"], Cell[25775, 1044, 43, 1, 42, "Input"], Cell[25821, 1047, 70, 1, 42, "Input"], Cell[CellGroupData[{ Cell[25916, 1052, 35, 0, 61, "Subsubsection"], Cell[25954, 1054, 120, 3, 47, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[26111, 1062, 35, 0, 61, "Subsubsection"], Cell[26149, 1064, 261, 7, 73, "Text"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[26459, 1077, 53, 0, 42, "Subsection"], Cell[26515, 1079, 297, 11, 73, "Text"], Cell[26815, 1092, 52, 1, 42, "Input"], Cell[26870, 1095, 429, 15, 99, "Text"], Cell[27302, 1112, 43, 1, 42, "Input"], Cell[27348, 1115, 52, 1, 42, "Input"], Cell[27403, 1118, 249, 11, 47, "Text"], Cell[27655, 1131, 53, 1, 42, "Input"], Cell[27711, 1134, 292, 11, 73, "Text"], Cell[28006, 1147, 50, 1, 42, "Input"], Cell[28059, 1150, 91, 3, 47, "Text"], Cell[28153, 1155, 66, 1, 59, "Input"], Cell[28222, 1158, 46, 1, 42, "Input"], Cell[28271, 1161, 64, 1, 59, "Input"], Cell[28338, 1164, 41, 1, 42, "Input"], Cell[28382, 1167, 361, 13, 73, "Text"], Cell[28746, 1182, 80, 1, 59, "Input"], Cell[28829, 1185, 46, 1, 42, "Input"], Cell[28878, 1188, 712, 27, 99, "Text"], Cell[29593, 1217, 61, 1, 42, "Input"], Cell[29657, 1220, 91, 3, 47, "Text"], Cell[29751, 1225, 116, 2, 42, "Input"], Cell[29870, 1229, 63, 0, 47, "Text"], Cell[29936, 1231, 147, 4, 42, "Input"], Cell[30086, 1237, 156, 4, 73, "Text"], Cell[30245, 1243, 48, 1, 42, "Input"], Cell[30296, 1246, 37, 1, 42, "Input"], Cell[30336, 1249, 42, 1, 42, "Input"], Cell[30381, 1252, 41, 1, 42, "Input"], Cell[30425, 1255, 130, 5, 47, "Text"], Cell[30558, 1262, 59, 1, 42, "Input"], Cell[30620, 1265, 312, 10, 73, "Text"], Cell[30935, 1277, 53, 1, 42, "Input"], Cell[30991, 1280, 51, 1, 42, "Input"], Cell[31045, 1283, 37, 1, 42, "Input"], Cell[31085, 1286, 41, 1, 42, "Input"], Cell[31129, 1289, 57, 0, 47, "Text"], Cell[31189, 1291, 78, 1, 42, "Input"], Cell[31270, 1294, 228, 8, 47, "Text"], Cell[31501, 1304, 44, 1, 42, "Input"], Cell[31548, 1307, 59, 1, 42, "Input"], Cell[31610, 1310, 114, 3, 47, "Text"], Cell[31727, 1315, 51, 1, 42, "Input"], Cell[31781, 1318, 52, 1, 42, "Input"], Cell[31836, 1321, 241, 7, 73, "Text"], Cell[32080, 1330, 85, 1, 42, "Input"], Cell[32168, 1333, 43, 1, 42, "Input"], Cell[CellGroupData[{ Cell[32236, 1338, 35, 0, 61, "Subsubsection"], Cell[32274, 1340, 609, 18, 151, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[32920, 1363, 35, 0, 61, "Subsubsection"], Cell[32958, 1365, 228, 7, 73, "Text"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[33235, 1378, 29, 0, 42, "Subsection"], Cell[33267, 1380, 229, 7, 73, "Text"], Cell[33499, 1389, 71, 1, 42, "Input"], Cell[33573, 1392, 42, 1, 42, "Input"], Cell[33618, 1395, 163, 4, 73, "Text"], Cell[33784, 1401, 72, 1, 63, "Input"], Cell[33859, 1404, 151, 4, 73, "Text"], Cell[34013, 1410, 69, 1, 63, "Input"], Cell[34085, 1413, 40, 1, 42, "Input"], Cell[34128, 1416, 189, 5, 73, "Text"], Cell[34320, 1423, 66, 1, 42, "Input"], Cell[34389, 1426, 40, 1, 42, "Input"], Cell[34432, 1429, 57, 1, 42, "Input"], Cell[34492, 1432, 40, 1, 42, "Input"], Cell[34535, 1435, 41, 1, 42, "Input"], Cell[34579, 1438, 323, 9, 73, "Text"], Cell[34905, 1449, 90, 1, 42, "Input"], Cell[34998, 1452, 82, 1, 47, "Text"], Cell[35083, 1455, 90, 1, 42, "Input"], Cell[35176, 1458, 66, 0, 47, "Text"], Cell[35245, 1460, 89, 1, 42, "Input"], Cell[35337, 1463, 70, 0, 47, "Text"], Cell[35410, 1465, 75, 1, 42, "Input"], Cell[CellGroupData[{ Cell[35510, 1470, 35, 0, 61, "Subsubsection"], Cell[35548, 1472, 308, 9, 73, "Text"] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[35917, 1488, 55, 0, 62, "Section"], Cell[35975, 1490, 213, 7, 73, "Text"], Cell[36191, 1499, 53, 1, 42, "Input"], Cell[36247, 1502, 46, 1, 42, "Input"], Cell[36296, 1505, 93, 3, 47, "Text"], Cell[36392, 1510, 68, 1, 42, "Input"], Cell[36463, 1513, 46, 1, 42, "Input"], Cell[36512, 1516, 94, 1, 47, "Text"], Cell[36609, 1519, 62, 1, 42, "Input"], Cell[36674, 1522, 46, 1, 42, "Input"], Cell[36723, 1525, 246, 6, 73, "Text"], Cell[36972, 1533, 68, 1, 42, "Input"], Cell[37043, 1536, 141, 4, 47, "Text"], Cell[37187, 1542, 45, 1, 42, "Input"], Cell[37235, 1545, 151, 6, 47, "Text"], Cell[37389, 1553, 62, 1, 42, "Input"], Cell[37454, 1556, 201, 5, 73, "Text"], Cell[37658, 1563, 65, 1, 42, "Input"], Cell[37726, 1566, 228, 6, 73, "Text"], Cell[37957, 1574, 49, 1, 42, "Input"], Cell[38009, 1577, 48, 1, 42, "Input"], Cell[CellGroupData[{ Cell[38082, 1582, 36, 0, 61, "Subsubsection"], Cell[38121, 1584, 1021, 31, 151, "Text"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[39191, 1621, 86, 2, 62, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[39302, 1627, 35, 0, 61, "Subsubsection"], Cell[39340, 1629, 324, 8, 73, "Text"], Cell[39667, 1639, 63, 1, 42, "Input"], Cell[39733, 1642, 118, 2, 47, "Text"], Cell[39854, 1646, 54, 1, 42, "Input"], Cell[39911, 1649, 110, 2, 47, "Text"], Cell[40024, 1653, 56, 1, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[40117, 1659, 35, 0, 38, "Subsubsection"], Cell[40155, 1661, 101, 2, 47, "Text"], Cell[40259, 1665, 96, 2, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[40392, 1672, 35, 0, 38, "Subsubsection"], Cell[40430, 1674, 104, 2, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[40571, 1681, 35, 0, 38, "Subsubsection"], Cell[40609, 1683, 113, 2, 47, "Text", Evaluatable->False], Cell[40725, 1687, 96, 2, 42, "Input"], Cell[40824, 1691, 92, 2, 47, "Text", Evaluatable->False], Cell[40919, 1695, 75, 2, 42, "Input"], Cell[40997, 1699, 103, 2, 47, "Text", Evaluatable->False], Cell[41103, 1703, 74, 2, 42, "Input"], Cell[41180, 1707, 152, 7, 47, "Text", Evaluatable->False], Cell[41335, 1716, 111, 2, 42, "Input"], Cell[41449, 1720, 294, 13, 47, "Text", Evaluatable->False], Cell[41746, 1735, 124, 3, 42, "Input"], Cell[41873, 1740, 185, 7, 47, "Text", Evaluatable->False], Cell[42061, 1749, 116, 2, 42, "Input"], Cell[42180, 1753, 102, 2, 47, "Text", Evaluatable->False], Cell[42285, 1757, 68, 2, 42, "Input"], Cell[42356, 1761, 104, 2, 47, "Text", Evaluatable->False], Cell[42463, 1765, 116, 2, 42, "Input"], Cell[42582, 1769, 102, 2, 47, "Text", Evaluatable->False], Cell[42687, 1773, 78, 2, 42, "Input"], Cell[42768, 1777, 104, 2, 47, "Text", Evaluatable->False], Cell[42875, 1781, 83, 2, 42, "Input"], Cell[42961, 1785, 232, 10, 47, "Text", Evaluatable->False], Cell[43196, 1797, 84, 2, 42, "Input"], Cell[43283, 1801, 112, 2, 47, "Text", Evaluatable->False], Cell[43398, 1805, 78, 2, 42, "Input"], Cell[43479, 1809, 83, 2, 42, "Input"], Cell[43565, 1813, 125, 2, 47, "Text", Evaluatable->False], Cell[43693, 1817, 80, 2, 42, "Input"], Cell[43776, 1821, 255, 10, 47, "Text", Evaluatable->False], Cell[44034, 1833, 84, 2, 42, "Input"], Cell[44121, 1837, 49, 1, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[44207, 1843, 35, 0, 38, "Subsubsection"], Cell[44245, 1845, 244, 6, 73, "Text"], Cell[44492, 1853, 125, 2, 68, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[44654, 1860, 35, 0, 38, "Subsubsection"], Cell[44692, 1862, 59, 0, 47, "Text"], Cell[CellGroupData[{ Cell[44776, 1866, 69, 1, 42, "Input"], Cell[44848, 1869, 362, 5, 141, "Output"] }, Open ]], Cell[45225, 1877, 62, 0, 47, "Text"], Cell[CellGroupData[{ Cell[45312, 1881, 44, 1, 42, "Input"], Cell[45359, 1884, 471, 6, 191, "Output"] }, Open ]], Cell[45845, 1893, 95, 3, 47, "Text"], Cell[CellGroupData[{ Cell[45965, 1900, 41, 1, 42, "Input"], Cell[46009, 1903, 179, 3, 66, "Output"] }, Open ]], Cell[46203, 1909, 92, 3, 47, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[46332, 1917, 35, 0, 38, "Subsubsection"], Cell[46370, 1919, 54, 0, 47, "Text"], Cell[46427, 1921, 118, 3, 68, "Input"], Cell[46548, 1926, 121, 5, 47, "Text"], Cell[46672, 1933, 80, 1, 42, "Input"], Cell[46755, 1936, 63, 0, 47, "Text"], Cell[46821, 1938, 112, 2, 50, "Input"], Cell[46936, 1942, 191, 8, 47, "Text"], Cell[47130, 1952, 97, 2, 42, "Input"], Cell[47230, 1956, 46, 1, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[47313, 1962, 35, 0, 38, "Subsubsection"], Cell[47351, 1964, 44, 0, 47, "Text"], Cell[47398, 1966, 89, 1, 42, "Input"], Cell[47490, 1969, 43, 0, 47, "Text"], Cell[47536, 1971, 68, 1, 42, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[47641, 1977, 35, 0, 38, "Subsubsection"], Cell[47679, 1979, 51, 0, 47, "Text"], Cell[47733, 1981, 108, 2, 68, "Input"], Cell[47844, 1985, 68, 0, 47, "Text"], Cell[47915, 1987, 149, 3, 68, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[48101, 1995, 36, 0, 38, "Subsubsection"], Cell[48140, 1997, 154, 3, 108, "Input"], Cell[48297, 2002, 42, 1, 42, "Input"] }, Closed]] }, Closed]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)