This Python script uses a Monte Carlo simulation to estimate the value of PI. The program generates a specified number of random points within a square and determines how many fall inside a circle inscribed in the square. By calculating the ratio of points inside the circle to the total points, an approximation of PI is obtained. The script visualizes the random points using a scatter plot in Matplotlib, where the color of each point is determined by its position in the circle. The title of the plot displays the number of points used in the simulation and the estimated value of PI with four decimal places.
The area of a circle with radius
This relationship is utilized in the Monte Carlo simulation to estimate the value of PI.