218 Commits

Author SHA1 Message Date
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
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 b9fd43cc42 Add ulp(), see #1009 2026-07-24 01:31:54 +03:00
HeskethGD 6f2a553551 Add inverse Klein j-function 2026-07-13 16:08:46 +01:00
Warren Weckesser 8d21910bba Implement the modified spherical bessel functions spherical_in() and spherical_kn(). (#1121) 2026-07-08 04:13:53 +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
Tim M f98636edf6 Added Moore-Penrose pseudoinverse. (#1030) 2026-03-10 18:37:22 +03:00
Sergey B Kirpichev cd25f9b536 Drop deprecated rational module 2026-03-04 07:28:49 +03:00
Sergey B Kirpichev 8f3e715b1e Drop deprecated math2 module 2026-03-04 07:28:49 +03:00
Sergey B Kirpichev ed57d4034d Use version_file option of setuptools-scm to keep version info
Closes #1044
2026-02-28 14:06:47 +03:00
Sergey B Kirpichev 7cf16b7828 Revert "Add isspecial() method for mp/fp contexts, deprecate isnormal()"
This reverts commit e6aa3b46b1.

Subnormals are properly handled by fp.isnormal().  Deprecate
fp.is_special() method.

Fixes #946
2026-02-23 04:08:07 +03:00
Hongren Zheng 9ac078ca7c Add Fox H-function with rational A and B parameters (#982)
Closes #980
2025-07-27 19:03:23 +03:00
Sergey B Kirpichev e6aa3b46b1 Add isspecial() method for mp/fp contexts, deprecate isnormal()
Closes #946
2025-04-28 08:36:15 +03:00
Sergey B Kirpichev 4edff338a2 Add exp2() and log2()
Closes #947
2025-04-26 19:10:40 +03:00
Sergey B Kirpichev 5294dd9ddd Support spherical Bessel functions (jn/yn)
Naming scheme follows to SciPy.  Closes #319
2025-04-02 07:12:47 +03:00
Sergey B Kirpichev b62a2a9523 Add DeprecationWarning for mpmath.math2 2024-04-16 12:18:03 +03:00
Sergey B Kirpichev 59b57b08be Drop _MPMathModule from imports 2024-04-16 12:18:03 +03:00
Sergey B Kirpichev 6111ee9d12 Restore minimal compatibility wrapper for mpmath.rational.mpq
See sympy/sympy#26269 and sympy/sympy#26273
2024-04-16 12:16:35 +03:00
Sergey B Kirpichev 3ac151e385 Use a different workaround for pickling mpf/mpc 2024-02-29 07:46:43 +03:00
Sergey B Kirpichev 0ccc872827 Use setuptools_scm to update __version__ 2024-02-22 15:31:46 +03:00
Colin B. Macdonald b7ed1b82cd prevent erroneous setting of dps/prec on mpmath module (#678)
* Use sys.modules hacks to prevent setting dps/prec

Fixes Issue #657

---------

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com>
2024-01-05 14:36:00 +03:00
Sergey B Kirpichev 0806b14b21 Expose lower/upper_gamma functions
Closes #738
2023-12-01 07:12:36 +03:00
sonntagsgesicht 7b59bb8248 rank function (with tests)
update imports in test_linalg.py

custom `iszerofunc` in rank determination

adding rank of matrix via counting eigenvalues form svd_r
2023-06-02 08:20:56 +02:00
Sergey B Kirpichev 088e27eca1 Drop runtests.py and doctests() function
We use pytest for tests, it has everything that runtests.py has,
including support for profiling (pytest-profiling plugin).

So, let's drop this legacy stuff to avoid bugs like #579.
2023-04-30 08:53:44 +03:00
Sergey B Kirpichev ecc5cdc355 Update mpmath.__version__
Closes #682
2023-04-30 08:04:08 +03:00
Fredrik Johansson b5c04506ef version 1.3.0
test / build (2.7) (push) Has been cancelled
test / build (3.10) (push) Has been cancelled
test / build (3.11) (push) Has been cancelled
test / build (3.5) (push) Has been cancelled
test / build (3.6) (push) Has been cancelled
test / build (3.7) (push) Has been cancelled
test / build (3.8) (push) Has been cancelled
test / build (3.9) (push) Has been cancelled
test / build (pypy2.7) (push) Has been cancelled
test / build (pypy3.9) (push) Has been cancelled
2023-03-07 17:43:16 +01:00
Deyan Mihaylov 7cd161aef0 Add wrappers and fix documentation 2022-08-22 02:30:21 +02:00
Nike Dattani 26ed58a096 Added signal.txt with basic "template" including:
square wave, triangle wave, sawtooth wave as a function of amplitude and period, but with really just meant as a template (largely copied from bessel.txt) from which Tina can do her work.

Added the following to mpmath/__init__.py

squarew = mp.squarew
trianglew = mp.trianglew
sawtoothw = mp.sawtoothw
unit_triangle = mp.unit_triangle
sigmoidw = mp.sigmoidw

This block was added to the bottom of the list of functions which began with "sqrt = mp.sqrt" and went up to "stirling2 = mp.stirling2".
2022-08-19 00:51:37 +02:00
fredrik 7123a67a1d naive quadrature using adaptive subdivision 2021-02-26 13:05:54 +01:00
fredrik c6a35f9ee7 version 1.2.1
test / build (3.4) (push) Has been cancelled
test / build (3.5) (push) Has been cancelled
test / build (3.6) (push) Has been cancelled
test / build (3.7) (push) Has been cancelled
test / build (3.8) (push) Has been cancelled
test / build (3.9) (push) Has been cancelled
test / build (pypy2) (push) Has been cancelled
test / build (pypy3) (push) Has been cancelled
test / build (2.7) (push) Has been cancelled
test / build (3.10-dev) (push) Has been cancelled
2021-02-09 16:19:48 +01:00
fredrik d806af3a63 version 1.2.0
test / build (2.7) (push) Has been cancelled
test / build (3.10-dev) (push) Has been cancelled
test / build (3.4) (push) Has been cancelled
test / build (3.5) (push) Has been cancelled
test / build (3.6) (push) Has been cancelled
test / build (3.7) (push) Has been cancelled
test / build (3.8) (push) Has been cancelled
test / build (3.9) (push) Has been cancelled
test / build (pypy2) (push) Has been cancelled
test / build (pypy3) (push) Has been cancelled
2021-02-01 22:26:49 +01:00
fredrik b8ea24aa1f add eta() implementing the Dedekind eta function 2019-07-16 15:59:34 +02:00
AlexV 867d8784ce removing version retrieval via pkg_resources. static version string in code. 2019-03-08 13:56:09 +01:00
AlexV aef752d777 adding fallback value for version if distirbution not found by pkg_resources 2019-03-08 10:48:55 +01:00
Sergey B Kirpichev f7fa465603 Use setuptools_scm to track versions
Also drop testing on py3.3
2018-12-23 17:22:14 +03:00
fredrik 475527a7b5 version 1.1.0 2018-12-11 16:18:06 +01:00
fredrik 0a006fe83c implement log1p (issue #420) 2018-12-03 20:47:43 +01:00
Sergey B Kirpichev e6f3a56a41 Drop optional psyco deps (it's dead) 2018-09-24 19:48:03 +03:00
Fredrik Johansson 8e21a63872 version 1.0.0 2017-09-27 16:59:02 +02:00
Paul Masson c509dccf8d Remove duplicate assignment 2017-04-18 13:56:18 -07:00
klkuhlm f2513bd6cf removed Weeks 2016-12-23 13:03:56 -07:00
klkuhlm 13bc822cbe removed Piessens, trying reformulation to get Weeks working again 2016-12-23 13:02:37 -07:00
klkuhlm 64f29f5b14 removed weeks method which is still sub-optimal 2015-12-22 11:18:39 -07:00
klkuhlm 8d6bc50138 Merge remote-tracking branch 'upstream/master' 2015-12-21 13:08:25 -07:00
Fredrik Johansson 07a899a0b4 change version number to 0.20-git 2015-09-06 18:48:54 +02:00
Sergey B Kirpichev affc2ef6e1 PEP 8 fixes:
E101 - mix of tabs and spaces
 W191 - use of tabs
 W291 - trailing whitespace
 W293 - trailing whitespace
 E111 - 4 spaces per indentation level
 E112 - 4 spaces per indentation level
 E113 - 4 spaces per indentation level
 W292 - no newline at end of file
 W391 - blank line at end of file

see http://pep8.readthedocs.org/
2014-11-21 17:08:07 +03:00
klkuhlm d245e49ac1 merge with upstream 0.19 2014-07-11 09:00:25 -06:00
Fredrik Johansson 0ce89254e0 update docs and call this 0.19 2014-06-10 16:27:36 +02:00
Ondřej Čertík 89c636f5dc Normalize line endings 2014-04-14 12:49:26 -06:00