Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

These practice problems will be very similar to what is on the exam. Make sure you understand how to work these problems, as you will

image text in transcribed
These practice problems will be very similar to what is on the exam. Make sure you understand how to work these problems, as you will be graded on your process, not the final answer. 3. (Integral Estimation using Monte Carlo Simulation) One application of Monte Carlo Simulation is estimating a difficult to evaluate integral. In this ques- tion, we will perform a simple simulation to estimate the area of a unit circle. (a) Generate 10,000 points uniformly distributed in [-1, 1] and plot a histogram of these points using 50 uniform-sized bins. Hint: See the histogram function in matplotlib; in particular, if your data is stored in an array X, then you can use matplotlib.hist( X, bins = 50, normed = True). (b) Generate 10, 000 points that are uniformly distributed in a square around the origin with corners (-1, -1), (-1, 1), (1, -1) and (1, 1). To do this, independently generate the r and y-coordinates of a point to be uniformly distributed in (-1, 1). Create an additional array Z of length 10,000, which indicates whether each random point lies within a circle of radius 1 centered at the origin. Plot these points using a scatter plot with different colors for points within the circle and points outside. Hint: If you store your coordinate vectors as X and Y and the vector of indicators as Z, then use pit.scatter(X, Y, c = Z, s = 2.0, cmap=pit.cm. Paired). (c) Given n random points as above, we can estimate a as in = 4Ncircle, where Ncircle is the number of random points which lie within the circle. For n between 1 and 1000, plot the relative error In - #|/x. Also plot the function 1/vn on the same plot. How do the relative errors compare to this function? (d) (OPTIONAL) Above we used simulation to compute the area of a unit circle. Using a similar process, we can find the volume of a 'sphere' in a dimensions. Estimate this volume for dimensions d c {2, 3. ....20}, using 100, 000 samples in each dimension. How does your estimate of the volume of the sphere behave as the dimension increases? Also, do your estimates seem smooth or noisy (and if the latter, why)

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

Introductory Algebra Concepts And Graphs

Authors: Charles P McKeague

1st Edition

1630980110, 9781630980115

More Books

Students also viewed these Mathematics questions