- abs
signature(x = "mpfr"): ...
- atan2
signature(y = "mpfr", x = "ANY"), and
- atan2
signature(x = "ANY", y = "mpfr"): compute the
arc-tangent of two arguments: atan2(y, x) returns the angle
between the x-axis and the vector from the origin to \((x, y)\),
i.e., for positive arguments atan2(y, x) == atan(y/x).
- lbeta
signature(a = "ANY", b = "mpfrArray"), is
\(\log(|B(a,b)|)\) where \(B(a,b)\) is the
Beta function, beta(a,b).
- beta
signature(a = "mpfr", b = "ANY"),
- beta
signature(a = "mpfr", b = "mpfr"), ..., etc:
Compute the beta function \(B(a,b)\), using high precision,
building on internal gamma or lgamma.
See the help for R's base function beta for
more. Currently, there, \(a,b \ge 0\) is required.
Here, we provide (non-NaN) for all numeric a, b.
When either \(a\), \(b\), or \(a+b\) is a negative
integer, \(\Gamma(.)\) has a pole there and is undefined
(NaN). However the Beta function can be defined there as
“limit”, in some cases. Following other software such as
SAGE, Maple or Mathematica, we provide finite values in these
cases. However, note that these are not proper limits
(two-dimensional in \((a,b)\)), but useful for some
applications. E.g., \(B(a,b)\) is defined as zero when
\(a+b\) is a negative integer, but neither \(a\) nor \(b\) is.
Further, if \(a > b > 0\) are integers, \(B(-a,b)= B(b,-a)\)
can be seen as \((-1)^b * B(a-b+1,b)\).
- dim<-
signature(x = "mpfr"): Setting a dimension
dim on an "mpfr" object makes it into an object
of class "mpfrArray" or (more specifically)
"mpfrMatrix" for a length-2 dimension, see their help page;
note that t(x) (below) is a special case of this.
- Ops
signature(e1 = "mpfr", e2 = "ANY"): ...
- Ops
signature(e1 = "ANY", e2 = "mpfr"): ...
- Arith
signature(e1 = "mpfr", e2 = "missing"): ...
- Arith
signature(e1 = "mpfr", e2 = "mpfr"): ...
- Arith
signature(e1 = "mpfr", e2 = "integer"): ...
- Arith
signature(e1 = "mpfr", e2 = "numeric"): ...
- Arith
signature(e1 = "integer", e2 = "mpfr"): ...
- Arith
signature(e1 = "numeric", e2 = "mpfr"): ...
- Compare
signature(e1 = "mpfr", e2 = "mpfr"): ...
- Compare
signature(e1 = "mpfr", e2 = "integer"): ...
- Compare
signature(e1 = "mpfr", e2 = "numeric"): ...
- Compare
signature(e1 = "integer", e2 = "mpfr"): ...
- Compare
signature(e1 = "numeric", e2 = "mpfr"): ...
- Logic
signature(e1 = "mpfr", e2 = "mpfr"): ...
- Summary
signature(x = "mpfr"): The S4
Summary group functions,
max, min, range,
prod, sum,
any, and all
are all defined for MPFR numbers. mean(x, trim) for
non-0 trim works analogously to mean.default.
- median
signature(x = "mpfr"): works via
% quantile(*, probs = 0.5) :
- quantile
signature(x = "mpfr"): a simple wrapper of
the quantile.default method from stats.
- summary
signature(object = "mpfr"): modeled after
summary.default, ensuring to provide the full "mpfr"
range of numbers.
- Math
signature(x = "mpfr"): All the S4
Math group functions are
defined, using multiple precision (MPFR) arithmetic, from
getGroupMembers("Math"), these are (in alphabetical
order):
abs, sign, sqrt,
ceiling, floor, trunc,
cummax, cummin, cumprod,
cumsum, exp, expm1,
log, log10, log2,
log1p, cos, cosh,
sin, sinh, tan,
tanh, acos, acosh,
asin, asinh, atan,
atanh,
cospi, sinpi, tanpi,
gamma, lgamma,
digamma, and trigamma.
Currently, trigamma is not provided by
the MPFR library and hence not yet implemented.
Further, the cum*() methods are not yet implemented.
- factorial
signature(x = "mpfr"): this will
round the result when x is integer valued.
Note however that factorialMpfr(n) for integer
n is slightly more efficient, using the MPFR function
mpfr_fac_ui.
- Math2
signature(x = "mpfr"): round(x,
digits) and signif(x, digits) methods. Note that
these do not change the formal precision ('prec' slot),
and you may often want to apply roundMpfr() in
addition or preference.
- as.numeric
signature(x = "mpfr"): ...
- as.vector
signature(x = "mpfrArray"): as for standard
arrays, this “drops” the dim (and
dimnames), i.e., transforms x into an ‘MPFR’
number vector, i.e., class mpfr.
- [[
signature(x = "mpfr", i = "ANY"), and
- [
signature(x = "mpfr", i = "ANY", j = "missing", drop = "missing"):
subsetting aka “indexing” happens as for numeric vectors.
- format
signature(x = "mpfr"), further arguments
digits = NULL, scientific = NA, etc: This method is identical
to the (exported) formatMpfr() function, see its help
page for details.
% ./formatMpfr.Rd
- is.finite
signature(x = "mpfr"): ...
- is.infinite
signature(x = "mpfr"): ...
- is.na
signature(x = "mpfr"): ...
- is.nan
signature(x = "mpfr"): ...
- log
signature(x = "mpfr"): ...
- show
signature(object = "mpfr"): The show
method for "mpfr" classed objects calls the S3 method
print.mpfr(object) with several optional arguments,
itself based on the format() method which calls
formatMpfr().
- sign
signature(x = "mpfr"): ...
- Re, Im
signature(z = "mpfr"): simply return z
or 0 (as "mpfr" numbers of correct precision), as mpfr
numbers are ‘real’ numbers.
- Arg, Mod, Conj
signature(z = "mpfr"): these are
trivial for our ‘real’ mpfr numbers, but defined to work
correctly when used in R code that also allows complex number input.
- all.equal
signature(target = "mpfr", current = "mpfr"),
- all.equal
signature(target = "mpfr", current = "ANY"), and
- all.equal
signature(target = "ANY", current = "mpfr"):
methods for numerical (approximate) equality,
all.equal of multiple precision numbers. Note
that the default tolerance (argument) is taken to correspond
to the (smaller of the two) precisions when both main arguments are
of class "mpfr", and hence can be considerably less than
double precision machine epsilon .Machine$double.eps.
- coerce
signature(from = "numeric", to = "mpfr"):
as(., "mpfr") coercion methods are available for
character strings, numeric, integer,
logical, and even raw. Note however,
that mpfr(., precBits, base) is more flexible.
- coerce
signature(from = "mpfr", to = "bigz"): coerces
to biginteger, see bigz in package gmp.
- coerce
signature(from = "mpfr", to = "numeric"): ...
- coerce
signature(from = "mpfr", to = "character"): ...
- unique
signature(x = "mpfr"), and corresponding S3 method
(such that unique(<mpfr>) works inside base functions),
see unique.
Note that duplicated() works for "mpfr" objects
without the need for a specific method.
- t
signature(x = "mpfr"): makes x into an \(n
\times 1\) mpfrMatrix.
- which.min
signature(x = "mpfr"): gives the index of
the first minimum, see which.min.
- which.max
signature(x = "mpfr"): gives the index of
the first maximum, see which.max.