Answered step by step
Verified Expert Solution
Question
1 Approved Answer
EGEN 102 Spring 2021 Introduction to Engineering Computations and Applications Homework #4 Due on Friday, February 5, 2021 at 5:00pm thors have been hired by
EGEN 102 Spring 2021 Introduction to Engineering Computations and Applications Homework #4 Due on Friday, February 5, 2021 at 5:00pm thors have been hired by the secretive re-society to analyze a new strategy for calculating the value of t through the development of a Python program. Here is the basic format of the strategy provided to you by the T-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 (r)/4=2/4. Now imagine that we choose a random point (x, y) within the unit square. The probability of that random point being within the quarter unit circle is 1/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 Te because 4* (fraction inside the circle) = 1. 1.0 *=3000, 3.1133 0.8 0.6 0.4 0.2 0.0 0.0 0.2 0.4 1.0 Here's an outline of the algorithm that be developed 1. Specify the number of random points, n 2. Set a counter variable to zero. We'll use this variable to track the number of random points inside the circle 3. Start an iteration or loop that repeats n-times. For each iteration: a. Generate two random numbers (.e., a random point) using, for example, x.y = numpy.random.rand(2) b. Using an 'if' statement, check if the random point is inside a unit circle (i.e., x2 + y2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started