Learn R Programming

TDA (version 1.0)

torusUnif: Uniform Sample From The 3D Torus

Description

This function samples n points from the 3D torus, uniformly with respect to its surface.

Usage

torusUnif(n, a, c)

Arguments

n
an integer specifying the number of points in the sample.
a
the radius of the torus tube.
c
the radius from the center of the hole to the center of the torus tube.

Value

  • torusUnif returns an n by 3 matrix of coordinates.

Details

This function is an implementation of Algorithm 1 in the reference.

References

Persi Diaconis, Susan Holmes, and Mehrdad Shahshahani, (2013), "Sampling from a manifold." Advances in Modern Statistical Theory and Applications: A Festschrift in honor of Morris L. Eaton. Institute of Mathematical Statistics, 102-125.

See Also

circleUnif

Examples

Run this code
X=torusUnif(300, a=1.8, c=5)
plot(X)

Run the code above in your browser using DataLab