Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming Question 7 (20 points) Monte Carlo methods are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical

Java programming

Question 7 (20 points) Monte Carlo methods are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. One of the basic examples of getting started with the Monte Carlo algorithm is the estimation of Pi.

Basic Idea: The idea is to simulate random (x, y) points in a 2-D plane with domain as a square of side 1 unit. Imagine a circle inside the same domain with same diameter and inscribed into the square. We then calculate the ratio of number points that lied inside the circle and total number of generated points. Refer to the image below:

We know that area of the square is 1 unit sq while that of circle is ( 1 )2 = . Now for a very large number of generated points,

24

Areacircle = Number of points generated inside cicle Areasquare Total number of points generated

i.e. = 4 Number of points generated inside cicle Total number of points generated

The beauty of this algorithm is that we dont need any graphics or simulation to display the generated points. In randomized and simulation algorithms like Monte Carlo, the more the number of iterations, the more accurate the result is. Thus, it is estimating the value of and not Calculating the value of . Implement this algorithm in Java and estimate the value of .

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions