1
2
3
4
5
#

R - Math Functions

 R Code Examples Function a + b > 3+4  7 Addition a - b > 10-5  5 Subtraction a * b > 6*4  24 Multiplication a / b > 50/10  5 Division 2 + 4 * 5 > 6+10/5  8 Order of Operations abs(a-b) > abs(3-8)  5 Absolute Value factorial(x) > factorial(4)  24 Factorial of x (x!) x^n > 2^3  8 x raised to the nth power xen > 3e2  300 x * 10n log10(x) > log10(100)  2 Common logarithm of x with base 10 log(x, n) > log(16,4)  2 Logarithm of x with base n log(x) > log(42)  3.73767 Natural logarithm with base e (2.1782) exp(n) > exp(7)  1096.633 Exponential function: en sqrt(x) > sqrt(49)  7 Square root of x floor(x) > floor(3.77)  3 Rounds x down ceiling(x) > ceiling(3.44)  4 Rounds x up pi > pi  3.141593 3.141593 round(x, n) > round(3.575757575, 3)  3.576 Round a number x to n decimal places round(pi, 0) > round(pi, 0)  3 Round pi to a whole number round(pi, n) > round(pi, 4)  3.1416  Round pi to n decimal places cos(x) > cos(0.5)  0.8775826 Cosine of x sin(x) > sin(0.5)  0.4794255 Sine of x tan(x) > tan(0.5)  0.5463025 Tangent of x acos(x) > acos(1)  0 Inverse cosine (arccosine)of x asin(x) > asin(1)  1.570796 Inverse sine (arcsine) of x atan(x) > atan(1)  0.7853982 Inverse tangent (arctangent) of x