Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Please! 8.5.2 Area Computing by Throwing Random Points Think of some geometric region G in the plane and a surrounding bounding box B with

Python Please!

image text in transcribed

8.5.2 Area Computing by Throwing Random Points Think of some geometric region G in the plane and a surrounding bounding box B with geometry [xL, xHyL, yH]. One way of comput- ing the area of G is to draw N random points inside B and count how many of them, M, that lie inside G. The area of G is then the fraction M/N (G's fraction of B's area) times the area of B, (H-L)(H-yL) Phrased differently, this method is a kind of dart game where you record how many hits there are inside G if every throw hits uniformly within B. Below is an example to use this approach to calculate the area of integral of f(x) from a to b. def MCint area(f, a, b, n, m): below 0 # counter for no of points below the curve for i in range(n): xrandom.uniform(a, b) y- random.uniform(0, m) if y

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions