2431 Commits

Author SHA1 Message Date
Sergey B Kirpichev 5fa2b9c793 Merge pull request #1160 from skirpichev/misc
Misc fixes
2026-08-22 03:23:58 +03:00
Sergey B Kirpichev d3812b1194 Amend bc96a889 2026-08-21 08:25:46 +03:00
Sergey B Kirpichev d8c4597a7d Merge pull request #1159 from skirpichev/misc
v1.5.0a1
1.5.0a1
2026-08-21 05:28:28 +03:00
Sergey B Kirpichev f3751eb87f Update CHANGES 2026-08-21 05:15:07 +03:00
Sergey B Kirpichev bcc67d3e55 Enable cancel-in-progress in CI 2026-08-21 04:37:44 +03:00
Sergey B Kirpichev 27a1fe7f6d Merge pull request #1115 from skirpichev/shortest-repr/1028
Use shortest decimal representations for str/repr
2026-08-21 04:34:47 +03:00
Ayush Baranwal ffcaef924a Add fft()/invfft() functions for DFT calculation (#1152)
Addresses #707

Implements the Radix-2 Cooley-Tukey Fast Fourier Transform (FFT) algorithm to
compute the discrete fourier transform and inverse discrete fourier transform of a signal.

Inputs are currently restricted to lengths of powers of 2.
2026-08-21 04:23:58 +03:00
Sergey B Kirpichev bc96a88926 Apply naive algorithm for huge exponents 2026-08-21 04:14:33 +03:00
Sergey B Kirpichev 0d2af59d5d Speedup exponent computation 2026-08-20 12:46:40 +03:00
Sergey B Kirpichev 70b722800f Use shortest decimal representations for str/repr
Was:
```
$ python -m mpmath
>>> 0.1
0.10000000000000001
```

Now:
```
$ python -m mpmath --shortest-str
>>> 0.1
0.1
```

Closes #1028
2026-08-20 12:46:40 +03:00
Sergey B Kirpichev d271b8312a Merge pull request #1157 from HeskethGD/omega-period-optimize-pr
Optimize conversion from Weierstrass invariants to half-periods
2026-08-19 04:31:41 +03:00
HeskethGD 49c7eeb43c Normalize Weierstrass parameter conversions 2026-08-16 16:01:54 +03:00
Sergey B Kirpichev bf6459d6be Merge pull request #1155 from userfypp/codex/fix-cplot-points-379
Fix cplot points rounding (#379)
2026-08-16 02:30:58 +03:00
HeskethGD f72b86ca17 Optimize Weierstrass period conversion 2026-08-15 20:09:07 +03:00
alexfyp 0abd5de3f0 Fix cplot points rounding (#379) 2026-08-11 15:10:35 +02:00
Sergey B Kirpichev 017cc473fb Merge pull request #1154 from skirpichev/document-pretty_dps
Document pretty_dps context's option
2026-08-06 06:32:14 +03:00
Sergey B Kirpichev bfaf6a7a31 Merge pull request #1153 from skirpichev/use-n-rounding-in-repr/1129
Use round_nearest in repr/str and as default mpf's rounding mode
2026-08-06 06:31:37 +03:00
Sergey B Kirpichev 24538751aa Document pretty_dps context's option
This amends a14901da.
2026-08-06 05:07:36 +03:00
Sergey B Kirpichev 4a3af8ef2b Use round_nearest in repr/str and as default mpf's rounding mode
Better alternative to #1137 (which was partially reverted).

Closes #1129
2026-08-05 09:47:43 +03:00
Sergey B Kirpichev e5142170db Merge pull request #1127 from skirpichev/use-explicit-kwargs/1056
Use explicit kwargs in public API, where possible
2026-08-05 04:32:15 +03:00
Sergey B Kirpichev fb69943530 Use explicit kwargs in public API, where possible
Following functions kept:
```pycon
>>> import inspect
... with_args = []
... with_kwargs = []
... for n in dir(mpmath):
...     m = getattr(mpmath, n)
...     try:
...         s = inspect.signature(m)
...     except:
...         continue
...     if any(_.kind == inspect._ParameterKind.VAR_POSITIONAL for _ in s.parameters.values()):
...         for name in s.parameters:
...             if s.parameters[name].kind == inspect._ParameterKind.VAR_POSITIONAL and name == 'args':
...                 with_args.append(n)
...                 break
...     if any(_.kind == inspect._ParameterKind.VAR_KEYWORD for _ in s.parameters.values()):
...         with_kwargs.append(n)
... print(with_args)
... print(with_kwargs)
...
['arange', 'ellipe', 'ellippi', 'linspace', 'matrix', 'ones', 'timing', 'zeros']
['multiplicity', 'timing']
```

We need support for multiple signatures in the first case.  In the
second - it's impossible to implement these functions without kwargs.

Closes #1056
2026-08-04 06:40:53 +03:00
Sanjay Santhanam c90e242741 Avoid spurious overflow in fp gammaprod (#1150)
* Avoid spurious overflow in fp gammaprod

fp.binomial(1100, 1) raised OverflowError even though the result is
exactly 1100: gammaprod multiplies the individual gamma values, and
gamma(1101) exceeds the double range although the quotient does not.

Fall back to evaluating the regular numerator/denominator in log space
when a term overflows, so the quotient is computed whenever it is
representable. Genuinely out-of-range results, such as
fp.binomial(1100, 550), still raise OverflowError.

Closes #493
2026-08-03 07:09:31 +03:00
Sergey B Kirpichev 255d98ff98 Merge pull request #1151 from mpmath/dependabot/github_actions/actions-deps-696b649f44
Bump actions/setup-python from 6 to 7 in the actions-deps group
2026-08-02 03:08:49 +03:00
dependabot[bot] da14fb3a42 Bump actions/setup-python from 6 to 7 in the actions-deps group
Bumps the actions-deps group with 1 update: [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/setup-python` from 6 to 7
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-python
  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-08-01 22:55:26 +00:00
catalin-hanga 4f58dcd947 Added 2 new expceptions to Rosser's Rule (#1148)
closes #1147
2026-07-31 11:21:22 +03:00
Sergey B Kirpichev 3e73240699 Merge pull request #1146 from HeskethGD/g2-g3-omega-from
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
test / frozen-version (push) Has been cancelled
Publish on PyPI / Publish distributions to PyPI (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
Standardise Weierstrass from param functions
2026-07-27 03:54:00 +03:00
Sergey B Kirpichev 460c289f90 Update repo link (git -> https)
Publish on PyPI / Build distributions (push) Has been cancelled
test / frozen-version (push) Has been cancelled
Publish on PyPI / Publish distributions to PyPI (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 / coverage (push) Failing after 1s
test / docs (push) Failing after 0s
test / linter (push) Failing after 1s
test / tests (true, 3.x) (push) Has been cancelled
Closes #1145
2026-07-26 03:07:07 +03:00
HeskethGD 1f3e9bf593 Rename Weierstrass parameter converters 2026-07-25 17:32:21 +01:00
HeskethGD 534dd479f0 Expand Weierstrass parameter conversions 2026-07-25 17:32:06 +01:00
Sergey B Kirpichev 3481440ce5 Merge pull request #1141 from HeskethGD/simplified-omega
test / coverage (push) Failing after 0s
test / docs (push) Failing after 0s
test / linter (push) Failing after 1s
Publish on PyPI / Build distributions (push) Has been cancelled
test / frozen-version (push) Has been cancelled
Publish on PyPI / Publish distributions to PyPI (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
Simplify and standardise weierhalfperiods
2026-07-25 06:04:39 +03:00
Sergey B Kirpichev 28e36ca652 Merge pull request #1144 from skirpichev/ulp
test / linter (push) Failing after 0s
test / coverage (push) Failing after 0s
test / docs (push) Failing after 1s
Publish on PyPI / Build distributions (push) Has been cancelled
test / frozen-version (push) Has been cancelled
test / tests (true, 3.x) (push) Has been cancelled
Publish on PyPI / Publish distributions to PyPI (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.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.15t) (push) Has been cancelled
test / tests (true, pypy3.11) (push) Has been cancelled
Add ulp(), see #1009
2026-07-24 13:37:18 +03:00
Sergey B Kirpichev b9fd43cc42 Add ulp(), see #1009 2026-07-24 01:31:54 +03:00
Sergey B Kirpichev 8d0190ad6d Merge pull request #1143 from skirpichev/fix-1142
test / docs (push) Failing after 0s
test / coverage (push) Failing after 0s
test / linter (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 / 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 / frozen-version (push) Has been cancelled
test / tests (true, 3.x) (push) Has been cancelled
Correct definitions for spherical Bessel functions
2026-07-23 04:04:44 +03:00
Sergey B Kirpichev afdb228884 Correct definitions for spherical Bessel functions
Closes #1142
2026-07-23 03:24:33 +03:00
Vincent Gao 2de2d509ec Widen to_str's digit window so str/nstr rounds near-boundary values correctly (#1139)
to_str extracted only dps+10 digits, narrower than format_scientific and
format_fixed which cover the whole mantissa.  A value just above a decimal
boundary was then extracted as "...99999" one ULP low, so directed rounding
through str/nstr fell one ULP short of the 'e' format and the exact value.
Widen the base-10 window to match the sibling formatters.

Also fixed test for from_str(), coming from 30e8001e
2026-07-22 00:05:32 +03:00
HeskethGD 55aefa6f82 Simplified and standardised weierhalfperiods 2026-07-21 16:45:46 +01:00
Sergey B Kirpichev 7eb6f23063 Merge pull request #1138 from skirpichev/fix-1135
Use CoW pattern to manage constant_memo() cache
2026-07-19 15:06:33 +03:00
Sergey B Kirpichev 65dca57ca7 Use CoW pattern to manage constant_memo() cache
Closes #1135
2026-07-19 10:28:41 +03:00
Sergey B Kirpichev 6309ea0550 Merge pull request #1137 from skirpichev/fix-repr-roundtrip/1129
Use reversed rounding mode for repr
2026-07-19 07:16:33 +03:00
Sergey B Kirpichev d30d632c39 Use reversed rounding mode for repr
Closes #1129
2026-07-19 04:59:27 +03:00
Sergey B Kirpichev d8c9fd2ea3 Refactor round_digits()
* add exponent argument
* pass original number
* make inexact flag local
2026-07-19 04:07:42 +03:00
Vincent Gao 101a8379a8 Fix last-digit rounding of the "f" format type (#1132)
format_fixed() extracts a handful of guard digits and lets round_digits()
decide, so a nonzero remainder lying past them was invisible: directed and
nearest rounding truncated the last digit instead of rounding it up.  The
value is dyadic, so its exactness at the extracted digits is decidable;
pass that as a inexact flag and round on it.  The "e" path and MPFR already
round these correctly.

Values whose leading digit falls past the last requested place skipped
round_digits() altogether and always printed zeros, even under rounding
away from zero; round them to one unit in the last place in that case.

Closes #1131

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-07-18 07:33:23 +03:00
Sergey B Kirpichev ead1a61d09 Merge pull request #1134 from skirpichev/fix-1130
Better document None return value of the pslq()
2026-07-16 10:25:38 +03:00
Sergey B Kirpichev 9e85fabc1d Better document None return value of the pslq()
Closes #1130
2026-07-16 09:15:25 +03:00
Sergey B Kirpichev 6d356df80f Merge pull request #1117 from HeskethGD/enhance-kleinj-tau
Add kleinjinv and support g and omega in taufrom
2026-07-13 20:41:50 +03:00
HeskethGD b747a30db1 Support Weierstrass data in elliptic parameter helpers 2026-07-13 16:11:02 +01:00
HeskethGD 6f2a553551 Add inverse Klein j-function 2026-07-13 16:08:46 +01:00
Sergey B Kirpichev 52c1546a0c Merge pull request #1124 from skirpichev/explicit-kwargs-for-libmp-funcs
Change signature for wrapped libmp's functions
2026-07-11 09:30:56 +03:00
Sergey B Kirpichev 573549a39f Merge pull request #1126 from skirpichev/fix-docs-ci
Fix docs CI job
2026-07-11 09:26:26 +03:00
Sergey B Kirpichev ed63e50a8a Fix weierp/weierpinv() docstrings
Closes #1125
2026-07-11 09:18:32 +03:00