pythonplotrandomdata-generation

Sample points from a hyperboloid


A hyperboloid has the formula

-x^2/a^2 - y^2/b^2 + z^2/c^2 = 1.

How can I generate samples from this hyperboloid in Python? (Say, with a=b=c=1.)

I was thinking to pick random x and y in [0,1] and then fill in the z value that would make the formula equal 1. However this would not sample uniformly. Is there a better way?


Solution

  • This is only a partial answer.

    J.F. Williamson, "Random selection of points distributed on curved surfaces", Physics in Medicine & Biology 32(10), 1987, describes a general method of choosing a uniformly random point on a parametric surface. It is an acceptance/rejection method that accepts or rejects each candidate point depending on its stretch factor (norm-of-gradient). To use this method for a parametric surface, several things have to be known about the surface, namely—

    The algorithm is then:

    1. Generate a point on the surface, xyz.
    2. If g(xyz) >= RNDU01()*gmax, where RNDU01() is a uniform random number in [0, 1), accept the point. Otherwise, repeat this process.

    In the case of a hyperboloid with parameters a=b=c=1:

    The only thing left is to turn the implicit formula into a parametric equation that is a function of two-dimensional coordinates u and v. I know this algorithm works for parametric surfaces, but I don't know if it still works if we "pick random x and y in [0,1] and then fill in the z value that would make the formula equal" in step 1.