Numeric & Mathematical
fractions — Rational numbers
Source code: Lib/fractions.py
random — Generate pseudo-random numbers
Source code: Lib/random.py
statistics — Mathematical statistics functions
Source code: Lib/statistics.py
decimal — Decimal fixed point and floating point arithmetic
Source code: Lib/decimal.py
cmath — Mathematical functions for complex numbers
This module provides access to mathematical functions for complex numbers. The functions in this module accept integers, floating-point numbers or complex numbers as arguments. They will also accept any Python object that has either a
or a __complex__()
method: these methods are used to convert the object to a complex or floating-point number, respectively, and the function is then applied to the result of the conversion.
__float__()
numbers — Numeric abstract base classes
Source code: Lib/numbers.py
math — Mathematical functions
This module provides access to the mathematical functions defined by the C standard.