> [!NOTE] > 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 > [English](./README.en.md) · [原始项目](https://github.com/mpmath/mpmath) · [上游 README](https://github.com/mpmath/mpmath/blob/HEAD/README.rst) > 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。 mpmath ====== |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 Mpmath 是在 New BSD License(详见 LICENSE 文件)下发布的自由软件。 0. 历史与致谢 ---------------------- 以下人员(以及其他人员)为 mpmath 贡献了重要补丁或新功能: * Pearu Peterson * Mario Pernici * Ondrej Certik * Vinzent Steinberg * Nimish Telang * Mike Taschuk * Case Van Horsen * Jorn Baayen * Chris Smith * Juan Arias de Reyna * Ioannis Tziakos * Aaron Meurer * Stefan Krastanov * Ken Allen * Timo Hartmann * Sergey B Kirpichev * Kris Kuhlman * Paul Masson * Michael Kagalenko * Jonathan Warner * Max Gaukler * Guillermo Navas-Palencia * Nike Dattani * Tim Peters * Javier Garcia 还有许多其他人通过报告 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)的支持。 本材料中表达的任何观点、发现、结论或建议均属于作者,不一定反映赞助方的观点。 还应感谢: * GMP 库及其 Python 封装 gmpy 的作者,使 mpmath 在高精度下运行得更快 * MPFR、pari/gp、MPFUN 及其他任意精度库的作者,其文档对实现 mpmath 中的许多算法很有帮助 * Wikipedia 贡献者;Abramowitz & Stegun;Gradshteyn & Ryzhik; Wolfram Research 提供的 MathWorld 和 Wolfram Functions 网站。 这些是特殊函数实现所使用的主要参考资料。 * George Brandl 开发了用于构建 mpmath 文档的 Sphinx 文档工具 发布历史: * Version 1.4.1 released on March 15, 2026 * Version 1.4.0 released on February 23, 2026 * Version 1.3.0 released on March 7, 2023 * Version 1.2.1 released on February 9, 2021 * Version 1.2.0 released on February 1, 2021 * Version 1.1.0 released on December 11, 2018 * Version 1.0.0 released on September 27, 2017 * Version 0.19 released on June 10, 2014 * Version 0.18 released on December 31, 2013 * Version 0.17 released on February 1, 2011 * Version 0.16 released on September 24, 2010 * Version 0.15 released on June 6, 2010 * Version 0.14 released on February 5, 2010 * Version 0.13 released on August 13, 2009 * Version 0.12 released on June 9, 2009 * Version 0.11 released on January 26, 2009 * Version 0.10 released on October 15, 2008 * Version 0.9 released on August 23, 2008 * Version 0.8 released on April 20, 2008 * Version 0.7 released on March 12, 2008 * Version 0.6 released on January 13, 2008 * Version 0.5 released on November 24, 2007 * Version 0.4 released on November 3, 2007 * Version 0.3 released on October 5, 2007 * Version 0.2 released on October 2, 2007 * Version 0.1 released on September 27, 2007 1. 下载与安装 -------------------------- 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 获取 更详细的说明请参阅主文档。 2. 文档 ---------------- reStructuredText 格式的文档包含在源码包附带的 docs 目录中。这些文件 可直接阅读,但也可使用 `Sphinx `_ 编译为更美观的 HTML。 最新文档也以 HTML 格式提供: https://mpmath.readthedocs.io/ 3. 运行测试 ---------------- mpmath/tests/ 中的单元测试可使用 `pytest `_ 运行,详见主文档。 你也可以查看 demo 目录中的演示脚本。 master 分支会在 Github Actions 上自动测试。 4. 已知问题 ----------------- Mpmath 仍在持续开发中。主要问题包括: * 当参数极大或非常接近奇点时,某些函数可能返回不正确的值。 * 有向舍入(directed rounding)适用于算术运算。对于其他运算,它是启发式实现的,其结果在最后一位(unit in the last place)上可能偏差一两个单位(即使其他方面是准确的)。 * 部分 IEEE 754 特性不可用。无穷大(Inifinities)和 NaN 仅得到部分支持,没有有符号零(signed zero);非规格化舍入(denormal rounding)完全不可用。 * 切换精度和舍入方式的接口尚未定稿。 当前方法不是线程安全的(threadsafe)。 5. 帮助与 bug 报告 ----------------------- 一般问题和评论可 `sent `_ 发送至 `mpmath mailinglist `_。 你也可以向 mpmath 问题跟踪器 https://github.com/mpmath/mpmath/issues 报告 bug 并提交补丁。 另请参阅我们的 `contributing guidelines `_。