# 數值與數學模組

The modules described in this chapter provide numeric and math-related functions and data types. The `numbers` module defines an abstract hierarchy of numeric types. The `math` and `cmath` modules contain various mathematical functions for floating-point and complex numbers. The `decimal` module supports exact representations of decimal numbers, using arbitrary precision arithmetic.

The following modules are documented in this chapter:

- `numbers` --- Numeric abstract base classes
  - The numeric tower
  - Notes for type implementors
    - Adding More Numeric ABCs
    - Implementing the arithmetic operations
- `math` --- Mathematical functions
  - Number-theoretic and representation functions
  - Power and logarithmic functions
  - Trigonometric functions
  - Angular conversion
  - Hyperbolic functions
  - Special functions
  - Constants
- `cmath` --- Mathematical functions for complex numbers
  - Conversions to and from polar coordinates
  - Power and logarithmic functions
  - Trigonometric functions
  - Hyperbolic functions
  - Classification functions
  - Constants
- `decimal` --- Decimal fixed point and floating point arithmetic
  - Quick-start Tutorial
  - Decimal objects
    - Logical operands
  - Context objects
  - Constants
  - Rounding modes
  - Signals
  - Floating Point Notes
    - Mitigating round-off error with increased precision
    - Special values
  - Working with threads
  - Recipes
  - Decimal FAQ
- `fractions` --- Rational numbers
- `random` --- Generate pseudo-random numbers
  - Bookkeeping functions
  - Functions for integers
  - Functions for sequences
  - Real-valued distributions
  - Alternative Generator
  - Notes on Reproducibility
  - Examples and Recipes
- `statistics` --- 數學統計函式
  - 平均值與中央位置量數
  - 離度 (spread) 的測量
  - 函式細節
  - Exceptions
  - `NormalDist` objects
    - `NormalDist` Examples and Recipes