Python consists of a built-in module that you can use for doing mathematical tasks. Thus, here is the list of various functions available and the attributes defined in the math module with a brief description of what they actually do:
ceil(x)
It returns the smallest integer that is greater than or equal to the x.
copysign(x, y)
It returns x with y’s sign
fabs(x)
It returns the complete value of x
factorial(x)
It returns the factorial of the x
floor(x)
It returns the biggest integer that is less than or equal to x
fmod(x, y)
It returns the remainder when y divides x
frexp(x)
It returns the mantissa and the exponent of x as the duo (m, e)
fsum(iterable)
It returns an exact floating-point sum of the values in the iterable
isfinite(x)
It returns true if the x is neither infinity nor a number (NaN)
isinf(x)
It returns true if the x is a positive or negative infinity
isnan(x)
It returns true if the x is not a number (NaN)
ldexp(x, i)
It returns x * (2**i)
modf(x)
It returns the fractional and integer parts of the x
trunc(x)
It returns the truncated integer value of the x
exp(x)
It returns e**x
expm1(x)
It returns e**x – 1
log(x[, b])
It returns the logarithm of x to the base (b) i.e. (defaults to e)
log1p(x)
It returns the natural logarithm of 1+x
log2(x)
It returns the base-2 logarithm of x
log10(x)
It returns the base-10 logarithm of x
pow(x, y)
It returns x raised to the power of y
sqrt(x)
It returns the square root of x
acos(x)
It returns the arc cosine of the x
asin(x)
It returns the arc sine of the x
atan(x)
It returns the arctangent of the x
atan2(y, x)
It returns a tan(y / x)
cos(x)
It returns the cosine of the x
hypot(x, y)
It returns the Euclidean norm, sqrt(x*x + y*y)
sin(x)
It returns the sine of the x
tan(x)
It returns the tangent of the x
degrees(x)
It changes angle x from radians to the degrees
radians(x)
It changes the angle x from degrees to the radians
acosh(x)
It returns the inverse hyperbolic cosine of the x
asinh(x)
It returns the inverse hyperbolic sine of the x
atanh(x)
It returns the inverse hyperbolic tangent of the x
cosh(x)
It returns the hyperbolic cosine of the x
sinh(x)
It returns the hyperbolic cosine of the x
tanh(x)
It returns the hyperbolic tangent of the x
erf(x)
It returns the fault error function at x
erfc(x)
It returns the complementary fault error function at x
gamma(x)
It returns the Gamma function at x
lgamma(x)
It returns the natural logarithm of the exact value of the Gamma function at x
Pi
Mathematical constant, the ratio of the circumference of a circle to its diameter i.e. ‘3.14159’
E
Mathematical constant e i.e. ‘2.71828’
Browse more Topics Under Functions
FAQs on Functions in Python Math Module
Question 1: Which module offers mathematical functions?
Answer 1: Some of the most common mathematical functions are available and well-defined in the math module.
Question 2: Does Python need mathematics?
Answer 2: We don’t really need to be good at mathematics to learn Python. We might need it when we are doing data science-related work but that also depends on which type of way we are learning.
Question 3: Can I learn Python without maths?
Answer 3: Yes, of course. Mathematics is not at all necessary to learn the programming language. To learn programming all we need is to just focus and understand the basic concepts of the programming language and keep practising it with time.