Question: I need a python script. Exercise 3 : Random sample generator Write a Python script that generates random numbers distributed according to a Breit -

I need a python script.
Exercise 3: Random sample generator
Write a Python script that generates random numbers distributed according to a Breit-
Wigner distribution with the statistical median m=3 and the full-width at half maximum
b=7. Use for the PDF and CDF the following expressions:
p(x)=1b(x-m)2+b2,
F(a)=12+1arctan(a-mb).
Generate Nsmpl=10000 accepted values of x, distributed according to p(x) using the following
methods discussed in the lecture:
(a) Accept-reject method.
(b) Inverting the CDF.
For each of the two methods, plot the histogram of the generated sample and superimpose
the PDF after normalising it to match the histogram.
 I need a python script. Exercise 3: Random sample generator Write

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!