Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

20. Monte Carlo integration. One way to estimate the value of definite integrals in spaces with many dimensions is the Monte Carlo integration method. We

image text in transcribed
20. Monte Carlo integration. One way to estimate the value of definite integrals in spaces with many dimensions is the Monte Carlo integration method. We illustrate the method here in two-dimensions. Consider the task of estimating the area of a circle of radius R Inscribe the circle in a square with sides of length 2R. To estimate the area, randomly pick N points in the square (use rand). Find how many points Nin are in the circle. The estimate for the area is then the fraction of all the points that are in the circle times the area of the square, A - AMc = (Nin N)4R 2. Write a program, MonteCarloCircle.m that implements this algorithm. Tabulate AMc for N-10* where k (1,2,...,7). Make a graphical representation of the points 'raining down" on the square with points inside the circle being a different color than points outside the circle. To draw the circle, use r=rcost and y=rsint. Use N=10^4 as a maximum number of points. To check if in the circle, use x^2+y^2

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

Students also viewed these Databases questions

Question

Do you think physicians should have unions? Why or why not?

Answered: 1 week ago