2431 Commits

Author SHA1 Message Date
Sergey B Kirpichev a2333847a8 Fix docs CI job 2026-07-11 09:16:26 +03:00
Sergey B Kirpichev c328efcd37 Change signature for wrapped libmp's functions
See #1056
2026-07-11 07:17:59 +03:00
Apoorv Darshan 86978167e1 Close leftover figure in plot/cplot/splot on error (#1123)
Fixes #1007
2026-07-10 04:57:23 +03:00
Warren Weckesser 8d21910bba Implement the modified spherical bessel functions spherical_in() and spherical_kn(). (#1121) 2026-07-08 04:13:53 +03:00
Sergey B Kirpichev 76d91a4fa5 Merge pull request #1120 from skirpichev/theta-apply-qperiodicy
Use quasi-periodicity property (DLMF, §20.2(ii)) to compute jtheta()
2026-07-07 07:44:49 +03:00
Sergey B Kirpichev cc198d4ecd Use quasi-periodicity property (DLMF, §20.2(ii)) to compute jtheta()
*_theta2/3a() helpers now not needed
2026-07-05 09:24:26 +03:00
Sergey B Kirpichev 5688722737 Merge pull request #1119 from mpmath/dependabot/github_actions/actions-deps-640176b5ab
Bump actions/checkout from 6 to 7 in the actions-deps group
2026-07-02 04:10:57 +03:00
Sergey B Kirpichev 40cf9ba085 Merge pull request #1118 from skirpichev/fix-repr_dps/1116
Fix repr_dps() to produce a correct estimate
2026-07-02 04:07:27 +03:00
dependabot[bot] b20d7c530a Bump actions/checkout from 6 to 7 in the actions-deps group
Bumps the actions-deps group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 6 to 7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-01 22:55:58 +00:00
Sergey B Kirpichev f12743f60f Remove dead code in secondzeta_exp_term() 2026-07-01 08:31:40 +03:00
Sergey B Kirpichev c44efa2ca2 Remove py2 remnants (cast round() to int) 2026-07-01 08:08:19 +03:00
Sergey B Kirpichev 6f1fbd275d Fix repr_dps() to produce a correct estimate
That should work at lest for 32-bit integers.  Though, I think that
the repr/str representation loses all sence for precisions much
less than that ;-)

Closes #1116
2026-07-01 05:36:13 +03:00
Graham Hesketh aa205a2821 Add Weierstrass elliptic functions (#1113)
* Weierstrass $\wp$: `weierp`
* inverse Weierstrass $\wp$: `weierpinv`
* derivative of Weierstrass $\wp$: `weierpprime`
* Weierstrass zeta: `weierzeta`
* Weierstrass sigma: `weiersigma`

Also adds parameter conversion functions:

* Weierstrass invariants $g_2, g_3$: `weierinvariants`
* half-periods $\omega_1, \omega_2$: `weierhalfperiods`

The idea for this PR was inspired by the `pyweierstrass` package by @stla / Stéphane Laurent:

* https://pyweierstrass.readthedocs.io/en/latest/
* https://github.com/stla/pyweierstrass

The code implementation in this PR is different to that in `pyweierstrass` although both packages derive from similar well known mathematical formulas. Differences between `pyweierstrass` and this `mpmath` implementation include but are not limited to:

* function names adapted to `mpmath` conventions;
* tau normalization: `tau` specifies the normalized period lattice `(1, tau)`, corresponding to half-periods `(1/2, tau/2)`; this differs from `pyweierstrass`, where `tau` denotes half-periods `(1, tau)`;
* support for disambiguating inverse values of Weierstrass $\wp$ by optionally passing the corresponding derivative value;
* internal refactoring of helper functions for integration with `mpmath`.

Dedicated to Stéphane Laurent who opened the original PR to request this functionality in `mpmath` and whose `pyweierstrass` package provided great utility to the author of this PR in the years since.

Co-authored-by: Stéphane Laurent <stla@users.noreply.github.com>

Closes #612
2026-06-30 03:43:58 +03:00
Sergey B Kirpichev a686b903ae Merge pull request #1111 from skirpichev/jtheta-modular/930
Use generic modular transformations to compute jtheta() with |q| ~ 1
2026-06-29 14:12:08 +03:00
Sergey B Kirpichev 2a2de4e7ca Drop mp.THETA_Q_LIM 2026-06-29 03:19:33 +03:00
Sergey B Kirpichev 8e31d10120 Use generic modular transformations to compute jtheta() with |q| ~ 1
See https://fungrim.org/topic/Lattice_transformations_for_Jacobi_theta_functions/#General_modular_transformations

Closes #930

Co-Authored-By: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-06-29 03:19:33 +03:00
Sergey B Kirpichev 90e1cff769 Reapply "Revert testing of GMP-backends for PyPy, see #1013"
This reverts commit 390972e250.
2026-06-26 13:38:01 +03:00
Vincent Gao ba2a0da3a1 Fix chebyfit IndexError when N <= 0 (#1114)
chebyfit(f, interval, N) support only positive integer N.  Add an explicit ValueError.
2026-06-26 05:13:49 +03:00
Sergey B Kirpichev c4f9187805 Merge pull request #1021 from skirpichev/test-pypy-on-gmpy/1013
Re-enable testing with GMP backends on PyPy
2026-06-26 04:50:05 +03:00
Sergey B Kirpichev 390972e250 Revert "Revert testing of GMP-backends for PyPy, see #1013"
This reverts commit f580874a54.

Closes #1013
2026-06-25 03:13:21 +03:00
Sergey B Kirpichev 1626936cca Merge pull request #1112 from skirpichev/misc
Misc fixes
2026-06-25 03:06:45 +03:00
Sergey B Kirpichev 1aff951d93 Fix fp.hypsum() to exit if ZeroDivisionError occurs and t==0
Closes #496
2026-06-24 16:19:06 +03:00
Sergey B Kirpichev 92f61841bf Merge pull request #1110 from skirpichev/prepare-v1.5.0a0
test / linter (push) Failing after 1s
test / coverage (push) Failing after 0s
test / docs (push) Failing after 0s
Publish on PyPI / Build distributions (push) Has been cancelled
Publish on PyPI / Publish distributions to PyPI (push) Has been cancelled
test / frozen-version (push) Has been cancelled
test / tests (false, false, 3.10) (push) Has been cancelled
test / tests (false, false, 3.11) (push) Has been cancelled
test / tests (false, false, 3.12) (push) Has been cancelled
test / tests (false, false, 3.13) (push) Has been cancelled
test / tests (false, false, 3.14) (push) Has been cancelled
test / tests (false, false, 3.14t) (push) Has been cancelled
test / tests (false, false, 3.15) (push) Has been cancelled
test / tests (false, false, 3.15t) (push) Has been cancelled
test / tests (true, pypy3.11) (push) Has been cancelled
test / tests (true, 3.x) (push) Has been cancelled
Prepare v1.5.0a0
1.5.0a0
2026-06-24 04:43:20 +03:00
Sergey B Kirpichev bf99017677 Allow gmpy2 for CPython v3.15 2026-06-24 04:27:00 +03:00
Sergey B Kirpichev 5a4116a13e Update CHANGES 2026-06-24 04:18:33 +03:00
Sergey B Kirpichev b5e38772b1 Merge pull request #1109 from skirpichev/fix-integral-path-for-lerchphi/252
Change integral path of the lerchphi() to use Laplace transform integral
2026-06-24 03:43:34 +03:00
Sergey B Kirpichev 085f181126 Change integral path of the lerchphi() to use Laplace transform integral
Current formula ignores some constraints: https://dlmf.nist.gov/25.14#E6

Implementation follows to lerch_hankel():
https://fredrikj.net/blog/2022/02/computing-the-lerch-transcendent/#section6

Closes #252
2026-06-23 13:17:01 +03:00
Sergey B Kirpichev 60cf796714 Merge pull request #1107 from skirpichev/fix-1104
Improve fixed-precision computation paths for jtheta()
2026-06-23 08:11:34 +03:00
Sergey B Kirpichev 3f3d3ec9a3 Merge pull request #1108 from skirpichev/add-jacobi_symbol
Add jacobi_symbol() to libintmath
2026-06-23 08:01:22 +03:00
Sergey B Kirpichev 1d89343973 Add jacobi_symbol() to libintmath 2026-06-23 07:16:42 +03:00
Sergey B Kirpichev 9e890f67cd Drop _jacobi_theta2() 2026-06-23 04:58:49 +03:00
Sergey B Kirpichev 1cfd36f49e Drop _jacobi_theta3() 2026-06-23 04:58:49 +03:00
Sergey B Kirpichev 0fe9033f18 Use prec kwarg for cos_sin in theta helpers 2026-06-23 04:58:49 +03:00
Sergey B Kirpichev c8a17b495d Amend dca2abd6 2026-06-23 04:58:49 +03:00
Sergey B Kirpichev 3e6e7967ad Reorganize fixed-precision computations for theta3
θ₃(z) ~ 1 + 2q¹cos(2z) + 2q⁴cos(4z) + ..., and we
are in |Im(z)| < |Re(log(q))|/2 domain.

To avoid severe cancellation we compute in fixed-point
only s ~ 2(cos(2z) + q³ cos(4z) + ...), then
return 1 + s*q.

Closes #1104
2026-06-23 04:58:48 +03:00
Sergey B Kirpichev 5e683847c7 Fix test_compatibility()
Avoid using of private numpy API
2026-06-23 03:42:46 +03:00
Sergey B Kirpichev 6dfd359ed6 Merge pull request #1106 from skirpichev/misc
Misc fixes
2026-06-21 12:39:33 +03:00
Sergey B Kirpichev 7a1aaff95a Add debug info to random tests in mpmath/tests/test_elliptic.py
Also some cleanup for assert statements and comments
2026-06-21 12:16:06 +03:00
Sergey B Kirpichev dca2abd6ca Cleanup jtheta()
* normalize result
* use extraprec context manager
* add error message
2026-06-21 12:16:06 +03:00
Sergey B Kirpichev a8a614c5f0 Drop _djtheta() helper method 2026-06-21 11:14:17 +03:00
Sergey B Kirpichev e002cb4488 Allow python-gmp for CPython v3.15 2026-06-21 10:59:32 +03:00
Sergey B Kirpichev b62c4173d1 Support CPython v3.15 2026-06-20 09:10:21 +03:00
Sergey B Kirpichev 12e7e74251 Fix test_sn_cn_dn_identities()
Closes #1105
2026-06-20 09:10:21 +03:00
Sergey B Kirpichev 11a5afe7b6 Remove --durations=20 from default pytest options 2026-06-20 07:01:58 +03:00
Ayush Baranwal a2e0351345 Add Brent root-finding algorithm (#1103)
Closes #1095
2026-06-19 03:31:16 +03:00
Vincent Gao 29c496bf14 Fix gegenbauer() failing to converge for odd integer n at z=0
Used parity identity:
https://functions.wolfram.com/Polynomials/GegenbauerC3/04/02/01/

Closes #1077.
2026-06-18 17:37:29 +03:00
Sergey B Kirpichev e45f046a02 Merge pull request #1100 from skirpichev/lerchphi-series/1099
Implement direct series for lerchphi() base case with |z| < 0.5
2026-06-18 06:12:47 +03:00
Sergey B Kirpichev d742930573 Implement direct series for lerchphi() base case with |z| < 1
Closes #1099
2026-06-18 05:55:12 +03:00
Sergey B Kirpichev 9b71ea0595 Merge pull request #1102 from skirpichev/misc
Misc fixes
2026-06-18 05:34:42 +03:00
Sergey B Kirpichev f736ab6096 Drop _jacobi_theta2a/3a() 2026-06-17 12:18:28 +03:00