**Tabulation of a function**

At the beginning F is the following. You can change it however you want.

function F(x) { with(Math) {

return** sqrt(1-x*x)**

}}

An example of use.

I want to determine the** centroid **of:

To find the center of a polygon I can use this script. I have to approximate the figure with a polygon (of a few hundred sides).

I use F(x) = sqrt(1-x*x):

I add as a starting point (0,−1):

I can approximate the centroid with (0, 0.12966).

With some theoretical reasoning I could get the ordinate 1/(3*(1+π/2)) = 0.1296615
(the exact value of the perimeter is π+2*√2 = 5.97002).