Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python 1. Binomial functions Assume that the probability of getting a winning lottery ticket (p) is 1 in 20 and you have money to purchase

python

1. Binomial functions

  • Assume that the probability of getting a winning lottery ticket (p) is 1 in 20 and you have money to purchase up to 10 tickets (n).
    • Calculate the probability of purchasing one winning lottery ticket.
    • Create a list of probabilites. The probability of purchasing 1 winning ticket, 2 winning tickets, 3 winning tickets, ... up to 10 winning tickets.
    • Plot the probability against the number of winning tickets purchased as a green bar plot. Label both axes

2. Monte Carlo simulations with random.binomial( )

  • Again, assume that the probability of getting a winning lottery ticket (p) is 1 in 20 and you have money to purchase up to 10 tickets (n).
    • Run 100 simulations (nmc) of the scenario
    • Plot the simulated results as a histogram and the theoretical distribution as a line graph
    • Add a title to the plot
    • Add a legend
    • Add a label to the x-axis and y-axis

3. Uniform distributions

  • Calculate the theoretical distribution of getting a particular azimuth between 0 and 360 when measuring, for example, the direction of a strike - assume that each result is equally likely (a uniform distribution between 0 and 360)
  • Perform a Monte Carlo simulation with =30n=30 trials.
  • Plot your theoretical and simulated results as a bar and histogram plot respectively.
  • Try this again using the random.seed() function.

4. Normal distributions

  • Calculate the theoretical distribution of grades on an exam with a mean of 50% and a standard deviation of 20.
  • Simulate the results of an exam taken by 35 students
  • Calculate the mean and standard deviation of your simulated results.
  • Plot theoretical and simulated results as a bar graph and histogram respectively.
  • Plot a solid line representing the cutoffs for As, Bs, Cs, Ds, and Fs
  • Add a title, x-label, y-label, and legend

5. Log-normal distributions

  • Simulate a grain size distribution that is drawn from a log normal distribution with 1000 grains and a mean and standard deviation of 10 and 0.1 microns respectively.
  • Plot the distribution as a histogram (density set to True).
  • Calculate the mean, standard deviation, expectation and variance of the distribution.

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

More Books

Students also viewed these Databases questions