Mathematical Functions using Python

PythonServer Side ProgrammingProgramming

Python includes following functions that perform mathematical calculations.

Sr.NoFunction & Returns ( description )
1abs(x)
The absolute value of x: the (positive) distance between x and zero.
2ceil(x)
The ceiling of x: the smallest integer not less than x
3cmp(x, y)
-1 if x < y, 0 if x == y, or 1 if x > y
4exp(x)
The exponential of x: ex
5fabs(x)
The absolute value of x.
6floor(x)
The floor of x: the largest integer not greater than x
7log(x)
The natural logarithm of x, for x> 0
8log10(x)
The base-10 logarithm of x for x> 0.
9max(x1, x2,...)
The largest of its arguments: the value closest to positive infinity
10min(x1, x2,...)
The smallest of its arguments: the value closest to negative infinity
11modf(x)
The fractional and integer parts of x in a two-item tuple. Both parts have the same sign as x. The integer part is returned as a float.
12pow(x, y)
The value of x**y.
13round(x [,n])
x rounded to n digits from the decimal point. Python rounds away from zero as a tie-breaker: round(0.5) is 1.0 and round(-0.5) is -1.0.
14sqrt(x)
The square root of x for x > 0
raja
Published on 28-Jan-2020 16:12:29
Advertisements