DPQ (version 0.3-3)

numer-utils: Numerical Utilities - Functions, Constants

Description

The DPQ package provides some numeric constants used in some of its distribution computations.

all_mpfr() and any_mpfr() return TRUE iff all (or ‘any’, respectively) of their arguments inherit from class "mpfr" (from package Rmpfr).

logr(x,a) computes log(x / (x + a)) in a numerically stable way.

Usage

## Numeric Constants : % mostly in   ../R/beta-fns.R
M_LN2        # = log(2) = 0.693....
M_cutoff     # := If |x| > |k| * M_cutoff, then  log[ exp(-x) * k^x ]  =~=  -x
             #  = 3196577161300663808 ~= 3.2e+18
M_minExp     # = log(2) * .Machine$double.min.exp # ~= -708.396..
G_half       # = sqrt(pi) = Gamma( 1/2 )

## Functions : all_mpfr(...) any_mpfr(...) logr(x, a) # == log(x / (x + a)) -- but numerically smart; x > 0, a >= 0 > -x

Arguments

numeric or "mpfr" numeric vectors.

x, a

number-like ..

Value

The numeric constant in the first case; a numeric (or "mpfr") vector of appropriate size in the 2nd case.

Details

all_mpfr(),

all_mpfr() :

test if all or any of their arguments or of class "mpfr" (from package Rmpfr). The arguments are evaluated only until the result is determined, see the example.

logr()

computes \(\log( x / (x+a) )\) in a numerically stable way.

%% which means .... (TODO)

%% \item{\code{..()}}{ ..} %% \item{\code{..()}}{ ..}

See Also

.Machine

Examples

Run this code
# NOT RUN {
(Ms <- ls("package:DPQ", pattern = "^M"))
lapply(Ms, function(nm) { cat(nm,": "); print(get(nm)) }) -> .tmp
# }

Run the code above in your browser using DataLab