Mathematical Foundations of Monte Carlo Methods

News (August, 31): We are working on Scratchapixel 3.0 at the moment (current version of 2). The idea is to make the project open source by storing the content of the website on GitHub as Markdown files. In practice, that means you and the rest of the community will be able to edit the content of the pages if you want to contribute (typos and bug fixes, rewording sentences). You will also be able to contribute by translating pages to different languages if you want to. Then when we publish the site we will translate the Markdown files to HTML. That means new design as well.

That's what we are busy with right now and why there won't be a lot of updates in the weeks to come. More news about SaP 3.0 soon.

We are looking for native Engxish (yes we know there's a typo here) speakers that will be willing to readproof a few lessons. If you are interested please get in touch on Discord, in the #scratchapixel3-0 channel. Also looking for at least one experienced full dev stack dev that would be willing to give us a hand with the next design.

Feel free to send us your requests, suggestions, etc. (on Discord) to help us improve the website.

And you can also donate). Donations go directly back into the development of the project. The more donation we get the more content you will get and the quicker we will be able to deliver it to you.

3 mns read.

In chapter 2, we have mentioned the normal (or gaussian) probability distribution. We now have the knowledge needed to introduce and understand its equation. Why studying the normal distribution? This distribution is very common in nature. For example the adult height in any adult given population generally follows (more or less) a normal distribution. We will see it reapparing in the next chapter as well.

If you reproduce these curves for yourself, you will probably get a better sense of what the parameters of the equation do. You can use Grapher on Mac and Gnuplot on Linux.

Gaussian or normal distribution have a typical bell-shaped curve (see figure 1). The equation for this distribution is a bit complex:

$$p(x) = \mathcal{N}(\mu, \sigma) = {\dfrac{1}{\sigma \sqrt {2 \pi} } } e^{-{\dfrac{(x -\mu)^2}{2\sigma^2}}}.$$

Figure 1:a normal distribution with standard deviation (\(\sigma = 1\)) and expectation (\(\mu = 0\)).

You should already be familiar with the \(\sigma\) term (the greek letter sigma) which is the distribution's standard deviation (see the previous chapter if you need a refresher on what the standard deviation is). The term \(\mu\) (the greek letter mu) is the distribution's expectation (a concept we have also introduced in the previous chapter). Note that the curve is symmetrical around \(\mu\). By changing the value of these parameters we can obtain all sort of bell-shaped distributions as pictured in figure 2. The normal distribution function is generally denoted \(\mathcal{N}(\mu, \sigma)\) since mean and variance are the two parameters of the model. \(\mathcal{N}(0,1)\) is called the standard normal distribution (figure 1).

Advanced: add in a future revision of the lesson show that the expected value of the standard normal distribution is 0, area under the curve is 1 and standard deviation is 1. Note in the figure below that when the standard deviation is smaller the curve is higher. The area under the curve is 1 not matter which standard deviation you chose.

Figure 2: example of gaussian distribution for different values of the standart deviation (\(\sigma\)) and different values of the mean (\(\mu\)).

If you read more about statistics you may come across the terms skew and kurtosis. In the image above we have drawn a normal distribution in red (with a standard deviation of 2 and a mean of 5). When the curve is perfectly symmetrical around the mean (the vertical cyan line) then we say that the skew of the distribution is 0. When the distribution has a larger tail to the left, the skew is negative (and the skew is positive when the tail is larger to the right). The term kurtosis designates how pointy or smooth the curve is compared to a normal distribution (right). A curve which is narrower than the a normal distribution is said to have a positive kurtosis. These are not so important (especially in computer graphics) but these two parameters will help us in the next chapter to compare how close our distribution of data is to a "perfect" normal distribution.

In the next chapter, we will learn about the concepts of PDF (probability density function) which is derived from the concept of probability distribution, and CDF (cumulative distribution function). These two concepts are very important in computer graphics.