Skip to main content

4. Mathematical Functions

 

Mathematical Functions

The following are the functions which are widely used in Computer Science.

Floor Functions

The floor function for any real number x is defined as f(x) is the greatest integer that does not exceed x i.e. 1 less than x or equal to x. It is denoted by ⌊x⌋.

Example :

⌊3⌋ = 3
⌊3.2⌋ = 3
⌊3.8⌋ = 3
⌊-3.8⌋ = -4
⌊-3.2⌋ = -4
⌊-3⌋ = -3

Ceiling Functions

The ceiling function for any real number x is defined as g(x) is the least integer that is not less than x i.e. 1 greater than or equal to x. It is denoted by ⌈x⌉

Example :

⌊3⌋ = 3
⌊3.2⌋ = 4
⌊3.8⌋ = 4
⌊-3.8⌋ = -3
⌊-3.2⌋ = 3
⌊-3⌋ = -3

Remainder Functions

The integer remainder is obtained when some k is divided by M. It is denoted by k(mod M). We can also define it as k(mod M) is the unique integer t such that k = Mq + r, where q is quotient and r is remainder, so 0 ≤ r < M.

Example :

40(mod 10) = 0
40(mod 9) = 4
43(mod 11) = 10

Exponential Functions

An exponential function is in the form f(x) = kx, where "x" is a variable defined for all real numbers, and "k" is a constant which is called the base of the function and it should be greater than 0.

Example :

103 = 10 x 10 x 10 = 1000
41/2 = (2√41) = 2
2-6 = 1/26 = 1/64

Logarithmic Functions

The logarithmic function is an inverse function to exponential function. The logarithmic function is defined as for x > 0, k > 0 and k ≠ 1, y = logk x if and only if x = ky, then the function is given by f(x) = logk x

Example :

log3 9 = 2 as 32 = 9
log10 100 = 2 as 102 = 100
log2 150 = 7 as 27 = 128 but 28 = 256 which is greater than 150.
log10 0.01 = -2 as 10-2 = 0.01

Comments