def g_(x,a,c):
    """
    Calculate vector of equations of residuals,
    evaluated at x
    G[i] = Sum_j (x[j] - a[i,j])^2 - C[i]**2

    where:
    x is the point we're trying to fit (in M dimensions),
    a is the (N) already embedded points (in M dimensions),
    C is the expected distance
    """
    return ((x-a)**2).sum(1) - c**2