Get The Most Affordable Hosting in the World!

Starting at just $1.87/month, Vercaa offers unbeatable pricing for world-class web hosting services.

Fast, reliable, and secure hosting to power your website without breaking the bank. Plus, enjoy a free CDN for faster loading times worldwide!

Get Started Now!

Python's standard library provides math module. This module includes many pre-defined functions for performing different mathematical operations. These functions do not work with complex numbers. There is a cmath module contains mathematical functions for complex numbers.

Functions in Math Module

Here is the list of functions available in the math module −

Sr.No Method & Description
1

acos (x)

Return the arc cosine of x, in radians.

2

acosh (x)

Return the inverse hyperbolic cosine of x.

3

asin

Return the arc sine of x, in radians.

4

asinh (x)

Return the inverse hyperbolic sine of x.

5

atan

Return the arc tangent of x, in radians.

6

atan2

Return atan(y/x), in radians.

7

atanh (x)

Return the inverse hyperbolic tangent of x.

8

cbrt (x)

Return the cube root of x.

9

cell(x)

The ceiling of x: the smallest integer not less than x.

10

comb (x,y)

Return the number of ways to choose x items from y iter repetition and without order.

11

copysign(x,y)

Return a float with the magnitude of x but the sign of y.

12

cos (x)

Return the cosine of x radians.

13

cosh (x)

Return the hyperbolic cosine of x.

14

degrees

Converts angle x from radians to degrees.

15

dist (x,y)

Return the Euclidean distance between two points x and y.

16

e

The mathematical constant e = 2.718281..., to available precision.

17

erf (x)

Return the error function at x.

18

erfc (x)

Return the complementary error function at x.

19

exp (x)

Return e raised to the power x, where e = 2.718281...

20

exp2 (x)

Return 2 raised to the power x.

21

expm1 (x)

Return e raised to the power x, minus 1.

22

fabs(x)

The absolute value of x in float

23

factorial(x)

Return x factorial as an Integer.

24

floor (x)

The floor of x: the largest integer not greater than x.

25

fmod (x,y)

Always returns float, similar to x%y

26

frexp (x)

Returns the mantissa and exponent for a given number x.

27

fsum (iterable)

Sum of all numbers in any iterable, returns float.

28

gamma (x)

Return the Gamma function at x..

29

gcd (x,y,z)

Return the greatest common divisor of the specified integer arguments.

30

hypot

Return the Euclidean norm, sqrt(x*x + y*y).

31

inf

A floating-point positive infinity. Equivalent to the output of float('inf").

32

isclose (x,y)

Return True if the values x and y are close to each other and False otherwise.

33

isfinite (x)

Returns True if neither an infinity nor a NaN, and False otherwise.

34

isinf (x)

Return True if x is a positive or negative infinity, and False otherwise.

35

isnan (x)

Return True if x is a NaN (not a number), and False otherwise.

36

isqrt (x)

Return the integer square root of the nonnegative integer x

37

lcm (x1, x2, ..)

Return the least common multiple of the specified integer arguments.

38

ldexp (x,y)

Return x * (2**y). This is the inverse of function frexp().

39

lgamma (x)

Return the natural logarithm of the absolute value of the Gamma function at x.

40

log (x)

Return the natural logarithm of x (to base e).

41

log10 (x)

Return the base-10 logarithm of x.

42

log1p (x)

Return the natural logarithm of 1+x (base e).

43

log2 (x)

Return the base-2 logarithm of x.

44

modf (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.

45

nan

A floating-point "not a number" (NaN) value.

46

nextafter (x,y)

Return the next floating-point value after x towards y.

47

perm (x,y)

Return the number of ways to choose x items from y items without repetition and with order.

48

pi

The mathematical constant π = 3.141592..., to available precision.

49

pow (x,y)

Returns x raised to y

50

prod (iterable)

Return the product of all the elements in the input iterable.

51

radians

Converts angle x from degrees to radians.

52

remainder (x,y)

Returns the remainder of x with respect to y

53

sin (x)

Return the sine of x radians.

54

sinh (x)

Return the inverse hyperbolic sine of x.

55

sqrt (x)

Return the square root of x.

56

tan (x)

Return the tangent of x radians.

57

tanh (x)

Return the hyperbolic tangent of x.

58

tau

The mathematical constant τ = 6.283185..., to available precision.

59

trunc (x)

Return x with the fractional part removed, leaving the integer part.

60

ulp

Return the value of the least significant bit of the float x.

These functions can be classified in following categories −

 

 

The End! should you have any inquiries, we encourage you to reach out to the Vercaa Support Center without hesitation.

Bu cavab sizə kömək etdi? 1 istifadəçi bunu faydalı hesab edir (1 səs)