Confusion related to the calculation of value of $\pi$ I was referring to this lecture Markov Chain Monte Carlo. However, I didn't get how the $\pi$ value was calculated. Here is a screenshot

As far as I know the integral gives the area under the curve. So I didn't get how the double integral is giving the value of $\pi$ using $P(x,y)$.
Also how did it convert to mean in Octave. I am just a beginner. So please some guidance is required
 A: You are familiar with $\int_a^b f(x)\,dx$, which is an integral over an interval. One can also define "double" integrals, that is, integrals over a region of the plane. And triple integrals, and so on.
Here they are finding the double integral of a certain product over the unit square. The second term $P(x,y)$ is explained in your post. The first term is $I((x^2+y^2)\lt 1))$. This is an indicator function, which by definition is $1$ where $x^2+y^2\lt 1$, and $0$ elsewhere.
So the product that we are integrating is $1$ inside the quarter-circle, and $0$ outside.  The integral over the square of the product is therefore the area of the quarter-circle.
I expect you understand the rest. But for completeness, effectively  the program throws a dart repeatedly at the $1\times 1$ square, and records a $1$ for every time the dart lands in the quarter circle. If the number $N$ of dart throws is very large, and $H$ is the number of hits, one would expect $\dfrac{H}{N}$ to be close to the ratio of the area of the quarter-circle to the area of the square, that is, to $\dfrac{\pi}{4}$.
Alternately, one could use older notation, get rid of the indicator function, and integrate over the quarter-circle. But the indicator function version is closer in spirit to the dart throwing model, in the sense that, like in the dart throwing, we record a $1$ whenever we land inside the quarter-circle.
Remark: Although this is an inefficient way of approximating $\pi$, the general idea is extremely useful. It can be used to approximate the volume of extremely complicated multidimensional regions. Tou might look into Monte Carlo Methods. 
A: Actually you are counting the number of $\color{blue}{\text{dots}}$, that fall into to $\color{red}{\text{quarter circle}}$ divided by the total number of $\color{blue}{\text{dots}}$, which has area $\frac \pi4$.
You can use the "mean", since for a large number of $\color{blue}{\text{dots}}$, it approximates the integral.
EDIT
If you would use $\color{blue}{\text{water }}$instead of $\color{blue}{\text{dots}}$, something like this was already written in the bible:
And he made a molten sea, ten cubits from the one brim to the other: it was round all about, and his height was five cubits: and a line of thirty cubits did compass it about. (I Kings 7, 23; II Chronicles 4, 2.)
