{"id":789,"date":"2017-06-05T12:36:13","date_gmt":"2017-06-05T16:36:13","guid":{"rendered":"http:\/\/advancedmathyoungstudents.com\/blog\/?p=789"},"modified":"2017-06-05T12:36:14","modified_gmt":"2017-06-05T16:36:14","slug":"james-tanton-is-still-rolling","status":"publish","type":"post","link":"https:\/\/advancedmathyoungstudents.com\/blog\/?p=789","title":{"rendered":"James Tanton is Still Rolling"},"content":{"rendered":"<p>And now\u00a0he asks:<\/p>\n<p><strong><em><strong>\u201cIf I roll a die five times, how many distinct values should I expect to see?\u201d<\/strong><\/em><\/strong><\/p>\n<p>I was feeling pretty good about myself having solved the first one. (<a href=\"http:\/\/wp.me\/p4uvY7-cE\">Here<\/a>) And my Excel simulation told me I was at least close.\u00a0 But when I attacked this new\u00a0one, I hit some trouble.\u00a0 I know I need the expected values, but to get them, I need the probabilities.\u00a0 And I was bogging down in the calculations.\u00a0 I could find the probability of getting one distinct value, but two was harder, three harder still\u2026<\/p>\n<p><em><strong>Simulate first and calculate later<\/strong><\/em><\/p>\n<p>I already had the spreadsheet with the random integers.\u00a0 But Excel does not have a \u201cnumber of discrete values on the list\u201d function.\u00a0 So even there, I was stuck.<\/p>\n<p>[Side note: back in the day when I did know how to code, I briefly knew an obscure programming language called APL. \u00a0I believe that in APL, a problem like this can be solved in a single line of code, dense with obscure symbols.\u00a0 Document your code, campers, or you will never remember what you did!]<\/p>\n<p>But since JT only rolled the dice 5 times, I did eventually come up with a way to have Excel do this for me. Let\u2019s call it the \u201cGo Fish\u201d procedure, naming it after the simple card game.\u00a0 It\u2019s not very elegant but it works and, as you will see, it pays extra dividends.<\/p>\n<p>For each possible dice value, 1 through 6, I made a column that answered the question: did this value appear on the list. For example, the formula in my first column answers the Go Fish question: got any ones?<\/p>\n<p>=1\u00d7or((a2=1),(b2=1),(c2=1),(d2=1),(e2=1))<\/p>\n<p>This generates a value of 1 if any of the dice came up as a 1 and zero if none of them did.<\/p>\n<p>I made a total of 6 columns like this. Then, the sum of those columns tells me how many distinct values appeared in my original 5 rolls of the dice.<\/p>\n<p>From there, it was just a matter of doing this in every row and taking the average. Again I did 10 years worth of rows.<\/p>\n<p><a href=\"http:\/\/advancedmathyoungstudents.com\/blog\/2017\/06\/05\/james-tanton-is-still-rolling\/tanton-dice-excel-2\/\" rel=\"attachment wp-att-790\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-790\" src=\"http:\/\/advancedmathyoungstudents.com\/blog\/wp-content\/uploads\/2017\/06\/tanton-dice-excel-2.png\" alt=\"tanton dice excel 2\" width=\"1017\" height=\"177\" srcset=\"https:\/\/advancedmathyoungstudents.com\/blog\/wp-content\/uploads\/2017\/06\/tanton-dice-excel-2.png 1017w, https:\/\/advancedmathyoungstudents.com\/blog\/wp-content\/uploads\/2017\/06\/tanton-dice-excel-2-300x52.png 300w, https:\/\/advancedmathyoungstudents.com\/blog\/wp-content\/uploads\/2017\/06\/tanton-dice-excel-2-768x134.png 768w, https:\/\/advancedmathyoungstudents.com\/blog\/wp-content\/uploads\/2017\/06\/tanton-dice-excel-2-500x87.png 500w\" sizes=\"(max-width: 1017px) 100vw, 1017px\" \/><\/a><\/p>\n<p>You can see in the top row that the dice came up: 1, 3, 2, 1, 1<\/p>\n<p>So the answer was yes if the question was got any 1&#8217;s, 2&#8217;s or 3&#8217;s and no for any 4&#8217;s, 5&#8217;s or 6&#8217;s.\u00a0 That gave a total of 3 distinct values this time.<\/p>\n<p>OK, so now I have a rough idea of the answer. But aren\u2019t I just stalling?\u00a0 I should get back to work calculating the probabilities and expected values.<\/p>\n<p>[Really, I <em>am<\/em> stalling.\u00a0 I should be grading lab reports.]<\/p>\n<p>Then I realized that the procedure I used to generate the answer in the simulation can be used to calculate the answer directly:<\/p>\n<p>Say you want to know the probability that your list contains a 1. That is more easily calculated as 1 minus the probability that it contains no 1\u2019s.<\/p>\n<p>P(got any ones) = 1 \u2013 (5\/6)<sup>5<\/sup><\/p>\n<p>But that is also the probability for any of the single Go Fish questions:<\/p>\n<p>P(got any ones) = P(got any twos) = P(got any threes)\u2026and so on.<\/p>\n<p>So the expected value of the total of the \u201cGo Fish\u201d questions = 6 times the value for any one of them!<\/p>\n<p>That means we expect 6\u00d7(1 \u2013 (5\/6)<sup>5<\/sup>) = 3.589 different results every time.<\/p>\n<p>That\u2019s not far from what the simulation told me to expect. I ran it 5 more times and got:<\/p>\n<p>3.584, 3.591, 3.586, 3.587, 3.595<\/p>\n<p>So I am feeling like this is a promising answer. I would still like to go back and finish calculating the probabilities the hard way.\u00a0 But the point to notice here is that taking the time to simulate the problem also provided the key to a solution path.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>And now\u00a0he asks: \u201cIf I roll a die five times, how many distinct values should I expect to see?\u201d I was feeling pretty good about myself having solved the first one. (Here) And my Excel simulation told me I was &hellip; <a href=\"https:\/\/advancedmathyoungstudents.com\/blog\/?p=789\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4uvY7-cJ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/789"}],"collection":[{"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=789"}],"version-history":[{"count":2,"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions"}],"predecessor-version":[{"id":792,"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions\/792"}],"wp:attachment":[{"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/advancedmathyoungstudents.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}