ABSTRACT

R can be used, without any programming, as a powerful calculator. It has all the standard arithmetic operators and functions, which operate on numeric or complex vectors (including scalars, which are vectors of length 1).

Arithmetic operators: The binary arithmetic operators are +, -, *, /, ^ (exponentiation), %% (mod), and %/% (integer division).

Logarithms and exponentials: log (natural log), log10, (base 10 log), log2 (base 2 log), log (x,b) (log of x to base b). log1p(x) computes log(1+x) accurately for |x| << 1.

exp computes the exponential function, and expm1 computes exp(x)-1 accurately for |x| << 1.

Trigonometric functions : cos(x), sin(x), tan(x), acos(x), asin(x), atan(x), atan2(y,x) where angles are in radians and x and y are numeric or complex scalars or vectors. atan2(y,x) = atan(y/x) for positive arguments. The pracma package, to which we will refer later, adds more trigonometric functions: cot(x), csc(x), sec(x), acot(x), acsc(x), asec(x).

Hyperbolic functions : cosh(x), sinh(x), tanh(x), acosh(x), asinh(x), atanh(x). pracma adds coth(x), csch(x), sech(x), acoth(x), acsch(x), asech(x).

Miscellaneous mathematical functions: abs(x), sqrt(x).