As I developed the

*Area of Texas*project, I was surprised to learn that Texas is almost square! The east to west distance is 775 miles and the north to south, 765 miles.

Here's the image I used in the Scratch project.

As in the Pi approximation, points are randomly selected in the rectangle. Each point is then tested to determine if it is in Texas.

The sprite used to plot each point is black so the [

*color*black*is touching**color*red] block makes this test a simple one.
The product of the ratio of points in Texas to the total number of randomly selected points times the area of the rectangle is then the Monte Carlo approximation to the area of Texas.

Here's a screenshot of the result for selecting 10,000 random points.

Google Maps gives the area of Texas as 268,820 square miles. The Scratch script approximated the area as 266,853 square miles.

That's a good approximation to the Google value.

You can view, use, and download this project from the Scratch website by clicking on this link.

You can also request a free PDF document containing more detail as to how the script is coded. Send an email request to grandadscience@gmail.com.

## No comments:

## Post a Comment