Sergey B Kirpichev
b9fd43cc42
Add ulp(), see #1009
2026-07-24 01:31:54 +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
893bb431aa
Merge pull request #1057 from skirpichev/drop-deprecated1
...
Remove deprecated behavior
2026-03-07 04:18:42 +03:00
Sergey B Kirpichev
6665df00dd
Correct fp._convert_param() to properly handle real and complex types
...
Remember, that the gmpy2 backend returns mpfr and mpc types
for mixed-mode arithmetics, when one operand is mpz or mpq.
Examples:
>>> mpz(1) + 0.1
mpfr('1.1000000000000001')
>>> mpz(1) + 1j
mpc('1.0+1.0j')
Also, mpfr type returned for true division of mpz's.
2026-03-06 05:58:10 +03:00
Sergey B Kirpichev
485fe73586
Drop deprecated fp.is_special()
2026-03-04 07:28:49 +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
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
c2b811b8f9
Merge pull request #902 from skirpichev/hypsum-poly/511
...
Special case in ctx.hypsum for infinite z
2025-01-21 05:57:12 +03:00
Sergey B Kirpichev
4a881c9f31
Special case in ctx.hypsum for infinite z
...
Closes #511
2025-01-19 15:25:29 +03:00
Sergey B Kirpichev
b9ac31f5cd
Better introspection support for decorated functions
...
Closes #899
2025-01-19 07:33:28 +03:00
Sergey B Kirpichev
2c3f4f2cd3
Add fp.hypot
...
This partially address issue #355
2024-04-30 07:11:34 +03:00
Sergey B Kirpichev
1111002895
Move fp.loggamma from __init__()
2024-03-25 16:19:26 +03:00
Sergey B Kirpichev
d3c642816a
Set fp.prec/dps from sys.float_info
2024-03-25 16:19:23 +03:00
Sergey B Kirpichev
fd04402466
Support asinh/acosh/atanh in the fp context
2024-02-01 05:08:22 +03:00
Sergey B Kirpichev
6c98d697f6
Correct fp.gamma and fp.isnpint
...
Closes #521
2023-12-01 07:13:29 +03:00
Sergey B Kirpichev
2738563ae4
Guard "fast case" in _hyp2f1() to omit infinite z
...
Closes #469
2023-12-01 07:13:29 +03:00
Sergey B Kirpichev
21f791e4b6
Add `plus` flag to select the B_1 sign convention for bernoulli/bernfrac
2023-10-07 09:45:21 +03:00
Sergey B Kirpichev
005da6a704
Use functools.lru_cache for fp.bernoulli
2023-10-07 09:45:21 +03:00
Sergey B Kirpichev
f240905dde
Rename mpmath/math2.py -> mpmath/libfp.py
...
Closes #211
2023-05-19 17:28:14 +03:00
Sergey B Kirpichev
6bd28250fd
Change FPContext to use more functions from the stdlib
...
* use math.erf, math.erfc, math.gamma
* use math.atan2
* use cmath.phase for fp.arg
* reorganize input handling in e1() and ei()
* remove unused code in math2.py
* use constants, e.g. math.inf or math.nan
* move most constants to the mpmath/ctx_fp.py
2023-05-19 17:27:17 +03:00
Sergey B Kirpichev
0efdfeb7cd
Drop ctx._mpq
2023-05-19 07:03:11 +03:00
Sergey B Kirpichev
721e2571eb
Drop private mpq class, use Rational's provided by backend
2023-05-19 07:03:11 +03:00
Sergey B Kirpichev
3414c6ec51
Fix flake8 F401 in ctx_*.py (not for imports for mpf_binary_op)
2023-05-18 08:29:53 +03:00
Sergey B Kirpichev
154e67bada
Correct fp.mag(nan): return nan like mp.mag()
2023-04-21 14:50:27 +03:00
Fangchen Li
dfc289289d
Drop py2 support ( #629 )
...
* remove xrange compat shim
* remove str compat shim
* remove exec compat shim
* remove object from class defination
* remove misc workarounds for python versions <3.5
* remove __future__ imports
* update readme
* Update setup.cfg
Closes #594
Co-authored-by: Fredrik Johansson <fredrik.johansson@gmail.com >
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com >
Co-authored-by: Colin B. Macdonald <cbm@m.fsf.org >
2023-03-30 04:50:18 +03:00
Fredrik Johansson
b8651c00f1
switch to using explicit relative imports (Python 2.4 compatibility henceforth abandoned)
2011-01-08 22:15:29 +00:00
Fredrik Johansson
27eab13de6
convert line endings in trunk to unix format; rebuild docs
2010-07-28 20:09:06 +00:00
Fredrik Johansson
4c43025026
add missing fp.glaisher
2010-07-05 07:39:39 +00:00
Fredrik Johansson
1d987b3d2b
substantially rewrite lambertw(), particularly improving accuracy and branch selection near the singularity at -1/e and near the branch cuts
2010-06-15 20:15:41 +00:00
Fredrik Johansson
24ef677de7
Upgrade interval arithmetic.
...
* Move everything interval to a separate context (e.g. iv.exp must be used instead of mp.exp)
* Support both real and complex intervals (iv.mpf, iv.mpc)
* Fix interval cos/sin, and remove the old mpf_cos_sin code it depended on. The new interval cos/sin is a bit slower at low precision now, but this can be fixed.
* Implement interval atan2, and exp/log/power for complex intervals
* Move interval<->string code to libmpi
* Some other interface changes
More tests are still needed, and interface/utility functions needs more work.
2010-04-14 15:12:10 +00:00
Fredrik Johansson
064a692813
support conjugation in fdot
2010-02-13 17:12:36 +00:00
Fredrik Johansson
74bb5db556
New gamma function implementation (using Stirling's series and Taylor series instead of Spouge's approximation); including direct support for loggamma and rgamma (reciprocal gamma function). Including also a large set of extra stress tests for gamma.
2010-02-11 22:07:04 +00:00
Fredrik Johansson
e2157a5a3d
copy existing docstring by default
2010-02-06 19:12:49 +00:00
Fredrik Johansson
09a3e1cd21
consistent line endings
2010-02-04 14:43:01 +00:00
Fredrik Johansson
c5d1125530
Reorganization to support the improved Cython backend in Sage. A number of internal methods have been renamed in the process. The patch also contains some other optimizations.
2010-02-03 00:56:42 +00:00
Fredrik Johansson
c7f48602f9
faster implementation of fp.zeta for real arguments; eliminate overhead for fast cases in zeta by trying to call _zeta directly; use zeta to compute altzeta in the general case
2010-01-24 22:53:13 +00:00
Fredrik Johansson
80685a4e0d
faster and more accurate fp versions of ei and e1 (affecting also li, ci, si, ...)
2010-01-22 16:24:56 +00:00
Fredrik Johansson
de403a0b3c
improve ci,si,chi,shi for complex arguments by computing them using ei; make ci,si,chi,shi,ei,e1,li work with fp. TODO: implement ei in math2
2010-01-22 12:37:21 +00:00
Fredrik Johansson
b3bc19141c
Fix compatibility with python 2.4 and python 2.5. Most importantly: to support the fp context, the .real and .imag attributes cannot be used except where the type is guaranteed to be complex
2010-01-21 20:27:22 +00:00
Fredrik Johansson
6d1714585c
implemented numerical evaluation of Euler polynomials (eulerpoly) and Euler numbers (eulernum); optimized bernpoly and using accurate summation for eulerpoly and bernpoly; tweaks to sum_accurately
2010-01-20 19:16:48 +00:00
Fredrik Johansson
bdd981fb7e
fix a few fp functions; add fast real fp.erf and fp.erfc; create initial set of tests of fp functions
2010-01-20 12:57:38 +00:00
Fredrik Johansson
ae83f2a42b
optimized zetasum for complex arguments
2010-01-19 12:58:02 +00:00
Fredrik Johansson
889eb7c4a7
unified zeta() and hurwitz(); the implementation now chooses between the Borwein, Euler-Maclaurin, and Riemann-Siegel methods
2010-01-17 18:31:25 +00:00
Fredrik Johansson
947e5c3c3e
a few bugfixes for fp.harmonic and fp.digamma; deprecating psi0, psi1 and related function aliases
2010-01-17 17:19:44 +00:00
Fredrik Johansson
855f62b4c7
provide phase(), polar(), rect() for compatibility with the Python 2.6 cmath module; restore some accidentally deleted docstrings; slightly more sane way to define function aliases
2010-01-15 21:13:56 +00:00
Fredrik Johansson
60394880eb
improved fp floor, ceil, cospi, sinpi versions
2010-01-14 08:13:45 +00:00
Fredrik Johansson
1441b1eb44
fix a bug in powm, and some more small fp additions
2010-01-14 06:07:39 +00:00
Fredrik Johansson
a9f24f729c
small fixes for fp matrix functions
2010-01-13 06:37:41 +00:00
Fredrik Johansson
944d7d5ce0
fix some more fp breakage
2010-01-12 20:43:57 +00:00
Fredrik Johansson
2413d1a18b
moving modules to subdirectories: mpmath/libmp, mpmath/calculus, mpmath/functions
2010-01-12 18:19:42 +00:00