(*********************************************************************** 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[ 8413, 245]*) (*NotebookOutlinePosition[ 9153, 271]*) (* CellTagsIndexPosition[ 9109, 267]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ \(\(\(Virtual\)\(\ \)\(Coin\)\(\ \)\(Toss\)\(\ \)\)\)], "Title", FontFamily->"Arial"], Cell[BoxData[ \(Needs["\"]\)], "Input", CellLabel->"In[2]:=", FontFamily->"Arial"], Cell["\<\ The textbook states the relative frequency of event A approaches the \ probability of A as the sample size approaches infinity. In math \ terms,.....\ \>", "Text", FontFamily->"Arial"], Cell[BoxData[ \(P \((A)\)\ = \ Limit[\(Frequency\ of\ A\)\/n, n \[Rule] \[Infinity]]\)], "DisplayFormula", CellLabel->"In[1]:=", FontFamily->"Arial"], Cell["\<\ How does this work? A simple coin toss experiment can show this. A fair coin \ has a probability of 0.50 (50%) of landing heads-up. According the textbook, \ tossing a coin over a large number of times and recording the relative \ frequency of the coin landing heads-up will approach the value of 0.50. What \ is true is that the outcome of tossing a coin 1000 times is the same as \ tossing 1000 coins once. What makes this convenient is that we can have the \ computer toss the coins, keep track of the outcomes and compute the relative \ frequency. Below is a little Mathematica program. There are four initial \ settings. \tTosses \[Rule] the number of coins that the computer will toss at \ one time. \ta\[Rule] a counter for the program. \tH\[Rule] this will store the number of tosses that are heads. \tT\[Rule] this stores the number of tail tosses. As the user, you can change the number of tosses (it is currently \ set at 100) and evaluate the program to find out how many heads and tails \ result from the toss. Note: as you increase the number, the time needed by \ the program to generate the results increases. Tossing more than 50,000 coins \ can take a number of minutes. \ \>", "Text", FontFamily->"Arial"], Cell[BoxData[ \(Tosses = 100; a = 0; \ \ H = 0; \ \ T = 0;\)], "Input", CellLabel->"In[3]:=", FontFamily->"Arial"], Cell[BoxData[ \(\(For[a = 1, \ a\ <= Tosses, \(a++\)\n\t\t{\ \n\t\t\tb = Random[]; \n\t\t\tIf[ b > 0.500, \n\t\t\t\t\ H += 1, \n\t\t\t\t\ T += 1]; \n\t\t\t\ Return[H]; \n\t\t\t\ Return[ T];\n\t\t}\ ];\)\)], "Input", CellLabel->"In[4]:=", FontFamily->"Arial"], Cell[CellGroupData[{ Cell[BoxData[ \(H\)], "Input", CellLabel->"In[5]:=", FontFamily->"Arial"], Cell[BoxData[ \(43\)], "Output", CellLabel->"Out[5]="] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(T\)], "Input", CellLabel->"In[6]:=", FontFamily->"Arial"], Cell[BoxData[ \(57\)], "Output", CellLabel->"Out[6]="] }, Open ]], Cell["\<\ RFHeads gives the relative frequency outcome for the number of heads.\ \>", "Text", FontFamily->"Arial"], Cell[CellGroupData[{ Cell[BoxData[ \(RFHeads = N[\((H/\((H + T)\))\)]\)], "Input", CellLabel->"In[7]:=", FontFamily->"Arial"], Cell[BoxData[ \(0.43`\)], "Output", CellLabel->"Out[7]="] }, Open ]], Cell["\<\ Below are three data sets of trials I conducted. RF100 stores the relative \ frequency outcomes of ten trials -each trial consists of tossing 100 coins. \ RF1000 has ten trials -each trial is the toss of 1,000 coins. RF10000 \ contains ten trials of 10,000 tosses. If the limit condition is true, the trials with the larger number of tosses \ will have outcomes around 0.50 with very little variation. The trials with \ the small number number of tosses will show more variation. We will able to \ see the variation through the range value (difference between the max. and \ min. value) and the standard deviation value. \ \>", "Text", FontFamily->"Arial"], Cell[BoxData[ \(\(RF100 = {0.49, 0.47, 0.51, 0.62, 0.45, 0.6, 0.46, 0.38, 0.49, 0.51};\)\)], "Input", CellLabel->"In[8]:=", FontFamily->"Arial"], Cell[BoxData[ \(\(RF1000 = {\ 0.51, \ 0.508, 0.478, 0.503, 0.524, 0.495, 0.49199, 0.493, 0.491, 0.502};\)\)], "Input", CellLabel->"In[9]:=", FontFamily->"Arial"], Cell[BoxData[ \(\(RF10000 = {0.4931, \ 0.4923, \ 0.5094999, \ 0.5051, 0.507, 0.5098, 0.4979, 0.49859, 0.505299, 0.495199};\)\)], "Input", CellLabel->"In[10]:=", FontFamily->"Arial"], Cell[BoxData[ \(\(Descriptives\ = \ {\n\t{"\", \ "\", \ "\", "\"}, \n\t\t{"\", \ Min[RF100], \ Min[RF1000], \ Min[RF10000]}, \n\t\t{"\", \ Max[RF100], \ Max[RF1000], \ Max[RF10000]}, \t\ \n\t\t{"\"\ , \ Max[RF100] - Min[RF100], Max[RF1000] - Min[RF1000], \ Max[RF10000] - Min[RF10000]}, \n\t\t\t{"\", \ Mean[RF100], \ Mean[RF1000], \ Mean[RF10000]}, \n\t\t\t{"\", \ StandardDeviation[RF100], StandardDeviation[RF1000], \ StandardDeviation[RF10000]}};\)\)], "Input", CellLabel->"In[13]:=", FontFamily->"Arial"], Cell[CellGroupData[{ Cell[BoxData[ \(TableForm[Descriptives]\)], "Input", CellLabel->"In[14]:="], Cell[BoxData[ TagBox[GridBox[{ {"\<\"Statistics\"\>", "\<\"RF100\"\>", "\<\"RF1000\"\>", \ "\<\"RF10000\"\>"}, {"\<\"Min\"\>", "0.38`", "0.478`", "0.4923`"}, {"\<\"Max\"\>", "0.62`", "0.524`", "0.5098`"}, {"\<\"Range\"\>", "0.24`", "0.04600000000000004`", "0.017500000000000016`"}, {"\<\"Mean\"\>", "0.49799999999999994`", "0.499599`", "0.5013787900000001`"}, {"\<\"StD\"\>", "0.07004760286167305`", "0.012712863520422503`", "0.006722388657554868`"} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], (TableForm[ #]&)]], "Output", CellLabel->"Out[14]//TableForm="] }, Open ]], Cell["\<\ Above are the descriptive statistics. In every case, the mean relative \ frequency is around 0.50 (50%). The table of descriptive statistics supports the limit condition. The \ first column reports the descriptive statistics for the trials consisting of \ 100 coins. The range of values between the max and min is 0.24 (24.%). The \ standard deviation is 7.0%. The last column reports the statistics for the \ trials consisting of 10,000 coins. The range of relative frequency values \ between the max and min is 0.018 (1.8%) and the standard deviation is 0.0067 \ (0.67%) . The variation for column three is less than the variation found in \ column one. The variation reported in column 2 lies between columns 1 and \ 3.\ \>", "Text", FontFamily->"Arial"] }, Open ]] }, FrontEndVersion->"4.0 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 695}}, WindowToolbars->"EditBar", WindowSize->{996, 616}, WindowMargins->{{2, Automatic}, {Automatic, 2}}, Magnification->1.25, StyleDefinitions -> "TutorialBook.nb" ] (*********************************************************************** 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, 105, 2, 78, "Title"], Cell[1847, 55, 126, 3, 40, "Input"], Cell[1976, 60, 196, 5, 60, "Text"], Cell[2175, 67, 174, 5, 52, "DisplayFormula"], Cell[2352, 74, 1318, 24, 481, "Text"], Cell[3673, 100, 122, 3, 40, "Input"], Cell[3798, 105, 321, 7, 280, "Input"], Cell[CellGroupData[{ Cell[4144, 116, 81, 3, 40, "Input"], Cell[4228, 121, 60, 2, 36, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4325, 128, 81, 3, 40, "Input"], Cell[4409, 133, 60, 2, 36, "Output"] }, Open ]], Cell[4484, 138, 116, 3, 35, "Text"], Cell[CellGroupData[{ Cell[4625, 145, 112, 3, 40, "Input"], Cell[4740, 150, 63, 2, 36, "Output"] }, Open ]], Cell[4818, 155, 671, 12, 209, "Text"], Cell[5492, 169, 163, 4, 40, "Input"], Cell[5658, 175, 180, 4, 40, "Input"], Cell[5841, 181, 200, 4, 70, "Input"], Cell[6044, 187, 695, 12, 280, "Input"], Cell[CellGroupData[{ Cell[6764, 203, 81, 2, 39, "Input"], Cell[6848, 207, 756, 18, 160, "Output"] }, Open ]], Cell[7619, 228, 778, 14, 234, "Text"] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)