Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider calculating the area of the unit circle (radius=1, centre at the origin) with random numbers. Write a function 'MCint_pi()' which takes the number

image text in transcribed

Consider calculating the area of the unit circle (radius=1, centre at the origin) with random numbers. Write a function 'MCint_pi()' which takes the number of attempts as single input parameter and draws two floating-point random numbers, each in the interval [-1,+1] for the x- and y-coordinate value, respectively (i.e. points uniformly distributed in the square). Count the number of circle hits, M, i.e. fulfilling the condition 2 d = x + y 1 and get the area as square 2 x 2 times fraction of hits within circle M/N with N attempts. Return the calculated area value. Note, any manual return of a value of pi will be moderated to zero marks. Answer: (penalty regime: 10, 20, ... %) 1 Check

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

Design Operation And Evaluation Of Mobile Communications

Authors: Gavriel Salvendy ,June Wei

1st Edition

3030770249, 978-3030770242

More Books

Students also viewed these Programming questions

Question

Appraisal process and timing

Answered: 1 week ago

Question

How to communicate positive and negative feedback

Answered: 1 week ago

Question

Performance criteria and job standards that should be considered

Answered: 1 week ago