I have vectors v1, v2, v3, v4, v5, with 100 dim, I need to find a center vector, that will have equal distance with each.

**Uptdate:** Looking at this answer from Mathmatics, is there a way to implement the solution in Numpy/Python?

I have vectors v1, v2, v3, v4, v5, with 100 dim, I need to find a center vector, that will have equal distance with each.

**Uptdate:** Looking at this answer from Mathmatics, is there a way to implement the solution in Numpy/Python?

Everything depends on how vectors are presented in Python.

Lets v1, v2, ... , v5 are presented as lists of values. Each list has len = 100.

In this case I would do the following:

If vectors are already composed as 5x100 array, e.g.

`arr`

,`arr.shape=(5, 100)`

, you can get the solution as follows:EDIT: [the question was changed/clarified]

To get equidistant vector (x) look at the following code snippet I just wrote:

So,

`res[:-1]`

(len = 100) is equidistant to all`v[i]`

;`res[-1]`

is distance value.I suspected that the problem has analytical solution; I just implemented one of the possible ways to solve undetermined linear system from the link you provided.

And result is:

I used

`np.linalg.pinv`

, that is Moore-Penrose pseudo-inversion. Using it I got a minimal length solution for the undetermined linear system. So, obtained vector`res`

has smallest norm of all possible solutions for this problem.