This module provides the usual basic transcendental
mathematical functions. All trig functions use angles in
radians. (For a similar set of functions using the complex
number system, see the
Python library documentation for the cmath
module.)
The math module has two constant
attributes:
pi | The constant 3.14159... |
e | The base of natural logarithms, 2.71828... |
Functions in this module include:
acos(
|
Angle (in radians) whose cosine is , that is,
arccosine of .
|
asin(
|
Arcsine of .
|
atan(
|
Arctangent of .
|
atan2( |
Angle whose slope is
, even if
is zero.
|
ceil(
|
True ceiling function, defined as the smallest
integer that is greater than or equal to . For
example, ceil(3.9) yields 4.0,
while ceil(-3.9) yields -3.0.
|
cos(
|
Cosine of , where is expressed in
radians.
|
cosh(
|
Hyperbolic cosine of .
|
exp(
|
e to the power.
|
floor(
|
True floor function, defined as the largest
integer that is less than or equal to . For
example, floor(3.9) is 3.0, and
floor(-3.9) is -4.0.
|
frexp(
|
Given a float , returns a tuple ( where is the mantissa and
the
binary exponent of , and is equal
to . If
is
zero, returns the tuple (0.0, 0).
|
fmod(
|
Returns (.
|
ldexp(
|
Returns .
|
hypot(
|
The square root of (2+2).
|
log(
|
Natural log of .
|
log10(
|
Common log (base 10) of .
|
modf(
|
Returns a tuple ( where
is the
fractional part of , is the integral part (as a
float), and both have the same sign as .
|
sin(
|
Sine of .
|
sinh(
|
Hyperbolic sine of .
|
sqrt(
|
Square root of .
|
tan(
|
Tangent of .
|
tanh(
|
Hyperbolic tangent of .
|