Learn R Programming

uniformly (version 0.5.0)

runif_on_sphericalCap: Uniform sampling on a spherical cap

Description

Uniform sampling on a spherical cap (in dimension 3).

Usage

runif_on_sphericalCap(n, r = 1, h)

Value

The simulations in a n times 3 matrix.

Arguments

n

number of simulations

r

radius of the sphere

h

height of the cap

Examples

Run this code
sims <- runif_on_sphericalCap(500, r = 2, h = 1)
if (FALSE) {
library(rgl)
spheres3d(0, 0, 0, radius = 2, color = "red", alpha = 0.5)
points3d(sims)}

Run the code above in your browser using DataLab