Just click the green flag and watch!

This shows what @Paddle2See's project is approaching.

An integral is, at its most basic, the area under a curve. In this case, the curve is a quarter of a circle, and so the area under it is equal to pi over four.

@Paddle2See's project approximates this integral by calculating directly the area underneath the curve. As the number of trapezoids increases, the accuracy of the estimation becomes better.

However, in order to get the exact area, it turns out we need infinite trapezoids. (Actually, in fact, the "Riemann integral" is usually defined in terms of infinite rectangles - but infinite trapezoids will work for this case). How do we get an infinite number of trapezoids? The answer is, of course, calculus.

The "Fundamental Theorem of Calculus" states that the process of accumulating area under a curve - which is what we want to do - is the inverse of the process of differentiation, which is finding the slope of a line tangent to a function at a given point. So all we need to do is find the antiderivative, and we're good to go!

In this case, we are using the equation for a circle - which is sqrt(1 - x^2) - multiplied by four. This happens to have an "elementary" antiderivative - meaning that it's made up of only basic arithmetic, trigonometric, and exponential functions. This antiderivative is 2[arcsin(x) + x * sqrt(1 - x^2)].

As mentioned earlier, the Fundamental Theorem of Calculus tells us that this antiderivative can be equated to the integral. More specifically, it says that area under the curve between x=A and x=B is equivalent to the value of the antiderivative at B minus its value at A. So all we have to do is subtract the value of our antiderivative at zero from the value of our antiderivative at 1.

You might notice that the antiderivative contains the arcsin function. In fact, our integral reduces down to a very simple expression:

2arcsin(1)

This expression is, in fact, equal to pi.

You may notice that we haven't actually established a way to approximate pi throughout this process. In fact, all we've done is proven that the area of a circle with radius 1 is equal to pi. However, that is an important result - and it's why (to some extent) @Paddle2See's original project works.