The sections below discuss only a tiny fraction of the official and unofficial module library of Python. For a full set, find the online and printed versions of the Python Library Reference Library Reference at the Python documentation site.
If you want to use any of these modules, you must
import them. See the
import
statement and the
from
statement above.
This module provides the usual basic transcendental mathematical functions. All trig functions use angles in radians. The module has two members:
pi | The constant 3.14159... |
e | The base of natural logarithms, 2.1828... |
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;
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;
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( | ( |
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 . |