1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kaheart [24]
3 years ago
9

Implement the simulation of a biased 6-sided die which takes the values 1,2,3,4,5,6 with probabilities 1/8,1/12,1/8,1/12,1/12,1/

2. In [ ]: # WRITE YOUR OWN CODE HERE! FEEL FREE TO INSERT MORE CELLS! # ADD SOME COMMENTS TO YOUR CODE! ​ Plot a histrogramm with 1,000,000 simulations to check if the relative counts of each number is approximately equal to the corresponding specified probabilities. Remark: Specify the bins of your histogram correctly.

Computers and Technology
1 answer:
hjlf3 years ago
4 0

Answer:

see explaination

Explanation:

import numpy as np

import matplotlib.pyplot as plt

a = [1, 2, 3, 4, 5, 6]

prob = [1.0/8.0, 1.0/12.0, 1.0/8.0, 1.0/12.0, 1.0/12.0, 1.0/2.0]

smls = 1000000

rolls = list(np.random.choice(a, smls, p=prob))

counts = [rolls.count(i) for i in a]

prob_exper = [float(counts[i])/1000000.0 for i in range(6)]

print("\nProbabilities from experiment : \n\n", prob_exper, end = "\n\n")

plt.hist(rolls)

plt.title("Histogram with counts")

plt.show()

check attachment output and histogram

You might be interested in
How does the text recommend that a company operate if it wants to be successful in the information age?
Kryger [21]

Answer:

The answer is "Departmental interdependence".

Explanation:

In the given question some information is missing, that is an option, which can be described s follows:

A. Work independently across organizations.

B. Departmental interdependence.

C. As an individually small department or as a team.

D. Each organization functions as a separate business entity.

There are separate positions in each organization, but the departments can not actually interact with each other, in the hierarchical paradigm of interdependence and can not rely explicitly on each other, each division presents the same ultimate problem, and other choices were wrong, that is described as follows:

  • In option A, It is wrong because in the organization there are some protocol which will be followed by all.
  • Option C and Option D both are wrong because each organization's function is not separated by the business entity, and it is not small.
6 0
3 years ago
A(n) ________ file contains data that has been encoded as text, using one of the computer's encoding schemes.
tangare [24]

Hello there

the answer is text

hope this helps

Queen Z

8 0
3 years ago
Read 2 more answers
Mental state shift involves what?
Delvig [45]

Answer:

It involves a matter involving doubt, uncertainty, or difficulty that may be solved, problem ... getting into a frame of mind to be creative and solve problems.

Explanation:

Hope i am marked as brainliest answer

5 0
3 years ago
Please help This is a homework in ICT class
Pavlova-9 [17]

Answer:

ejwksjnsskawii28393939393030jedjdjjccjncncnccnnccn

Explanation:

jsskaaaahujpjbhdueiwiwopwpwpwwieuehbfcnnccjxkxooss8ahwhwwnekdodod8djhdmslwoaishwhwkqoq18829293i4644673819191jednsmzljesksowlwlwpwpwnwkpwwwww waaaaayushsjsnmssoss ss sosijw

8 0
3 years ago
Write a loop that reads c-strings from standard input where the c-string is either "land", "air", or "water". The loop terminate
Anvisha [2.4K]

Answer:

I am writing a C++ code.        

#include <iostream> // for input output functions

using namespace std; // identifies objects like cin cout

int main() { //start of main() function body

string c_string; // stores the string entered by user from land water or air

int land=0; // contains the number of times land string is read in

int air=0; //contains the number of times air string is read in

int water = 0; //contains the number of times water string is read in

cin>>c_string; //reads the string entered by user from air water or land

/*while loop continues to execute until user enters xxxxx or maximum length of a string exceeds 8 */

while(c_string!= "xxxxx" && c_string.length()<=8) {

if(c_string=="land"){ // if string entered by user is land

land = land + 1;} //counts and increments each occurrence of land string by 1

else if(c_string=="air"){// if string entered by user is air

air = air + 1;}// counts and increments each occurrence of string air by 1

else if(c_string=="water"){// if string entered by user is water

water = water + 1;}//counts and increments each occurrence of air by 1

cin>>c_string;}

/* keeps reading the string entered by user from land air or water, until the loop breaks after the user enters xxxxx or user enters a string whose length is greater than 8 */

//prints the number of times land, air and water are read in

cout << "land:"<<land;

cout << endl<<"air:"<<air;

cout << endl<< "water:"<<water; }                      

                                                                                     

Explanation:

Everything is well explained in the comments above.

The program prompts the user to input strings. These strings are either land air or water. The while loop continues to read the input strings until user enters xxxxx or the string entered by user exceeds the length 8. Both these terminating conditions are added in the while loop. After the loop terminates, the number of times land, air and water strings are read is displayed on the output screen. Any other string entered by user other than these 3 is ignored. The program along with the output is attached.

3 0
3 years ago
Other questions:
  • What is the "host" in a typical email address?
    14·1 answer
  • What file format can excel save files as
    10·1 answer
  • List at least 4 types of works covered by copyright law
    5·1 answer
  • Which feature is used to change how a presentation moves from slide to slide?
    14·1 answer
  • Represent the measuring unit ofcomputer un terms of fration of second​
    13·1 answer
  • Which steps are correct for creating a document from a user-defined template?
    15·1 answer
  • Write a program using for loop to find the cube of numbers from 50-100 <br> FASTT
    11·1 answer
  • Select the three concepts of capital outlay.
    15·1 answer
  • The type value ____ for the input element may cause modern browsers to validate entries to ensure that they are valid web addres
    14·1 answer
  • Greg is concerned about the use of ddos attack tools against his organization, so he purchased a mitigation service from his isp
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!