### 27.3.6 Finding the barycenter of a set of points in space

See Section 26.5.10 for barycenters of objects in the plane.

The barycenter command returns and draws the barycenter of a set of weighted points.

- barycenter takes L1,L2,…,Ln, a sequence of lists of length two, where each list consists of a point and a weight. This information can also be given as a matrix with two columns (the first column the points and the second column the weights) or a matrix with two rows and more than two columns.
- barycenter(L1,L2,…,Ln) draws and returns the barycenter of the weighted points.

If the sum of the weights is zero, then this command returns an error.

#### Examples

BC:=barycenter([point(1,4,0),1],[point(1,-2,0),1])

or:

BC:=barycenter([[point(1,4,0),1],[point(1,-2,0),1]])

then:

coordinates(BC)

| ⎡ ⎣ | 1,1,0 | ⎤ ⎦