Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview This homework assignment is the first assignment designed to get you familiar with the programming basics. Your objective is to perform a series of

Overview
This homework assignment is the first assignment designed to get you
familiar with the programming basics. Your objective is to perform a series
of simulated "dice rolls", perform a basic statistical analysis, and plot the
results. You must do this assignment in MATLAB, but keep in mind
that you should also use whatever programming language your group is using
for the research topic.
For extra credit: You may do this assignment
in both MATLAB and PYTHON languages
Before you begin the coding, write an introduction explaining what you anticipate the results will be.
What can you say about the probabilities of outcomes in each case:
What should the probabilities be for each of the faces (numbers) for the single die roll?
What should the probabilities be for each of the combinations of the sum of the two dice roll?
What can you say about the sample means for each case:
How do the sample means change as we increase the number of rolls?
What should the mean be for the single die roll?
What should the mean be for the sum of the two dice roll?
Having thought about the expected outcomes and put your predictions in the introduction, move on to writing the code.
You will first "roll" an individual dice 10 and 1000 times, calculating the
mean, standard deviation, histogram, CFD and PDF for each set.
Then, you will "roll" two dice, adding together their sums, 10 and 1000 times. Again, calculating
the mean, standard deviation, histogram, CFD and PDF for each set of rolls.
Requirements
To fulfill this project, you must successfully program a script that utilizes
several different functions and loops to simulate dice rolls and calculate
the statistics. Each function should have a practical name, be easy to read
and understand, and function. You should also comment appropriately
throughout the program such that someone else could understand what is
occurring.
Submission
You will submit the following to the Canvas assignment box:
A summary MS WORD document with introduction, tables of the statistical parameters, and
copies of the generated histograms
Your well-documented code source files. Make sure the main script is named properly.
Note that any submitted code needs to be able to be executed without
any errors. Any additional libraries need to be able to be installed using a
package manager like pip.
*The main script should be named in the following format:
h[#]_[ASSIGNMENTNAME]_[LAST NAME].[EXTENSION], for example, h3_dice_roll_weaver.
image.png
Extra Credit
If you are willing to dig in a little bit more, this project has a couple of opportunities to earn extra credit points
at the discretion of the instructor. First, you may do this assignment in both Python and MATLAB. Being able to
work with multiple programming languages is an extremely useful skill. Python and MATLAB are also close
enough in syntax that the code should not have to change much between them.
Additionally, you may write up to three different operations with the dice rolling and provide the same output
for each. For 10 points of extra credit each, you may write functions that subtract, multiply, and divide the rolls
of two dice for 10 and 1000 rolls. You will only be granted the extra credit points if the full output for each
operation is provided!
Psuedocode
For those that are new to programming, a suggested code layout is given below in psuedocode to guide you.
Function: Roll One Die
Argument: iterations
Initialize zeroes array of length iterations
For every iteration
Sample a random integer from [1,6]
Add sample to array
Returns: array of random samples, mean of array, stdev of array
Function: Roll Two Dice and Sum
Argument: iterations
Initialize zeroes array of length iterations
For every iteration
Sample two random integers from [1,6] and add together
Add the summation to array
Returns: array of summed samples, mean of array, stdev of array
Calculate array, mean, and stdev for 10 single rolls
Calculate array, mean, and stdev for 1000 single rolls
Generate output table for single rolls and print
Create singular die roll figure with two subplots
Plot bar graph for 10 die rolls
Plot bar graph for 1000 die rolls
Show figure
Calculate array, mean, stdev for 10 summed dice rolls
Calculate array, mean, stdev for 1000 summed dice rolls
Generate output table for summed rolls and print
Create summed dice roll figure with two subplots
Plot bar graph for 10 summed dice rolls
Plot bar graph for 1000 summed dice rolls
Show figure

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions