Special Mathematical Functions, supported by the MPFR Library.
Usage
zeta(x)
Ei(x)
Li2(x)
erf(x)
erfc(x)
Arguments
x
a numeric or mpfr vector.
Details
zeta(x) computes Riemann's Zeta function
zeta(x) important in analytical number theory and
related fields. The traditional definition is
Zeta(x) = sum[n=1..Inf; 1/(n^x)].
Ei(x) computes the exponential integral,
Integral(-Inf,x; e^t/t dt).
Li2(x) computes the dilogarithm,
Integral(0,x; -log(1-t)/t dt).
erf(x) and erfc(x) are the error, respectively
complementary error function which are both reparametrizations
of pnorm, erf(x) = 2*pnorm(sqrt(2)*x) and
erfc(x) = 2* pnorm(sqrt(2)*x, lower=FALSE),
and hence Rmpfr provides its own version of pnorm.
Value
A vector of the same length as x, of class mpfr.
See Also
pnorm in standard package stats;
the class description mpfr mentioning the
generic arithmetic and mathematical functions (sin, log,
..., etc) for which "mpfr" methods are available.
Examples
curve(Ei, 0, 5, n=2001)
if(mpfrVersion() >= "2.4.0") { ## Li2() is not available in older MPFR versions
curve(Li2, 0, 5, n=2001)
curve(Li2, -2, 13, n=2000); abline(h=0,v=0, lty=3)
curve(Li2, -200,400, n=2000); abline(h=0,v=0, lty=3)
}
curve(erf, -3,3, col = "red", ylim = c(-1,2))
curve(erfc, add = TRUE, col = "blue")
abline(h=0, v=0, lty=3)
legend(-3,1, c("erf(x)", "erfc(x)"), col = c("red","blue"), lty=1)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Rmpfr)
Loading required package: gmp
Attaching package: 'gmp'
The following objects are masked from 'package:base':
%*%, apply, crossprod, matrix, tcrossprod
C code of R package 'Rmpfr': GMP using 64 bits per limb
Attaching package: 'Rmpfr'
The following objects are masked from 'package:stats':
dbinom, dnorm, dpois, pnorm
The following objects are masked from 'package:base':
cbind, pmax, pmin, rbind
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Rmpfr/special-math.Rd_%03d_medium.png", width=480, height=480)
> ### Name: mpfr-special-functions
> ### Title: Special Mathematical Functions (MPFR)
> ### Aliases: zeta Ei Li2 erf erfc
> ### Keywords: math
>
> ### ** Examples
>
> curve(Ei, 0, 5, n=2001)
>
> if(mpfrVersion() >= "2.4.0") { ## Li2() is not available in older MPFR versions
+ curve(Li2, 0, 5, n=2001)
+
+ curve(Li2, -2, 13, n=2000); abline(h=0,v=0, lty=3)
+ curve(Li2, -200,400, n=2000); abline(h=0,v=0, lty=3)
+ }
>
> curve(erf, -3,3, col = "red", ylim = c(-1,2))
> curve(erfc, add = TRUE, col = "blue")
> abline(h=0, v=0, lty=3)
> legend(-3,1, c("erf(x)", "erfc(x)"), col = c("red","blue"), lty=1)
>
>
>
>
>
> dev.off()
null device
1
>