Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Coin flip: Probability distribution (20 points) In class, we have calculated the statistical probability of finding two heads if we perform four coin flips.
1. Coin flip: Probability distribution (20 points) In class, we have calculated the statistical probability of finding two heads if we perform four coin flips. We have also established that the exact probability is p=6/16=0.375. I.e., if we perform 1000 coin flips with four coins we expect that on average we find 375 instances with two heads. However, there will be fluctuations and these fluctuations are what we want to study in more detail here. (a) (10 pts) Perform 1000 coin flips of four coins 1000 times and record the number of outcomes with two heads each time. As a result, you should get an array of dimension 1000 with entries such as [370,389,374,340,]. Now, record how often each of these outcomes occurs. The result should be presented in a plot where the x-axis are the outcomes and the y-axis the number of times this particular outcome has occured. (b) (10 pts) Calculate the expected value (mean) =N1i=1Nxi and the variance 2=N1i=1N(xi )2 of the distribution obtained in (a). Here N=1000 is the number of times the 1000 coin flips of four coins have been performed and xi are the outcomes of each of the N=1000 attempts. Produce a plot comparing the distribution obtained in (a) with the normal distribution ("Bell curve") f(x)=221exp[(x)2/(22)]. 2. The Nagel-Schreckenberg cellular automata (30 points) (a) (20 pts) Starting from the simple bulding blocks for a traffic model discussed in the lecture, write a code implementing the rules of the Nagel-Schreckenberg model (see page 11 of the lecture notes). We want to consider, in particular, a model with 100 cells which are periodically connected. The maximally allowed velocity is 5 in units of cells. (b) (10 pts) As initial state, place 10, 20,50 cars at equal distances, all with velocity 1 . Consider a randomization p=0.3 (probability that velocity is reduced by 1 ). To implement the randomization of the velocities you can use the np.random routines, see numpy documentation. Plot the time evolution for 100 time steps in the three cases. In which cases do traffic jams occur
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