runif_ellipsoid | R Documentation |
Uniform sampling on an ellipsoid or in an ellipsoid. The sampling in an ellipsoid is available in arbitrary dimension. The sampling on an ellipsoid is available only in dimension 2 or 3. This code is borrowed directly from the uniformly package (https://CRAN.R-project.org/package=uniformly)
runif_on_ellipse(n, A, r)
runif_on_ellipsoid(n, A, r)
runif_in_ellipsoid(n, A, r)
n |
number of simulations |
A |
symmetric positive-definite matrix defining the ellipsoid (see
Details), of size 2 for |
r |
"radius" (see Details) |
The ellipsoid is the set of vectors x
satisfying
t(x) %*% A %*% x == r^2
. For example, for an axis-aligned
ellipse with horizontal radius a
and vertical radius b
, take
A=1/diag(c(a^2,b^2))
and r=1
.
The simulations in a matrix with n
rows.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.