Monte Carlo Method

طريقة مونت كارلو

Definition

Estimating mathematical quantities by drawing many random samples and averaging the results.

Definition

Monte Carlo methods estimate quantities by averaging over many random samples, with error shrinking as 1/√N regardless of dimension.

Practical examples

Code example Python
import numpy as np

rng = np.random.default_rng(0)
xy = rng.random((100000, 2))
print(round(4 * float((xy ** 2).sum(axis=1).__lt__(1).mean()), 2))

Expected output

3.15

Learn and review

Suggested terms to learn next