Net-informations.com

Python Mathematical Function

Functions can do anything, but their primary use pattern is taking parameters and returning values . The math module provides some basic mathematical functions for working with floating-point numbers. Using Math module in python, we can access to different mathematical functions already defined by the C standard. These functions perform various arithmetic operations like calculating the floor, ceiling, or absolute value of a number using the floor(x), ceil(x), and fabs(x) functions respectively. Here is the list of all the functions and attributes defined in math module with a brief explanation of what they do.

ceil(x)

Return the ceiling of x as a float, the smallest integer value greater than or equal to x.

output

copysign(x, y)

Return x with the sign of y. On a platform that supports signed zeros, copysign(1.0, -0.0) returns -1.0. (New in version 2.6.)

output

fabs(x)

This function will return an absolute or positive value.

output

factorial(x)

Returns the factorial of x

output

floor(x)

The method floor() returns floor of x - the largest integer not greater than x.

output

fmod(x, y)

This function returns x % y.

output

frexp(x)

Returns the mantissa and exponent of x as the pair (m, e)

output

fsum(iterable)

This function adds the items of an iterable and returns the sum.

output

isfinite(x)

This function is either True or False.

output

isinf(x)

This function Returns True if x is a positive or negative infinity

output

isnan(x)

Returns True if x is a NaN

output

ldexp(x, i)

This function returns the result of x * (2**i) which is an inverse of the frexp() function.

output

modf(x)

This function returns 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.

output

trunc(x)

This function returns the truncated integer of x.

output

exp(x)

This function returns exponential of x: ex.

output

pow(x, y)

This function returns x raised to the power y

output

sqrt(x)

Returns the square root of x

output

pi

Mathematical constant, the ratio of circumference of a circle to it's diameter (3.14159...)

output

e

mathematical constant e (2.71828...)

output

net-informations.com (C) 2019    Founded by raps mk