Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(This worksheet is based on Mathematica Unit 1.) In a group of 1-3 students, complete the follow- ing, in order, in a Mathematica notebook. Upload
(This worksheet is based on Mathematica Unit 1.) In a group of 1-3 students, complete the follow- ing, in order, in a Mathematica notebook. Upload the completed nb file on Canvas. Put the names of the members of your group in a text cell at the top of the notebook. To receive full credit, the notebook needs to be organized and easy to follow. Delete incorrect cells. Recall Question 6 from the Sample Matlab Midterm, which asked, Let x, y, z denote three randomly chosen two-digit positive integers. What is the probability that 2 (y+z) > 8000? 1. We first find an estimate for the above probability. Do all of the following in a single cell. Nothing should get displayed to the screen other than the final decimal approximation. a. Define n to some positive integer. This will stand for the number of experiments. b. Using delayed assignment, set x to be a randomly chosen two digit integer. (In the previous part, you are explicitly writing down a number. In this part, you are telling Mathematica to choose a number; use the RandomInteger function.) c. Make a list of n values of x : (x+x). In a comment, explain why this is not the same as a list of n values of 2x2. d. Using patterns, count how many elements in your list are strictly greater than 8000. e. Using the expression successes divided by number of experiments, estimate the probability that three randomly chosen two digit integers x, y, z satisfy x (y + 2) > 8000. Use N so that your estimate gets expressed as a decimal. f. Re-evaluate this cell a few times. (You should be able to do this just by hitting shift+enter one time, assuming you put everything into one cell.) If your answer is not consistent to two decimal places, then increase the number of experiments and evaluate again. 2. We can actually use Mathematica to compute the above probability exactly. Do all of the follow- ing in a single cell. Nothing should get displayed to the screen other than the final probability. a. Define twoDigits to be the list of integers {10, 11, 12, ..., 98, 99}. b. Look up the Tuples command. Use it to make a list myTuples of all triples {x, y, z), where x, y, z are chosen from the list twoDigits. (Optional: check that Length[myTuples) is 729000 and Length[myTuples[[1]]] is 3.) c. Make a new list called my Values by replacing each triple {x,y,z} in myTuples with x:(y+z). Use the second type of iterator. (Length[my Values) should again be 729000.) d. Using patterns, count how many elements in my Values are strictly greater than 8000. e. Define p to be the exact probability, calculated using the formula successes divided total possibilities. Display p as a fraction. Do not type 729000 anywhere. f. Optional: compare p to your decimal approximation. If they don't match to two decimal places, then either there is a mistake in one of the two questions, or you did not use enough experiments in the previous question. (This worksheet is based on Mathematica Unit 1.) In a group of 1-3 students, complete the follow- ing, in order, in a Mathematica notebook. Upload the completed nb file on Canvas. Put the names of the members of your group in a text cell at the top of the notebook. To receive full credit, the notebook needs to be organized and easy to follow. Delete incorrect cells. Recall Question 6 from the Sample Matlab Midterm, which asked, Let x, y, z denote three randomly chosen two-digit positive integers. What is the probability that 2 (y+z) > 8000? 1. We first find an estimate for the above probability. Do all of the following in a single cell. Nothing should get displayed to the screen other than the final decimal approximation. a. Define n to some positive integer. This will stand for the number of experiments. b. Using delayed assignment, set x to be a randomly chosen two digit integer. (In the previous part, you are explicitly writing down a number. In this part, you are telling Mathematica to choose a number; use the RandomInteger function.) c. Make a list of n values of x : (x+x). In a comment, explain why this is not the same as a list of n values of 2x2. d. Using patterns, count how many elements in your list are strictly greater than 8000. e. Using the expression successes divided by number of experiments, estimate the probability that three randomly chosen two digit integers x, y, z satisfy x (y + 2) > 8000. Use N so that your estimate gets expressed as a decimal. f. Re-evaluate this cell a few times. (You should be able to do this just by hitting shift+enter one time, assuming you put everything into one cell.) If your answer is not consistent to two decimal places, then increase the number of experiments and evaluate again. 2. We can actually use Mathematica to compute the above probability exactly. Do all of the follow- ing in a single cell. Nothing should get displayed to the screen other than the final probability. a. Define twoDigits to be the list of integers {10, 11, 12, ..., 98, 99}. b. Look up the Tuples command. Use it to make a list myTuples of all triples {x, y, z), where x, y, z are chosen from the list twoDigits. (Optional: check that Length[myTuples) is 729000 and Length[myTuples[[1]]] is 3.) c. Make a new list called my Values by replacing each triple {x,y,z} in myTuples with x:(y+z). Use the second type of iterator. (Length[my Values) should again be 729000.) d. Using patterns, count how many elements in my Values are strictly greater than 8000. e. Define p to be the exact probability, calculated using the formula successes divided total possibilities. Display p as a fraction. Do not type 729000 anywhere. f. Optional: compare p to your decimal approximation. If they don't match to two decimal places, then either there is a mistake in one of the two questions, or you did not use enough experiments in the previous
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started