| 1 |
\name{unif} |
| 2 |
\alias{unif} |
| 3 |
\title{Nice Uniform Points in Interval} |
| 4 |
\description{ |
| 5 |
Give regularly spaced points on interval \eqn{[-c,c]} with mean 0 |
| 6 |
(exactly) and variance about 1 (very close for \bold{even} \code{n} |
| 7 |
and larger \code{round.dig}). Note that \eqn{c} depends on \code{n}. |
| 8 |
} |
| 9 |
\usage{ |
| 10 |
unif(n, round.dig = 1 + trunc(log10(n))) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{n}{positive integer specifying the number of points desired.} |
| 14 |
\item{round.dig}{integer indicating to how many digits the result is |
| 15 |
rounded.} |
| 16 |
} |
| 17 |
\value{ |
| 18 |
numeric vector of length \code{n}, symmetric around 0, hence |
| 19 |
with exact mean \code{0}, and variance approximately 1. |
| 20 |
} |
| 21 |
\note{It relies on the fact that \eqn{Var(1,2,...,n) = n(n+1)/12}. |
| 22 |
} |
| 23 |
\author{Martin Maechler, ca 1990} |
| 24 |
\seealso{\code{\link{runif}} for producing uniform \emph{random} numbers.} |
| 25 |
\examples{ |
| 26 |
(u <- unif(8)) |
| 27 |
var(u) |
| 28 |
|
| 29 |
(u. <- unif(8, 12))# more digits in result, hence precision for Var : |
| 30 |
var(u.) |
| 31 |
} |
| 32 |
\keyword{arith} |
| 33 |
\keyword{utilities} |