cmath.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. :mod:`cmath` -- mathematical functions for complex numbers
  2. ==========================================================
  3. .. module:: cmath
  4. :synopsis: mathematical functions for complex numbers
  5. |see_cpython_module| :mod:`python:cmath`.
  6. The ``cmath`` module provides some basic mathematical functions for
  7. working with complex numbers.
  8. Availability: not available on WiPy and ESP8266. Floating point support
  9. required for this module.
  10. Functions
  11. ---------
  12. .. function:: cos(z)
  13. Return the cosine of ``z``.
  14. .. function:: exp(z)
  15. Return the exponential of ``z``.
  16. .. function:: log(z)
  17. Return the natural logarithm of ``z``. The branch cut is along the negative real axis.
  18. .. function:: log10(z)
  19. Return the base-10 logarithm of ``z``. The branch cut is along the negative real axis.
  20. .. function:: phase(z)
  21. Returns the phase of the number ``z``, in the range (-pi, +pi].
  22. .. function:: polar(z)
  23. Returns, as a tuple, the polar form of ``z``.
  24. .. function:: rect(r, phi)
  25. Returns the complex number with modulus ``r`` and phase ``phi``.
  26. .. function:: sin(z)
  27. Return the sine of ``z``.
  28. .. function:: sqrt(z)
  29. Return the square-root of ``z``.
  30. Constants
  31. ---------
  32. .. data:: e
  33. base of the natural logarithm
  34. .. data:: pi
  35. the ratio of a circle's circumference to its diameter