Mathematical Modeling, Statistical Analysis, Python, Data Visualization, Monte Carlo Simulation.
using ax.set_xscale('log'). The red dashed line represents the true value of pi. Error vs. Sample Size: import random import numpy as np import matplotlib.pyplot as plt # Function to estimate pi using the Monte Carlo method def estimate_pi(n): count = 0 for i in range(n): x = random.uniform(-1, 1)