1

Thanks for any helpful answers!

import numpy as np
from scipy.spatial import SphericalVoronoi

def sphere_points(n, dim):
    points = np.random.randn(n, dim)
    points /= np.linalg.norm(points, axis=1).reshape(-1, 1)
    sv = SphericalVoronoi(points)
    return sv.vertices

points = sphere_points(360, 10)ype here

I tried above code, but points variable gives dimension of (16041607, 10) unlike (360,10)

import numpy as np
from numpy.linalg import norm
import random

def sample_spherical(npoints, ndim):
    vec = np.random.randn(ndim, npoints)
    vec /= np.linalg.norm(vec, axis=0)
    return vec

points = sample_spherical(360, 10)

This one gives 360 randomly distributed points on a 10-dimensional sphere. I am expecting 360 fixed points uniformly distributed on the 10-dimensional sphere of unit radius ex. randomly generating points on the sphere

  • In your own words, why should it be possible to find 360 such points? Intuitively I expect that it should only be possible to find [11](https://en.wikipedia.org/wiki/Simplex) such points. (Also, we normally use the terminology "ball" rather than "sphere", when generalizing to more than 3 dimensions.) – Karl Knechtel Feb 22 '23 at 23:00
  • If I am not mistaken some answers in https://stackoverflow.com/questions/33976911/generate-a-random-sample-of-points-distributed-on-the-surface-of-a-unit-sphere can be easily generalized to a N-dim case – Davide Fiocco Feb 22 '23 at 23:03
  • Hold on. Did you mean, you want to choose random points; but because you choose from inside a 10-dimensional unit cube (sorry, I don't know the proper terminology this time :) ) and then normalize, there is a bias towards the "corners"? In this case, I think you may have better luck asking at [math.se]. – Karl Knechtel Feb 22 '23 at 23:08
  • @KarlKnechtel just to understand, sphere is https://en.wikipedia.org/wiki/N-sphere while ball is the interior no? So in the question I assume points should live in 10-D space, and we're talking about a 9-sphere? – Davide Fiocco Feb 22 '23 at 23:08
  • @DavideFiocco oh, maybe I was wrong about terminology. Anyway, `SphericalVoronoi` isn't a useful tool here; the reason it computes a lot of extra points is because it tries to make a Voronoi diagram with small regions surrounding the original points - which, in 10 dimensions, gets rather complex. – Karl Knechtel Feb 22 '23 at 23:10
  • @DavideFiocco, Thank you for your comment. """import numpy as np from numpy.linalg import norm import random def sample_spherical(npoints, ndim): vec = np.random.randn(ndim, npoints) vec /= np.linalg.norm(vec, axis=0) return vec Arm = sample_spherical(360, 10)""" I tried this one, it will generate randomly distributed points and not uniformly distributed points. Please let me know how I can improve. – Pinky Kapoor Feb 22 '23 at 23:14

0 Answers0