Essay Writing Service

Our company will be more than happy to have your paper written for you

Dissertation

Our custom dissertation writing service will gladly assist you

Research Paper Writing

Looking for information and collecting data for your research paper

Book Review Service

A considerable part of your grade may depend on the book review

VIEW ALL SERVICES

MAE 9: Quiz #3, Fall 2010 Due on Wednesday, November 3rd by 21:

San Francisco, US

MAE 9: Quiz #3, Fall 2010Due on Wednesday, November 3rd by 21:00pm(Turnin only on Wednesday) In this quiz you will compute a two-dimensional integral by using a simplistic version of the Monte Carlo Method. This method relies on random numbers to evaluate integrals and is the method of choice for numerical integration on higher dimensions (consult your favorite Wall Street investment bank). We want to integrate the area of a circle in the plane. The circle is centered at (xc, yc) and has radius r. We will limit our search to the box delimited by the points (0,0) and (4,4). Technically we will compute the area of the intersection of the circle with this box. Consider the function:/ 1, if distance between (x,y) and (xc,yc) is less or equal than rif distance between (x,y) and (xc,yc) is greater than r The area of the intersection of the circle with the box is the double integral: area = int_{0}^{4} int_{0}^{4} ind(x, y) dx dy Our simple Monte Carlo method will compute an approximation to the above integral by drawing N uniformly distributed random points in the box (xi, yi) and computing the sum area = (16/N) * sum_{i = 1}^{N} ind(xi, yi) Write a C program (quiz3.c) that: a) Reads the double values ofxc, yc and r (circle parameters)and the integer value ofN (number of points)from the terminal by using scanf; b) If N <= 0 set N = 1000 and issue a warning message to the user; c) If r <= 0 set r = 1 and issue a warning message to the user; d) Use a for loop to generate N uniformly distributed random pointsin the box (0,0)-(4,4) and compute the approximate integral asdiscussed above; e) Print the result of the approximate integral. HINTS: The function rand() generates a uniformly distributed pseudo-random integer between 0 and RAND_MAX. Use this function and RAND_MAX to generate double points (xi, yi) in the box (0,0)-(4,4). You will need to include the header in order to use rand(). For example, the statement 10 * rand() / RAND_MAX will generate a floating point between 0 and 10 (do not forget to properly cast integers as doubles or all you will get will be zero!) The function rand() will always draw from the exact same random sequence every time you run your program (it is not a true random number, but a pseudo-random number). In order to add some “spice” to this sequence you may want to initialize rand() by calling the function srand ( time(NULL) ); also provided in . The above initialization will use the current time to set the random generator and you will get a different answer every time you run your program. You must include the header in order to use time.

Order Now

PLACE AN ORDER

Enter your paper details in the form below

Multipurpose Business Child Theme for Divi

Using the Molti Multipurpose Child Theme, you can set up any kind of Website whether It’s Consulting, Agency, Renovation or Plumber, and many more. It’s ready for everything with Its Modern and Fantastic Design and Functionalities. So Take it for Spin!

15+

Page Designs

6

Footer Designs

6

Header Designs

50+

Element Designs

u

Get connected with a verified expert tutor 24/7.
Receive answers and explanations in as few as 8-24 hours.

Homework help, catered to you.

Get connected with a verified expert tutor 24/7.
Receive answers and explanations in as few as 8-24 hours.