(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. 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[ 26694, 907]*) (*NotebookOutlinePosition[ 27727, 940]*) (* CellTagsIndexPosition[ 27683, 936]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData["Chapter II. List-Based Programming"], "Title", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "4. Introduction to Lists and Using Programming Principles"], "Title", Evaluatable->False, AspectRatioFixed->True], Cell["Last revision: January 15 1998", "SmallText", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "In this section we introduce two methods of approaching a problem and use \ one of them to implement a class roster and answer some probabilistic \ questions. In doing so, we introduce list and list manipulations when \ necessary."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Mathematica", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[" operations/structures introduced: \n Random\n Table\n \ Union\n Length\n Sum\n ListPlot", Evaluatable->False, AspectRatioFixed->True] }], "SmallText", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Problem Solving Strategies (Bottom-Up, Top-Down)"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Computer programming tasks, while sometimes simply stated, frequently \ involve using many steps in their solution. These steps are sometimes each \ completed once, in order, and at other times some of the steps in the \ solution are repeated. In this lab we will both situations, and, in doing \ so, will give you some hands-on experience with the solution to a programming \ problem. Before we reach the details, however, a few remarks about the \ method we will use in approaching the task are in order. After all, when we \ are presented with a homework problem, we often confront the questions \ \"Where do we start?\" and \"How do we proceed?\""], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Bottom-Up Analysis"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["The phrase ", Evaluatable->False, AspectRatioFixed->True], StyleBox["bottom-up analysis ", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ "refers to approaching a problem from the inside out or from small pieces \ to larger ones. By this we mean identifying within the larger problem small \ sub-tasks which we may want to perform several times, defining Mathematica \ functions to perform these small sub-tasks, testing these functions, and \ building up from there to medium-sized tasks, and so on. At each stage it is \ best to have a clear, concise purpose in mind for the sub-tasks and to name \ functions and their arguments with names reflecting their purposes. Also, \ there is no requirement that one simply define small functions and then put \ them together in one large function; instead, several intermediate steps may \ be appropriate. In this section we will use a bottom-up approach to solve \ the given problems.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Top-down Analysis"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["The companion strategy to bottom-up analysis is ", Evaluatable->False, AspectRatioFixed->True], StyleBox["top-down analysis", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ ", and this sort of analysis of a problem refers to the process of \ decomposing the larger task into a few smaller sub-tasks with clear and \ concise purposes, naming these functions (but not yet writing code for them), \ and then breaking each of these subtasks down further to even smaller ones, \ and naming those functions. When one reaches a function sufficiently small, \ it is time to write the Mathematica code for that function, and then build up \ form there. For extremely large problems top-down analysis can be useful in \ keeping the larger picture always in mind.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Example of Problem Solving: A Class Roster"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Execute the following input cells."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ numStuds = 15; roster = {\"Carr\", \"Crabtree\", \"Davis\", \"Dixon\", \"Herbert\", \"Jones\", \ \"Moore\", \"Moskowitz\", \"Naples\", \"Phillips\", \"Rice-Stitt\", \ \"Schenk\", \"Seifert\", \"Slaby\", \"Tarver\"};\ \>", "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["Problem", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold", Background->RGBColor[0, 1, 1]], StyleBox[": This class has \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["numStuds", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[ "\" people on the roster. If we randomly call on people 15 times a day, \ there may be people who are called upon more than once. How many ", Evaluatable->False, AspectRatioFixed->True], StyleBox["different", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[" people are likely to be called on?", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Answer", FontWeight->"Bold", Background->RGBColor[0, 1, 1]], ": Without some mathematics, this problem is difficult to answer \ theoretically. Empirically, however, we may simulate the situation and apply \ inductive reasoning. " }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Randomly Calling On One Student"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "We approach the problem using simulation by first examining what small \ problems we can answer for ourselves. For instance, how can we select a \ random name from the list of names? How can we even select a particular \ name?"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "The Mathematica double-bracket notation allows us to select a particular \ element of the list."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["roster[[5]]", "Input", AspectRatioFixed->True], Cell[TextData[{ "This gets the fifth name in the list. To get a random name we need first \ to choose a random number from 1 to \"", StyleBox["numStuds", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], "\" and choose that position on the roster. " }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "To get a random Integer between 1 and \"", StyleBox["numStuds", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], "\" we can use the \"", StyleBox["Random[]", FontFamily->"Courier"], "\" command. The \"", StyleBox["Random[]", FontFamily->"Courier"], "\" command returns a random value of the data type specified in the first \ argument, between the two values given in a list as the second argument. \ (Execute \"", StyleBox["?Random", FontFamily->"Courier"], "\" or look up ", StyleBox["Random", FontFamily->"Courier"], " in the Help browser if you are confused!)" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Random[Integer,{1,numStuds}]", "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["Putting the two together---using the result of the \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["Random[]", FontFamily->"Courier"], StyleBox["\" command ", Evaluatable->False, AspectRatioFixed->True], StyleBox["inside", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ " the double-bracket notation---gives us a random name from the list.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["roster[[ Random[Integer,{1,numStuds}] ]]", "Input", AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Randomly Calling On Several Students"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "To get five random names we could enter the command above five times. A \ better program, however, is to use the \"", StyleBox["Table[]", FontFamily->"Courier"], "\" command to get a list of all five names. Here's an example of how to \ use the \"", StyleBox["Table[]", FontFamily->"Courier"], "\" command to a list of five ", StyleBox["r", FontSlant->"Italic"], "'s." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Table[ r, {5} ]", "Input", AspectRatioFixed->True], Cell[TextData[{ "We want five random names, so instead of putting \"", StyleBox["r", FontFamily->"Courier"], "\" inside the \"", StyleBox["Table[]", FontFamily->"Courier"], "\" command as the first argument, we replace \"", StyleBox["r", FontFamily->"Courier"], "\" with the expression which will produce a random name for us. The \ function \"", StyleBox["Table[]", FontFamily->"Courier"], "\" will evaluate this expression five separate time. To make the code \ easier to read, we will use some indentation, which does not affect the \ execution." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ Table[ \t roster[[ Random[Integer,{1,numStuds}] ]], {5} ]\ \>", "Input", AspectRatioFixed->True], Cell[TextData["How about a list of fifteen random names?"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ Table[ roster[[ Random[Integer,{1,numStuds}] ]], {15} ]\ \>", "Input", AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData[ "Counting the Number of Distinct Students Called On"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "Now we know how to generate a list of fifteen random names, chosen from \ the list. But how many ", Evaluatable->False, AspectRatioFixed->True], StyleBox["different", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ " names are on this list? We could count them by hand, but it would be \ helpful if we could have Mathematica throw out the duplicates. To do this, \ we can use the function \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["Union[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\". Here's an example of the \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["Union[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" function:", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Union[ {c,c,b,a,b,a,c,c,c} ]", "Input", AspectRatioFixed->True], Cell[TextData[{ "Notice that \"", StyleBox["Union[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], "\" eliminates duplicates in a list and returns a sorted list. Let's use \ this idea to see how many different names we have in a random list of fifteen \ names. To eliminate duplicates, we wrap \"", StyleBox["Union[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], "\" around the command we're currently using to produce fifteen random \ names:" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ Union[ Table[ roster[[ Random[Integer,{1,numStuds}] ]], {15} ] ]\ \>", "Input", AspectRatioFixed->True], Cell[TextData[{ "(We expect to be getting a different list of names each time we use the \ \"", StyleBox["roster[[....]]", FontFamily->"Courier"], "\" selection operation, so don't be surprised if this list doesn't match \ up with the one that came before.) Now how many students are on the list? \ We can ask Mathematica to count the number of elements in the list by using \ the \"", StyleBox["Length[]", FontFamily->"Courier"], "\" command. Let's test the \"", StyleBox["Length[]", FontFamily->"Courier"], "\" command." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Length[ {3,3,5,5,6} ]", "Input", AspectRatioFixed->True], Cell[TextData[{ "Yes, there are five elements in the list {3,3,5,5,6}. So, let's now wrap \ our list of distinct elements in the \"", StyleBox["Length[]", FontFamily->"Courier"], "\" function:" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ Length[ Union[ Table[ roster[[ Random[Integer,{1,numStuds}] ]], {15} ] ] ]\ \>", "Input", AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell["Writing a Function", "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["We now have a Mathematica ", Evaluatable->False, AspectRatioFixed->True], StyleBox["program ", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ " and a have provided a good example of how to write programs using \ Mathematica. The idea is to start with simple parts and to build up a \ nesting of functions to accomplish the final task. ", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "What if we decide to repeat this experiment, drawing twenty random names \ instead of fifteen? One way is to just use the same command as above, \ replacing the ", StyleBox["{15}", FontFamily->"Courier"], " by ", StyleBox["{20}", FontFamily->"Courier"], ". But suppose we also want to see what happens when we draw 30, 40, 50, \ or 5 names. If we plan on performing a process many times with different \ values, then it's a good idea to convert the process into a function, \ assigning it a name and providing for any parameters. For example, if we \ will need to square many numbers, we should define a squaring function:" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ Clear[square] square[x_]:=x^2\ \>", "Input", AspectRatioFixed->True], Cell[TextData[{ "Remember that the \"", StyleBox["x", "Output"], "\" on the left-hand side is the formal parameter for the function, as \ indicated by the underscore \"", StyleBox["_", "Output"], "\". It's important that the \"", StyleBox["_", "Output"], "\" (sometimes a blank) appears on the left, but not on the right hand \ side. It's also a good idea to use \"", StyleBox["Clear[]", "Output"], "\" to erase any previous definitions of the name we are about to use. We \ can now use the function \"", StyleBox["square[]", "Output"], "\" to compute the square of anything. " }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ square[3] square[{a,b,c}]\ \>", "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "(Notice that we don't use the underscore here, only when we first define \ the function.) Now let's convert our process above into a function. We can \ use any name we like, but two useful guidelines are the following: (1) All \ built-in commands start with uppercase letters; to avoid conflicts with \ these, begin a name of a function with a lowercase letter; and (2) Choose a \ ", Evaluatable->False, AspectRatioFixed->True], StyleBox["descriptive", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[" name.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ Clear[draw] draw[n_]:=Length[ Union[ Table[ roster[[ Random[Integer,{1,numStuds}] ]], {n} ] ] ]\ \>", "Input", AspectRatioFixed->True], Cell[TextData[ "Now we can answer the question posed in the original problem, for any number \ of times the class is called upon. For a day during which the class was \ called upon fifteen times, we would execute"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["draw[15]", "Input", AspectRatioFixed->True], Cell[TextData[ "This command reports how many different people fielded fifteen questions. \ Similarly, if the class was called upon twenty-five times, we would execute"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["draw[25]", "Input", AspectRatioFixed->True], Cell[TextData[ "This command reports how many different people fielded 25 questions."], "Text", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Approaching an Estimate"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "Since \"", StyleBox["draw[]", "Output"], "\" uses the \"", StyleBox["Random[]", "Output"], "\" function, we shouldn't expect to get the same answer every time. Here \ are ten different trials of asking fifteen questions." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Table[ draw[15], {10}]", "Input", AspectRatioFixed->True], Cell[TextData[{ "Remember that we started by asking for an estimate of \"", StyleBox["draw[15]", "Output"], "\". Perhaps it would be a good idea to take an average of ten trials. To \ do this we need to sum up the results of ten trials and then divide by ten. \ To perform the addition, we'll need the \"", StyleBox["Sum[]", "Output"], "\" function, and example of which follows:" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Sum[ r, {5}]", "Input", AspectRatioFixed->True], Cell[TextData[{ "When we entered \"", StyleBox["Table[ r, {5}]", "Output"], "\" we found a list of 5 \"", StyleBox["r", "Input", FontWeight->"Plain"], "\"'s; now, using \"", StyleBox["Sum[]", "Input", FontWeight->"Plain"], "\" instead of \"", StyleBox["Table[]", "Input", FontWeight->"Plain"], "\" gives us a sum of 5 \"", StyleBox["r", "Input", FontWeight->"Plain"], "\"'s. Now let's add up ten values of \"", StyleBox["draw[40]", "Input", FontWeight->"Plain"], "\" and divide by ten. " }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Sum[ draw[40], {10} ] /10", "Input", AspectRatioFixed->True], Cell[TextData[{ "We'll name a new function that will compute the average value of \"", StyleBox["draw[n]", "Input", FontWeight->"Plain"], "\" over several trials; hence we'll need a second parameter, which we call \ \"", StyleBox["trials", "Input", FontWeight->"Plain"], "\". While we're writing the new function, we'll wrap \"", StyleBox["N[]", "Input", FontWeight->"Plain"], "\" around the expression to insure that we always have a decimal answer." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ Clear[aveDraw] aveDraw[n_,trials_] := \t N[ Sum[ draw[n], {trials} ] / trials ]\ \>", "Input", AspectRatioFixed->True], Cell[TextData[{ "The two arguments of our function are \"", StyleBox["n", "Input", FontWeight->"Plain"], "\", the number of names we want to draw each time, and \"", StyleBox["trials", "Input", FontWeight->"Plain"], "\", the number of trials over which we want to average." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["aveDraw[15,100]", "Input", AspectRatioFixed->True], Cell[TextData[ "The command above tells us that the average number of different people \ called on each day will be between 10 and 11. Of course, only ten or eleven \ different people will actually be called upon during any given day! Is this \ a good answer to our original question? If we enter the same command again \ we're likely to get slightly different results. "], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["aveDraw[15,100]", "Input", AspectRatioFixed->True], Cell[TextData[ "But if the results aren't too different, then we can feel good about giving \ an estimate. If the results are still very different, then perhaps we need \ to average over more trials, i.e., replace the 100 with 200, or 500."], "Text",\ Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "In your homework, you will be asked to use the function \"", StyleBox["aveDraw", "Input", FontWeight->"Plain"], "\" to answer the following two questions. If 10 random names are called \ each day, how many different people are likely to be called on? How many \ random names should be called so that 15 different people get called? " }], "Text", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["A Graphical Display"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "We might understand our problem better if we could see a graph of \"", StyleBox["draw[]", "Input", FontWeight->"Plain"], "\" for different values of \"", StyleBox["n", "Input", FontWeight->"Plain"], "\" or of \"", StyleBox["aveDraw[]", "Input", FontWeight->"Plain"], "\" for different values of \"", StyleBox["n", "Input", FontWeight->"Plain"], "\" and \"", StyleBox["trials", "Input", FontWeight->"Plain"], "\". To do so, we need to give Mathematica a list of points to plot. The \ following \"", StyleBox["Table[]", "Input", FontWeight->"Plain"], "\" command produces a list of pairs ", StyleBox["{i, draw[i]}", "Input", FontWeight->"Plain"], ", as \"", StyleBox["i", "Input", FontWeight->"Plain"], "\" (our \"", StyleBox["x", FontSlant->"Italic"], "-coordinate\") runs from one to five." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Table[ {i,draw[i]},{i,1,5}]", "Input", AspectRatioFixed->True], Cell[TextData[{ "Aside on ", StyleBox["FormatType", FontSlant->"Italic"], "s: Select the output cell above (for \"", StyleBox["Table[ {i,draw[i]},{i,1,5}]", "Input", FontWeight->"Plain"], "\"). Then, under the ", StyleBox["Cell", FontFamily->"Chicago"], " menu, look at the ", StyleBox["Convert to", FontFamily->"Chicago"], " options. Experiment with format types by selecting the options: ", StyleBox["InputForm", FontFamily->"Chicago"], ", ", StyleBox["OutputForm", FontFamily->"Chicago"], ", ", StyleBox["StandardForm", FontFamily->"Chicago"], ", and ", StyleBox["TraditionalForm", FontFamily->"Chicago"], ". The latter displays this list of pairs as a rectangular array." }], "Text", Evaluatable->False, AspectRatioFixed->True, FontSize->11], Cell[TextData[{ "We can plot these pairs as ", StyleBox["xy", FontSlant->"Italic"], "-coordinates using \"", StyleBox["ListPlot[]", "Input", FontWeight->"Plain"], "\" in the cell below. Recall that \"", StyleBox["%", "Input", FontWeight->"Plain"], "\" denotes using the result of the last evaluation. (If the points are too \ small to see, click on the graphic, grab a corner, and drag it to a larger \ size.)" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["ListPlot[%]", "Input", AspectRatioFixed->True], Cell[TextData[{ "The ", StyleBox["x", FontSlant->"Italic"], "-axis shows the number times the class was called on; the ", StyleBox["y", FontSlant->"Italic"], "-axis, the number of different people selected. Let's look at this graph \ as the number of times people are called on rises from one to one hundred." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["ListPlot[ Table[ {i,draw[i]},{i,1,100}] ] ", "Input", AspectRatioFixed->True], Cell[TextData[{ "The ", StyleBox["y", FontSlant->"Italic"], "-values plotted here were the results of a single trial with \"", StyleBox["draw[i]", "Input", FontWeight->"Plain"], "\". Let's look at the graph using \"", StyleBox["aveDraw[i,5]", "Input", FontWeight->"Plain"], "\" for the ", StyleBox["y", FontSlant->"Italic"], "-value, i.e., using an average of five trials of \"", StyleBox["draw[i]", "Input", FontWeight->"Plain"], "\" for each ", StyleBox["i", "Input", FontWeight->"Plain"], "." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell["ListPlot[ Table[ {i,aveDraw[i,5]},{i,1,100}] ] ", "Input", AspectRatioFixed->True], Cell[TextData[ "In your homework you will be asked to use these functions to answer the \ original question in some detail."], "Text", Evaluatable->False, AspectRatioFixed->True] }, Open ]] }, Closed]] }, Open ]] }, FrontEndVersion->"4.0 for Macintosh", ScreenRectangle->{{0, 832}, {0, 604}}, WindowToolbars->{}, WindowSize->{764, 577}, WindowMargins->{{4, Automatic}, {Automatic, 1}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, MacintoshSystemPageSetup->"\<\ 00<0004/0B`000003809T?o>old" ] (*********************************************************************** 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[1739, 51, 110, 2, 98, "Title", Evaluatable->False], Cell[1852, 55, 133, 3, 136, "Title", Evaluatable->False], Cell[1988, 60, 100, 2, 26, "SmallText", Evaluatable->False], Cell[2091, 64, 306, 6, 46, "Text", Evaluatable->False], Cell[2400, 72, 363, 11, 110, "SmallText", Evaluatable->False], Cell[CellGroupData[{ Cell[2788, 87, 125, 2, 50, "Section", Evaluatable->False], Cell[2916, 91, 729, 11, 94, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[3670, 106, 98, 2, 46, "Subsection", Evaluatable->False], Cell[3771, 110, 1130, 24, 112, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[4938, 139, 97, 2, 46, "Subsection", Evaluatable->False], Cell[5038, 143, 951, 21, 96, "Text", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[6038, 170, 119, 2, 30, "Section", Evaluatable->False], Cell[6160, 174, 108, 2, 30, "Text", Evaluatable->False], Cell[6271, 178, 267, 7, 72, "Input"], Cell[6541, 187, 815, 27, 50, "Text", Evaluatable->False], Cell[7359, 216, 330, 9, 48, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[7714, 229, 111, 2, 46, "Subsection", Evaluatable->False], Cell[7828, 233, 303, 6, 46, "Text", Evaluatable->False], Cell[8134, 241, 170, 4, 30, "Text", Evaluatable->False], Cell[8307, 247, 54, 1, 27, "Input"], Cell[8364, 250, 346, 10, 46, "Text", Evaluatable->False], Cell[8713, 262, 713, 23, 62, "Text", Evaluatable->False], Cell[9429, 287, 71, 1, 27, "Input"], Cell[9503, 290, 563, 19, 32, "Text", Evaluatable->False], Cell[10069, 311, 85, 1, 27, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[10191, 317, 116, 2, 46, "Subsection", Evaluatable->False], Cell[10310, 321, 473, 15, 48, "Text", Evaluatable->False], Cell[10786, 338, 58, 1, 27, "Input"], Cell[10847, 341, 646, 19, 62, "Text", Evaluatable->False], Cell[11496, 362, 109, 5, 57, "Input"], Cell[11608, 369, 115, 2, 30, "Text", Evaluatable->False], Cell[11726, 373, 110, 5, 57, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[11873, 383, 131, 3, 46, "Subsection", Evaluatable->False], Cell[12007, 388, 977, 32, 64, "Text", Evaluatable->False], Cell[12987, 422, 71, 1, 27, "Input"], Cell[13061, 425, 585, 17, 62, "Text", Evaluatable->False], Cell[13649, 444, 124, 7, 87, "Input"], Cell[13776, 453, 611, 17, 62, "Text", Evaluatable->False], Cell[14390, 472, 64, 1, 27, "Input"], Cell[14457, 475, 265, 8, 31, "Text", Evaluatable->False], Cell[14725, 485, 144, 9, 117, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[14906, 499, 88, 2, 46, "Subsection", Evaluatable->False], Cell[14997, 503, 533, 16, 48, "Text", Evaluatable->False], Cell[15533, 521, 723, 16, 79, "Text", Evaluatable->False], Cell[16259, 539, 80, 4, 42, "Input"], Cell[16342, 545, 661, 17, 65, "Text", Evaluatable->False], Cell[17006, 564, 76, 4, 42, "Input"], Cell[17085, 570, 706, 19, 64, "Text", Evaluatable->False], Cell[17794, 591, 165, 10, 132, "Input"], Cell[17962, 603, 272, 5, 46, "Text", Evaluatable->False], Cell[18237, 610, 51, 1, 27, "Input"], Cell[18291, 613, 230, 5, 46, "Text", Evaluatable->False], Cell[18524, 620, 51, 1, 27, "Input"], Cell[18578, 623, 146, 4, 30, "Text", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[18761, 632, 103, 2, 46, "Subsection", Evaluatable->False], Cell[18867, 636, 309, 9, 47, "Text", Evaluatable->False], Cell[19179, 647, 65, 1, 27, "Input"], Cell[19247, 650, 453, 10, 64, "Text", Evaluatable->False], Cell[19703, 662, 55, 1, 27, "Input"], Cell[19761, 665, 595, 21, 48, "Text", Evaluatable->False], Cell[20359, 688, 68, 1, 27, "Input"], Cell[20430, 691, 539, 14, 48, "Text", Evaluatable->False], Cell[20972, 707, 131, 5, 57, "Input"], Cell[21106, 714, 351, 10, 47, "Text", Evaluatable->False], Cell[21460, 726, 58, 1, 27, "Input"], Cell[21521, 729, 434, 7, 62, "Text", Evaluatable->False], Cell[21958, 738, 58, 1, 27, "Input"], Cell[22019, 741, 301, 6, 46, "Text", Evaluatable->False], Cell[22323, 749, 423, 9, 46, "Text", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[22783, 763, 99, 2, 46, "Subsection", Evaluatable->False], Cell[22885, 767, 943, 32, 64, "Text", Evaluatable->False], Cell[23831, 801, 70, 1, 27, "Input"], Cell[23904, 804, 821, 29, 65, "Text", Evaluatable->False], Cell[24728, 835, 497, 15, 48, "Text", Evaluatable->False], Cell[25228, 852, 54, 1, 27, "Input"], Cell[25285, 855, 390, 11, 48, "Text", Evaluatable->False], Cell[25678, 868, 87, 1, 27, "Input"], Cell[25768, 871, 606, 22, 48, "Text", Evaluatable->False], Cell[26377, 895, 92, 1, 27, "Input"], Cell[26472, 898, 182, 4, 30, "Text", Evaluatable->False] }, Open ]] }, Closed]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)