# Link to this section Summary

## Functions

The arithmetic mean position of the `points`

The sum of the products of the corresponding entries of `x` and `y`

The ordinary straight-line distance between two points in Euclidean space

The euclidean distance between the initial and terminal point of the `vector`

The neighbor that is closest to the given `point`

# Link to this section Functions

The arithmetic mean position of the `points`.

## Examples

``````iex> Emel.Math.Geometry.centroid([[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]])
[0.5, 0.5]``````

The sum of the products of the corresponding entries of `x` and `y`.

## Examples

``````iex> Emel.Math.Geometry.dot_product([-4.0, -9.0], [-1.0, 2.0])
-14.0

iex> Emel.Math.Geometry.dot_product([1.0, 2.0, 3.0], [4.0, -5.0, 6.0])
12.0``````
Link to this function euclidean_distance(x, y) View Source

The ordinary straight-line distance between two points in Euclidean space.

## Examples

``````iex> Emel.Math.Geometry.euclidean_distance([2.0, -1.0], [-2.0, 2.0])
5.0

iex> Emel.Math.Geometry.euclidean_distance([0.0, 3.0, 4.0, 5.0], [7.0, 6.0, 3.0, -1.0])
9.746794344808963``````

The euclidean distance between the initial and terminal point of the `vector`.

## Examples

``````iex> Emel.Math.Geometry.magnitude([0.0, 2.0])
2.0

iex> Emel.Math.Geometry.magnitude([6.0, 8.0])
10.0

iex> Emel.Math.Geometry.magnitude([1.0, -2.0, 3.0])
3.7416573867739413``````
Link to this function nearest_neighbor(point, neighbors) View Source

The neighbor that is closest to the given `point`.

## Examples

``````iex> Emel.Math.Geometry.nearest_neighbor([0.9, 0.0], [[0.0, 0.0], [0.0, 0.1], [1.0, 0.0], [1.0, 1.0]])
[1.0, 0.0]``````