241 lines
4.9 KiB
ReStructuredText
241 lines
4.9 KiB
ReStructuredText
Utility functions
|
|
===============================================
|
|
|
|
This page lists functions that perform basic operations
|
|
on numbers or aid general programming.
|
|
|
|
Conversion and printing
|
|
-----------------------
|
|
|
|
:func:`~mpmath.mpmathify` / ``convert()``
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.mpmathify
|
|
|
|
:func:`~mpmath.nstr`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.nstr
|
|
|
|
:func:`~mpmath.nprint`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.nprint
|
|
|
|
:func:`mpmath.mpf.__format__`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.mpf.__format__
|
|
|
|
:func:`mpmath.mpc.__format__`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.mpc.__format__
|
|
|
|
Arithmetic operations
|
|
---------------------
|
|
|
|
See also :func:`mpmath.sqrt`, :func:`mpmath.exp` etc., listed
|
|
in :doc:`functions/powers`
|
|
|
|
:func:`~mpmath.fadd`
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fadd
|
|
|
|
:func:`~mpmath.fsub`
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fsub
|
|
|
|
:func:`~mpmath.fneg`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fneg
|
|
|
|
:func:`~mpmath.fmul`
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fmul
|
|
|
|
:func:`~mpmath.fdiv`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fdiv
|
|
|
|
:func:`~mpmath.fmod`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fmod
|
|
|
|
:func:`~mpmath.fsum`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fsum
|
|
|
|
:func:`~mpmath.fprod`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fprod
|
|
|
|
:func:`~mpmath.fdot`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fdot
|
|
|
|
Complex components
|
|
------------------
|
|
|
|
:func:`~mpmath.fabs`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fabs
|
|
|
|
:func:`~mpmath.sign`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.sign
|
|
|
|
:func:`~mpmath.re`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.re
|
|
|
|
:func:`~mpmath.im`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.im
|
|
|
|
:func:`~mpmath.arg`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.arg
|
|
|
|
:func:`~mpmath.conj`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.conj
|
|
|
|
:func:`~mpmath.polar`
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.polar
|
|
|
|
:func:`~mpmath.rect`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.rect
|
|
|
|
Integer and fractional parts
|
|
-----------------------------
|
|
|
|
:func:`~mpmath.floor`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.floor
|
|
|
|
:func:`~mpmath.ceil`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.ceil
|
|
|
|
:func:`~mpmath.nint`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.nint
|
|
|
|
:func:`~mpmath.frac`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.frac
|
|
|
|
Tolerances and approximate comparisons
|
|
--------------------------------------
|
|
|
|
:func:`~mpmath.chop`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.chop
|
|
|
|
:func:`~mpmath.almosteq`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.almosteq
|
|
|
|
Properties of numbers
|
|
-------------------------------------
|
|
|
|
:func:`~mpmath.isinf`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.isinf
|
|
|
|
:func:`~mpmath.isnan`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.isnan
|
|
|
|
:func:`~mpmath.isnormal`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.isnormal
|
|
|
|
:func:`~mpmath.isfinite`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.isfinite
|
|
|
|
:func:`~mpmath.isint`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.isint
|
|
|
|
:func:`~mpmath.ldexp`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.ldexp
|
|
|
|
:func:`~mpmath.frexp`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.frexp
|
|
|
|
:func:`~mpmath.mag`
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.mag
|
|
|
|
:func:`~mpmath.nint_distance`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.nint_distance
|
|
|
|
.. :func:`~mpmath.absmin`
|
|
.. ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. .. autofunction:: mpmath.absmin(x)
|
|
.. .. autofunction:: mpmath.absmax(x)
|
|
|
|
Number generation
|
|
-----------------
|
|
|
|
:func:`~mpmath.fraction`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.fraction
|
|
|
|
:func:`~mpmath.rand`
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.rand
|
|
|
|
:func:`~mpmath.arange`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.arange
|
|
|
|
:func:`~mpmath.linspace`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.linspace
|
|
|
|
Precision management
|
|
--------------------
|
|
|
|
:func:`~mpmath.autoprec`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.autoprec
|
|
|
|
:func:`~mpmath.workprec`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.workprec
|
|
|
|
:func:`~mpmath.workdps`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.workdps
|
|
|
|
:func:`~mpmath.extraprec`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.extraprec
|
|
|
|
:func:`~mpmath.extradps`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.extradps
|
|
|
|
Performance and debugging
|
|
------------------------------------
|
|
|
|
:func:`~mpmath.memoize`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.memoize
|
|
|
|
:func:`~mpmath.maxcalls`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.maxcalls
|
|
|
|
:func:`~mpmath.monitor`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.monitor
|
|
|
|
:func:`~mpmath.timing`
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
.. autofunction:: mpmath.timing
|