Question: 1 . 4 Problems Part 4 1 . Buffon's needle problem is another way to estimate the value of pi with random numbers. The
Problems Part
Buffon's needle problem is another way to estimate the value of pi
with random numbers. The goal in this Monte Carlo estimate of pi
is to create a ratio that is close to similar to the example with darts points lying insideoutside a unit circle inside a unit square.
Buffon's needle for parallel
lines
In this Monte Carlo estimation, you only need to know two values:
the distance from line x
the orientation of the needle, theta pi
The ylocation does not affect the outcome of crosses line or not crossing line
a Generate random x and theta values remember theta pi
b Calculate the x locations of the needle ends eg xendxpm costheta
since length is unit
c Use nplogicaland to find the number of needles that have minimum xend min
and maximum xend max
The ratio xend min and xend maxnumber of needlespi
for large values of number of needles
Build a random walk data set with steps between dxdy to m
If particles take steps, calculate the number of particles that move further than m
Bonus: Can you do the work without any forloops? Change the size of dx and dy to account for multiple particles.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
