# Finding the barycentre of an area under a function

I'm exploring some ideas and I think I'm making some mistakes.

I'm picking up some ideas of the barycentre or center of mass of an area.

I thought of something simple.

 ClearAll["Global*"]
y = Sqrt[x + 9]


I made the integral of an equation to find the area under the curve:

Integrate[Sqrt[x + 9], {x, -9, 0}]


18

Plot[y, {x, -9, 0}, AspectRatio -> 1, PlotRange -> {{-9, 0}, {0, 9}},
Filling -> Bottom] Here I tried to find the value of $x1$ so that the result of the integral is half of the value obtained previously, which was $18$.

N[Solve[Integrate[Sqrt[x + 9], {x, x1, 0}] ==
Integrate[Sqrt[x + 9], {x, -9, 0}]/2, {x1}] /. Rule -> Set]


(-3.33036)

With this value $x1$ I plotted again to see the result:

Plot[y, {x, x1, 0}, AspectRatio -> 1, PlotRange -> {{-9, 0}, {0, 9}},
Filling -> Bottom] The value of the barycentre of the area between $-9<x<0$ obtained by other software was:

$x=-3.6002$ and $y=1.1250$

So my $x1$ value should be $x=-3.6002$, but it was not what I got. Has anyone discovered where I made the mistake?

You're not computing the centroid correctly.

Use to discover $X$:

$\frac{\int_{-9}^0 x \sqrt{x+9} \, dx}{\int_{-9}^0 \sqrt{x+9} \, dx}$

N[Integrate[x*Sqrt[x + 9], {x, -9, 0}]/
Integrate[Sqrt[x + 9], {x, -9, 0}]]


-3.6

Use to discover $Y$:

$\frac{\int_0^3 y \left(y^2-9\right) \, dy}{\int_0^3 \left(y^2-9\right) \, dy}$

N[Integrate[y*(y^2 - 9), {y, 0, 3}]/Integrate[y^2 - 9, {y, 0, 3}]]


1.125

You can also do:

Integrate[{x,y}, {x,-9,0}, {y,0,Sqrt[9+x]}] / Integrate[1, {x,-9,0}, {y,0,Sqrt[9+x]}]


{-18/5, 9/8}

• Among the answers offered was the one that comes closest to what I wanted. Using numerical integration. Jun 6, 2017 at 17:33

You should be able to go about this using geometric Region functions:

region = ImplicitRegion[0 <= y <= Sqrt[x + 9], {{x, -9, 0}, {y, 0, 3}}]
(barycenter = RegionCentroid@region) // N
(* Out: {-3.6, 1.125} *)


This seems to be in agreement with the result you obtained through other means.

RegionPlot[
region, AspectRatio -> 1/GoldenRatio,
Epilog -> {PointSize[0.02], Red, Point@barycenter}
] Slightly different writing of MarcoB's form...

reg = ImplicitRegion[{-9 <= x <= 0, 0 <= y <= Sqrt[x + 9]}, {x,y}];

RegionCentroid[reg]

(* {-(18/5), 9/8} *)
`