EGEN102 Python assignment

timer Asked: Feb 3rd, 2019
account_balance_wallet $55

Question Description

I uploaded for you the assignment please help me at it.

Unformatted Attachment Preview

EGEN 102 Introduction to Engineering Computations and Applications Spring 2019 Homework #3 Due Tuesday, February 5, 2019 at 12:00pm on Brightspace You have been hired by the secretive πœ‹-society to analyze a new strategy for calculating the value of πœ‹ through the development of a Python program. Here is the basic format of the strategy provided to you by the πœ‹-society. Begin by recognizing that the area of a unit square (height = 1.0, width = 1.0) is 1.0 and the area of a quarter circle, which lies entirely within the unit square is (πœ‹π‘Ÿ 2 )/4 = πœ‹/4. Now imagine that we choose a random point (π‘₯, 𝑦) within the unit square. The probability of that random point being within the quarter unit circle is πœ‹/4 β‰ˆ 79% because 79% of the area of the unit square is covered by the quarter unit circle! Now, if we choose β€˜many’ random points, we can estimate the value of πœ‹ because 4 x (fraction inside the circle) = πœ‹. Hence, we just need to select β€˜many’ or 𝑛 random points (i.e., a point is two random floating point numbers between 0-1.0, see numpy.random.random()), then loop through the 𝑛 points and check to see if each point is inside the quarter unit circle (i.e., for the random point (π‘₯, 𝑦), is √π‘₯ 2 + 𝑦 2 < 1.0 ), and then count the fraction of the 𝑛 points inside the quarter unit circle. The figure below shows 3000 random points on the unit square – the red points are inside the quarter unit circle and the blue points are outside. You should write a memo to the πœ‹-society that summarizes your analysis of the feasibility of this algorithm. The report should include a figure, which may be generated using Excel or matplotlib, that shows the accuracy of the proposed strategy on the y-axis (accuracy is the difference between the estimate of πœ‹ from the algorithm and the β€˜true’ value) versus the number of random points used on the x-axis. The Python program should gain accuracy with more points. The head of the πœ‹-society casually mentioned that you should try, β€œmaybe 100, or 1000, or 10,000 random points” to see how the number of points impacts the accuracy. You have also been reminded to include your Python code in the appendix of the memo/report. Hint: One approach is to first start a loop and then generate a point (x,y) every iteration using: x,y = numpy.random.rand(2) and a second approach is to generate a big list of pairs of random numbers using: pt = numpy.random.random((n,2)) # n rows, two columns, x and y values ...
Purchase answer to see full attachment

Tutor Answer

School: UCLA



To: Secretive πœ‹-society
FROM: Student's name
SUBJECT: To analyze a new strategy for calculating the value of πœ‹ through the development of
a Python program
DATE: February 3, 2019
I saw the description of the new format of recognizing the quarter circle together with the area of
a unit square which includes the following: (height = 1.0, width = 1.0) is 1.0. In addition to the
given format, the quarter circle lies within the unit square is (Ο€r 2 )/4 = Ο€/4. I do analyze this
given information and tried to visualized on how ...

flag Report DMCA

Tutor went the extra mile to help me with this essay. Citations were a bit shaky but I appreciated how well he handled APA styles and how ok he was to change them even though I didnt specify. Got a B+ which is believable and acceptable.

Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors