Note
本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
English · 原始项目 · 上游 README
原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|pypi version| |Build status| |Zenodo Badge|
.. |pypi version| image:: https://img.shields.io/pypi/v/mpmath.svg :target: https://pypi.python.org/pypi/mpmath .. |Build status| image:: https://github.com/mpmath/mpmath/workflows/test/badge.svg :target: https://github.com/mpmath/mpmath/actions?workflow=test .. |Zenodo Badge| image:: https://zenodo.org/badge/2934512.svg :target: https://zenodo.org/badge/latestdoi/2934512
用于任意精度(arbitrary-precision)浮点运算的 Python 库。
网站:https://mpmath.org/ 主要作者:Fredrik Johansson fredrik.johansson@gmail.com
Mpmath 是在 New BSD License(详见 LICENSE 文件)下发布的自由软件。
以下人员(以及其他人员)为 mpmath 贡献了重要补丁或新功能:
还有许多其他人通过报告 bug、请求新功能或提出文档改进建议做出了贡献。
有关详细变更日志(包括个人贡献),请参阅 CHANGES 文件。
Fredrik 在 2008 年夏季对 mpmath 的工作由 Google 赞助,作为 Google Summer of Code 计划的一部分。
Fredrik 在 2009 年夏季对 mpmath 的工作由美国数学研究所(American Institute of Mathematics)赞助,并受到美国国家科学基金会(National Science Foundation)第 0757627 号拨款(FRG: L-functions and Modular Forms)的支持。
本材料中表达的任何观点、发现、结论或建议均属于作者,不一定反映赞助方的观点。
还应感谢:
发布历史:
Mpmath 需要 Python 3.10 或更高版本。已在 CPython 3.10 至 3.15 以及 PyPy 3.11 上完成测试。
mpmath 的最新版本可从 mpmath 网站以及 https://github.com/mpmath/mpmath/releases 下载。
它也应可在 Python Package Index 获取,地址为 https://pypi.python.org/pypi/mpmath
要使用 pip 安装 Mpmath 最新版本,只需运行
pip install mpmath
或从源码树安装
pip install .
最新开发代码可从 https://github.com/mpmath/mpmath 获取
更详细的说明请参阅主文档。
reStructuredText 格式的文档包含在源码包附带的 docs 目录中。这些文件
可直接阅读,但也可使用
Sphinx <https://www.sphinx-doc.org/>_ 编译为更美观的 HTML。
最新文档也以 HTML 格式提供:
https://mpmath.readthedocs.io/
mpmath/tests/ 中的单元测试可使用 pytest <https://pytest.org/>_ 运行,详见主文档。
你也可以查看 demo 目录中的演示脚本。
master 分支会在 Github Actions 上自动测试。
Mpmath 仍在持续开发中。主要问题包括:
当参数极大或非常接近奇点时,某些函数可能返回不正确的值。
有向舍入(directed rounding)适用于算术运算。对于其他运算,它是启发式实现的,其结果在最后一位(unit in the last place)上可能偏差一两个单位(即使其他方面是准确的)。
部分 IEEE 754 特性不可用。无穷大(Inifinities)和 NaN 仅得到部分支持,没有有符号零(signed zero);非规格化舍入(denormal rounding)完全不可用。
切换精度和舍入方式的接口尚未定稿。 当前方法不是线程安全的(threadsafe)。
一般问题和评论可 sent <mailto:mpmath@googlegroups.com>_
发送至 mpmath mailinglist <https://groups.google.com/g/mpmath>_。
你也可以向 mpmath 问题跟踪器 https://github.com/mpmath/mpmath/issues 报告 bug 并提交补丁。
另请参阅我们的 contributing guidelines <https://github.com/mpmath/mpmath/blob/master/.github/CONTRIBUTING.rst>_。