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

### 14.4.6 Finding the barycenter of a set of points in space: barycenter

See Section 13.6.10 for barycenters of objects in the plane.

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

- barycenter takes an unspecified number of arguments:
  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.

- Input:
  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)
  Output:

  ⎡ ⎣ | 1,1,0 | ⎤ ⎦