This is probably a question of logic more than an algorithm. I want to distribute about N points in such a way that the average distance of a single point to the other N-1 points is uniformly distributed around a value d. That is, The points themselves are not be normally distributed but their spacing with respect to each other is.
Is there a logical way to implement this?
For Example :
X = np.ones(N) #1d for simplicity
d = np.ones(N)
for i in range(N):
X[i] = ## Insert the algorithm here
##
for i in range(N):
da = 0
for j in range(N):
if i != j:
da += np.sqrt(np.abs(X[i]**2 - X[j]**2)) #Calculating distance to other points and
summing up
da = da / (N-1) # Taking average of all distances
d[i] = da # the average distance of point i with all other points
A = np.mean(d) #The mean of all average distances
A is the parameter I want control over. It should be basis for how all the points are distributed.Recommendations using inbuilt Python or C modules would work as well.
Aucun commentaire:
Enregistrer un commentaire