Special                 package:base                 R Documentation

_S_p_e_c_i_a_l _F_u_n_c_t_i_o_n_s _o_f _M_a_t_h_e_m_a_t_i_c_s

_D_e_s_c_r_i_p_t_i_o_n:

     The functions `beta' and `lbeta' return the beta function and the
     natural logarithm of the beta function,

              B(a,b) = (Gamma(a)Gamma(b))/(Gamma(a+b)).


     The functions `gamma' and `lgamma' return the gamma function
     Gamma(x) and the natural logarithm of the absolute value of the
     gamma function.

     The functions `digamma', `trigamma', `tetragamma' and `pentagamma'
     return the first, second, third and fourth derivatives of the
     logarithm of the gamma function.

  `digamma(x)' = psi(x) = d/dx {ln Gamma(x)} = Gamma'(x) / Gamma(x)


     The functions `choose' and `lchoose' return binomial coefficients
     and their logarithms.

_U_s_a_g_e:

     beta(a, b)
     lbeta(a, b)
     gamma(x)
     lgamma(x)
     digamma(x)
     trigamma(x)
     tetragamma(x)
     pentagamma(x)
     choose(n,k)
     lchoose(n,k)

_R_e_f_e_r_e_n_c_e_s:

     Abramowitz, M. and Stegun, I. A. (1972) Handbook of Mathematical
     Functions. New York: Dover. Chapter 6: Gamma and Related
     Functions.

_S_e_e _A_l_s_o:

     `Arithmetic' for simple, `sqrt' for miscellaneous mathematical
     functions and `Bessel' for the real Bessel functions.

_E_x_a_m_p_l_e_s:

     choose(5, 2)
     for (n in 0:10) print(choose(n, k = 0:n))

     curve(gamma(x),-3,4, n=1001, ylim=c(-10,100),
           col="red", lwd=2, main="gamma(x)")
     abline(h=0,v=0, lty=3, col="midnightblue")

     x <- seq(.1, 4, length = 201); dx <- diff(x)[1]
     par(mfrow = c(2, 3))
     for (ch in c("", "l","di","tri","tetra","penta")) {
       is.deriv <- nchar(ch) >= 2
       if (is.deriv) dy <- diff(y) / dx
       nm <- paste(ch, "gamma", sep = "")
       y <- get(nm)(x)
       plot(x, y, type = "l", main = nm, col = "red")
       abline(h = 0, col = "lightgray")
       if (is.deriv) lines(x[-1], dy, col = "blue", lty = 2)
     }
     par(mfrow = c(2, 2))

