Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python please Programming Assignment 1 In the early 1600s, Galileo was asked to explain the fact that, although 9 can be written as a

in python please image text in transcribed
image text in transcribed
Programming Assignment 1 In the early 1600s, Galileo was asked to explain the fact that, although 9 can be written as a sum of 3 integers in exactly the same number of ways as 10 can, 9=6+2+1=5+3+1 = 4+4+1=5+2+2 = 4+3+2=3+3+3 10 = 6+3+1=5+4+1=6+2+2=5+3+2 4+4+2 = 4+3+3, when 3 fair dice are rolled, a 9 seemed to come up less often than a 10 supposedly, in the experience of gam- blers. Imagine you are a steampunk Galileo / Galilea. And that some incorrigible gamblers have asked you to confirm and explain why, although, say, 34 can be written as a sum of 10 integers in exactly the same number of ways as 35 can, when 10 dice are rolled, a 34 seems to come up less often than a 35. Answer their and similar questions by writing a computer program (for your steam powered Turing machine) which takes as input a number d of dice and two numbers a, b, and which outputs whether a and b are equally likely to be the sums of a roll of d dice, or if not, which of the two is more likely Your program should accomplish this by simu- lating the roll of d dice a large number of times and keeping track of the proportion of times the sum is a and the proportion of times it is b. Your program will have to decide (1) how many rolls to perform in order to reach its conclusion with confidence and (2) how close the simulated propor- tions need to be in order to conclude that the actual. probabilities are equal. How could it do that? (2) When rolling d fair dice, there are 6 outcomes, cach having probability 1/6. So the probability of any event in this sam- ple space is an integer multiple of I6. Therefore, if two events do not have the same probability, then their probabilities ditter by at least 1 6. (1) We will learn more about this later but for now you may ap. ply the rough rule of thumb that, at least 95% of the time, a simulation of this type with 7 trials produces an answer with more than I By combinin these can make your programs wer the gets s ctly of the time Programming Language. You may use any programming language you like to com- plete this assignment. But you are encouraged to use Python and specifically the scientific computing package NumPy. Here are instructions for installing it, and here is a reference for NumPy. The TA's will probably only be able to help you with your code if you use Python. With those installed, three random die rolls can be simulated with: import numpy x = numpy.random.randint(1,7) y = numpy.random.randint(1,7) z = numpy.random.randint (1,7) print(x+y+z) The first line imports the numpy library. The second, third, and fourth lines generate ran- dom integers in {1,2....,6}. The second argument to randint is 7, because according! to the documentation, randint(a,b) gives a random integer between a (inclusive) and b (exclusive). So, to make sure that we can get a 6 we have to make the second argument 7. The code then prints the result of summing the three die rolls

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

Students also viewed these Databases questions

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago