method
s, that is, algorithms.NOTE the current default methods will be changed -- to get better accuracy !
Bernoulli (n, method = c("sumBin", "sumRamanujan", "asymptotic"),
verbose = FALSE)
Bernoulli.all(n, method = c("A-T", "sumBin", "sumRamanujan", "asymptotic"),
precBits = NULL, verbose = getOption("verbose"))
Bernoulli.all()
, "A-T"
stands for the Akiyama-Tanigawa algorithm
which is nice and simple but has bad numerical properties. It can
howevermethod = "A-T"
--
NULL
or a positive integer indicating the precision of the
initial numbrs in bits, using "A-T"
:) logical indicating if the
intermediate results of the algorithm should be printed.Eulerian
, Stirling1
, etc.## The example for the paper
MASS::fractions(Bernoulli.all(8, verbose=TRUE))
B10 <- Bernoulli.all(10)
MASS::fractions(B10)
system.time(B50 <- Bernoulli.all(50))# {does not cache} -- still "no time"
system.time(B100 <- Bernoulli.all(100))# still less than a milli second
## Using Bernoulli() is not much slower, but hopefully *more* accurate!
## Check first - TODO
system.time(B.1c <- Bernoulli(100))# caches ..
system.time(B1c. <- Bernoulli(100))# ==> now much faster
stopifnot(identical(B.1c, B1c.))
if(FALSE)## reset the cache:
assign("Bern.tab", list(), envir = copula:::.nacopEnv)
## More experiments in the *source* of the copula package ../tests/Stirling-etc.R
Run the code above in your browser using DataLab