Monte Carlo Integration - Normal Distribution

author: Vinicius Placco (

A simple example of the Monte Carlo method, this time used to calculate
the integral of a known function (normal distribution) between two values. This
was done by sampling a normal distribution (μ=1, σ=10) 500,000 times and taking
the ratio of instances within the interval of interest [2:6] and the total. The
accuracy reaches about 0.04% when comparing to the expected value (taken from WolframAlpha). 

Made with R + bash + gnuplot + convert + ffmpeg