Hyperbolic               package:base               R Documentation

_H_y_p_e_r_b_o_l_i_c _F_u_n_c_t_i_o_n_s

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

     These functions give the obvious hyperbolic functions. They
     respectively compute the hyperbolic cosine, sine, tangent,
     arc-cosine, arc-sine, arc-tangent.

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

     cosh(x)
     sinh(x)
     tanh(x)
     acosh(x)
     asinh(x)
     atanh(x)

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

     `cos', `sin', `tan', `acos', `asin', `atan'.

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

     Ceps <- .Machine$double.eps # ``Computer epsilon''
     x <- rnorm(500)
     stopifnot(
      abs(cosh(x) - (exp(x) + exp(-x))/2) < 10*Ceps,
      abs(sinh(x) - (exp(x) - exp(-x))/2) < 10*Ceps,
      Mod(cosh(x) - cos(1i*x))       < 10*Ceps,
      Mod(sinh(x) - sin(1i*x)/1i)    < 10*Ceps,
      abs(tanh(x)*cosh(x) - sinh(x)) < 10*Ceps
     )

     ## Inverse:
     all(abs(asinh(sinh(x)) - x) < 10*Ceps)
     x[abs(acosh(cosh(x)) - abs(x)) > 100*Ceps] #- imprecise for small x
     all(abs(atanh(tanh(x)) - x) < 100*Ceps)

     all(abs(asinh(x) - log(x + sqrt(x^2 + 1))) < 10*Ceps)
     cx <- cosh(x)
     all(abs(acosh(cx) - log(cx + sqrt(cx^2 - 1))) < 1000*Ceps)

