log                   package:base                   R Documentation

_L_o_g_a_r_i_t_h_m_s _a_n_d _E_x_p_o_n_e_n_t_i_a_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     'log' computes natural logarithms, 'log10' computes common (i.e.,
     base 10) logarithms, and 'log2' computes binary (i.e., base 2)
     logarithms. The general form 'logb(x, base)' computes logarithms
     with base 'base' ('log10' and 'log2' are only special cases).

     'log1p(x)' computes log(1+x) accurately also for |x| << 1 (and
     less accurately when x is approximately -1).

     'exp' computes the exponential function.

     'expm1(x)' computes exp(x) - 1 accurately also for |x| << 1.

_U_s_a_g_e:

     log(x, base = exp(1))
     logb(x, base = exp(1))
     log10(x)
     log2(x)
     exp(x)
     expm1(x)
     log1p(x)

_A_r_g_u_m_e_n_t_s:

       x: a numeric or complex vector.

    base: positive number.  The base with respect to which logarithms
          are computed.  Defaults to e='exp(1)'.

_D_e_t_a_i_l_s:

     'exp' and 'log' are generic functions: methods can be defined for
     them individually or via the 'Math' group generic.

_V_a_l_u_e:

     A vector of the same length as 'x' containing the transformed
     values.  'log(0)' gives '-Inf' (when available).

_N_o_t_e:

     'log' and 'logb' are the same thing in R, but 'logb' is preferred
     if 'base' is specified, for S-PLUS compatibility.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole. (for 'log', '\log10' and
     'exp'.)

     Chambers, J. M. (1998) _Programming with Data. A Guide to the S
     Language_. Springer. (for 'logb'.)

_S_e_e _A_l_s_o:

     'Trig', 'sqrt', 'Arithmetic'.

_E_x_a_m_p_l_e_s:

     log(exp(3))
     log10(1e7)# = 7

     x <- 10^-(1+2*1:9)
     cbind(x, log(1+x), log1p(x), exp(x)-1, expm1(x))

