Analysis on Monte Carlo Data Sampling

By: Roth In


This notebook will re-creating the example of Monte Carlo data simpling within a circle.
After the simpling, each data point will be assigned its quadrant.
Counting the quadrants will show how the data are spreading throughout the circle.

Import the libraries:

Given (x, y) coordinant, within_circle will return TRUE if the point is inside the cirle. Otherwise, the function will return FALSE.

generate_data will take size as the number of sample data that will be generate.

Generate 500 data points centered at (0, 0) with radius of 1

Plot the 500 data generated from generate_data function above.

Loop through to check and assign quandrant to each point in data

Creat pandas dataframe from with the (x, y) coordinate and its respective quadrant.

Count the values of each quadrant, and then plot into piechart.