--0.12-- Released June 9, 2009 General * It is now possible to create multiple context objects and use context-local methods instead of global state/functions (e.g. mp2=mp.clone(); mp2.dps=50; mp2.cos(3)). Not all functions have been converted to context methods, and there are some bugs, so this feature is currently experimental. * If mpmath is installed in Sage 4.0 or later, mpmath will now use sage.Integer instead of Python long internally. * Removed instances of old-style integer division from the codebase. * runtests.py can be run with -coverage to generate coverage statistics. Types and basic arithmetic * Fixed comparison with -inf. * Changed repr format of the mpi interval type to make eval(repr(x)) == x. * Improved printing of intervals, with configurable output format (contributed by Vinzent Steinberg based on code by Don Peterson). * Intervals supported by mpmathify() and nstr() (contributed by Vinzent Steinberg). * mpc is now hashable. * Added more formatting options to the internal function to_str. * Faster pure-Python square root. * Fix trailing whitespace giving wrong values in str->mpf conversion. Calculus * Fixed nsum() with Euler-Maclaurin summation which would previously ignore the starting index and sum from n=1. * Implemented Newton's method for findroot() (contributed by Vinzent Steinberg). Linear algebra * Fixed LU_decomp() to recognize singular matrices (contributed by Jorn Baayen). * The various norm functions were replaced by the generic vector norm function norm(x,p) and the generic matrix norm function mnorm(x,p). Special functions: * Some internal caches were changed to always slightly overallocate precision. This fixes worst-case behavior where previously the cached value had to be recomputed on every function call. * Fixed log(tiny number) returning nonsense at high precision. * Fixed gamma() and derivative functions such as binomial() returning wrong results at integer inputs being divisible by a large power of 2. * Fixed asin() not to raise an exception at high precision (contributed by Vinzent Steinberg). * Optimized the AGM code for the natural logarithm, making the previously used Newton method at intermediate precisions obsolete. * The arithmetic-geometric mean function agm() is now an order of magnitude faster at low precision. * Faster implementations of ellipk() and ellipe(). * Analytic continuation of ellipe() to |x| >= 1 implemented. * Implemented the log gamma function (loggamma()) with correct branch cuts (slow, placeholder implementation). * Fixed branch cuts of hyperfac(). * Implemented the Riemann-Siegel Z-function (siegelz()). * Implemented the Riemann-Siegel theta function (siegeltheta()). * Implemented calculation of Gram points (grampoint()). * Implemented calculation of Riemann zeta function zeros (zetazero()). * Implemented the prime counting function: a slow, exact version (primepi()). and a fast approximate version (primepi2()) that gives a bounding interval. * Implemented the Riemann R prime counting function (riemannr()). * Implemented Bell numbers and polynomials (bell()). * Implemented the expm1() function. * Implemented the 'polyexponential function' (polyexp()). * Implemented the twin prime constant (twinprime) and Mertens' constant (mertens). * Implemented the prime zeta function (primezeta()). --0.11-- Released January 26, 2009 General: * Most of the documentation is now generated from docstrings using Sphinx' autodoc feature, and proper LaTeX is used for mathematical formulas. A large amount of new documentation has been written. * Improved gmpy backend. Using gmpy-1.04 gives a ~30% unit tests speedup over 1.03, with speedups in the range of 2-3x for specific operations (contributed by Case van Horsen and Mario Pernici). * Mpmath imports slightly faster due to not trying to load the 'random' library Numerical calculus, etc: * Implemented a fast high-precision ODE solver (to replace the slow and low-accuracy RK4 algorithm) (odefun()) * Created an intelligent function nsum() to replace sumrich/sumsh * Implemented nprod() for computing infinite products * Rewrote limit() to use the same adaptive extrapolation algorithm as nsum() * Multidimensional nonlinear solving with Newton's method implemented in findroot() (contributed by Vinzent Steinberg) * Simplified the implementation and interface of sumem() * Reimplemented Shanks transformation for nsum using Wynn's epsilon algorithm (shanks()) * Reimplemented Richardson extrapolation slightly more simply and efficiently (richardson()) * Prevent shanks() from exiting prematurely by adding random noise to zeros * Removed the obsolete secant() function (see findroot()) * Implemented high-order derivatives (diff(), diffs()) * Implemented calculation of Taylor series (taylor()) * Implemented calculation of Fourier series (fourier(), fourierval()) * Implemented Pade approximation (pade()) (contributed by Mario Pernici) * Better cancel condition for findroot() (contributed by Vinzent Steinberg) * Some refactoring of numerical integration code * Fix erroneous nodes for 0-th order Gauss-Legendre quadrature, which was causing unnecessary slowness * Quadrature nodes are cached for arbitrary intervals, giving a 30% speedup for repeated integrations * Unified interface and added more options for identify(), pslq(), findpoly() New special functions: * Implemented polylogarithms (polylog()) * Implemented Bernoulli polynomials (bernpoly()) * Implemented the Barnes G-function (barnesg()) * Implemented double factorials (fac2()) * Implemented superfactorials (superfac()) * Implemented hyperfactorials (hyperfac()) * Replaced lower_gamma and upper_gamma with a more versatile function gammainc() for computing the generalized (and optionally regularized) incomplete gamma function * Implemented sinc() and sincpi() * Implemented Fibonacci numbers (fib()) * Implemented the Dirichlet eta function (altzeta()) * Implemented the inverse error function (erfinv()) * Jacobi theta functions and elliptic functions were essentially rewritten from scratch, making them much faster and more general. Renamed Jacobi theta functions: jacobi_theta -> jtheta, etc. (contributed by Mario Pernici) * Implemented derivatives of jtheta (djtheta) (contributed by Mario Pernici) * Implemented Bessel Y, I, K functions (bessely, besseli, besselk; Bessel J functions were also renamed to besselj) also renamed) * Generalized Stieltjes constants can now be computed, with stieltjes(n,a) * Implemented Hankel functions (hankel1, hankel2) Speed improvements and bugfixes to special functions: * Fast logarithm at very high precision using the formula by Sasaki and Kanada (contributed by Mario Pernici) * Slightly faster logarithm at low precision (contributed by Mario Pernici) * Faster exponential function at high precision, using Newton's method (contributed by Mario Pernici) * Faster computation of ln2 and ln10 by means of binary splitting (contributed by Mario Pernici) * Fixed accuracy problems in sinpi() and cospi() * Correct evaluation of beta() at limits * Much faster evaluation of stieltjes(n), using an improved integral formula * Fixed bernoulli() being inaccurate for large n and low precision, and being needlessly slow for small n and huge precision * Fixed accuracy of zeta(s) for large negative re(s) * Fixed accuracy problems for asinh, atanh and tanh * Fixed accuracy of airyai() for large x.real * Fixed bug in nthroot() for very large arguments (contributed by Mario Pernici) * Fixed accuracy of log(x) for complex |x| ~= 1 * Fixed accuracy of exp(n), n a huge integer and prec >= 600 * Slightly faster hypergeometric functions with rational parameters (contributed by Mario Pernici) * Faster and more accurate calculation of ci(x), si(x) * Faster and more accurate calculation of ei(x) for large x, using an asymptotic expansion (contributed by Mario Pernici) * Fixed accuracy bugs in theta functions (contributed by Mario Pernici) * The Lambert W function returns more appropriate values at infinities Arithmetic and basic interface: * Square roots are now rounded correctly * Made float(huge) -> inf and float(1/huge) -> 0 instead of raising OverflowError * Renamed convert_lossless -> mpmathify * mpmathify() accepts strings representing fractions or complex numbers (contributed by Vinzent Steinberg) * Fixed a bug in interval multiplication giving wrong signs * Added monitor() to monitor function evaluation * Implemented a chop() utility function for deletion of numerical noise * Added re(), im(), conj(), fabs(), mpf.conjugate() * Fixed the != operator for intervals * Added functions fsum, fprod, fdot for efficient computation of sums, products and dot products of lists of mpf:s or mpc:s Matrices: * Generation of Hilbert matrices (hilbert()) (contributed by Vinzent Steinberg) * Added lu_solve_mat() to solve a*x=b where a and b are matrices (contributed by Mario Pernici) * Implemented computation of matrix exponentials (exp_pade()) (contributed by Mario Pernici) * Prettier repr of complex matrices (contributed by Vinzent Steinberg) * Speedups by using fdot and fsum (contributed by Vinzent Steinberg) --0.10-- Released October 15, 2008 Interface / general: * Mpmath now works with Python 2.6 * Implemented function plotting via 'plot' and 'cplot' (requires matplotlib) * Removed global rounding mode (always rounding to nearest by default) * Instead added 'prec', 'dps', 'rounding' keyword arguments to standard functions, for optional fine-grained control over precision and rounding * Implemented isinf, isnan, isint, utility functions * A large number of internal functions were moved and/or renamed to improve consistency. This particularly affects low-level mpf functions (lib.fadd -> libmpf.mpf_add, etc). * Syntax for some operations was changed (see details below) * The test runner (runtests.py) was updated to support running isolated tests and to allow a local import of mpmath * Unit tests can now be run with import mpmath; mpmath.runtests() * Implicit imports are no longer used internally in the main codebase. (This will hopefully make the source easier to read, and can catch installation problems more cleanly.) Added linear algebra functions (contributed by Vinzent Steinberg): * Provided a matrix class * Computation of powers, inverses, determinants * Linear system solving using LU, QR and Cholesky * Vector and matrix norms * Calculation of condition numbers Improvements to interval arithmetic: * Fixed rounding direction for negative numbers and related spurious bugs * Fix interval exponentiation (all cases should work now) * Basic interval arithmetic is up to 10x faster * sqrt, exp, log, sin, cos and a few other functions accept interval arguments * Intervals supported in matrices Changes to root-finding code: * secant renamed to findroot * findroot was made more general; many useful alternative root-finding algorithms were implemented (contributed by Vinzent Steinberg) Improvements to special functions: * Implemented polygamma functions * Implemented harmonic numbers * Implemented Stieltjes constants * Made gamma more accurate for huge arguments and/or precision * Made zeta more accurate in various cases * Made zeta typically 2-5x faster * Much more efficient computation of zeta for huge s (zeta(s) ~= 1) * Optimized numerical calculation of Bernoulli numbers * Fast exact calculation of huge Bernoulli numbers via zeta and the von Staudt-Clausen theorem * Using AGM to compute ellipk, which is much faster and works in the entire complex plane * Allow single-argument form agm(x) = agm(1,x) * Faster and more accurate computation of erf * Added fast and accurate implementation of erfc * Normal probability functions npdf, ncdf * Fixed directed rounding in corner cases for various functions Improvements to numerical integration: * Changed syntax for integration (quad(f, [a, b], options)) * Implemented Gauss-Legendre quadrature * Direct support for triple integrals (quad(f, X, Y, Z)) * Interval can be a list of several points, to split integration into subintervals * Oscillatory quadrature uses Gauss-Legendre instead of tanh-sinh, since this is typically faster * Fixed minor rounding bug in tanh-sinh quadrature not giving complete symmetry in the nodes * Implemented quadrature rules in classes for improved extensibility Various speed improvements: * Up to 3x faster computation of log(x) at low precision, due to using Taylor series with argument reduction and partial caching * About 2x faster log(x) at very high precision due to more efficient computation of exp in the Newton iteration * Up to 10x faster computation of atan(x) at low to medium precision, due to using Taylor series with argument reduction and partial caching * Faster pickling due to using hex() instead of long() * Optimized code for Khinchin's constant (2.5x faster at 1000 digits) * Optimized code for Glaisher's constant (1.5x faster at 1000 digits) * Faster algorithm for Euler's constant (10x faster at 10000 digits) * Rewrote PSLQ to use fixed-point arithmetic, giving a ~7x speedup in pslq, findpoly and identify Miscellaneous bugfixes: * Fixed nthroot for n = -1, 0, 1 * Fixed inf/2**n and nan/2**n returning zero --0.9-- Released August 23, 2008 * gmpy mpzs are used instead of python ints when available, for huge speedups at high precision (contributed by Case Van Horsen) * using binary splitting to compute pi and e near-optimally * mpmath includes __version__ information * arange behaves more like range (contributed by Vinzent Steinberg) * asymptotically faster trigonometric functions via Brent's trick (contributed by Mario Pernici) * asymptotically faster inverse trigonometric functions via Newton's method (contributed by Mario Pernici) * added Jacobi elliptic functions 1-4, sn, cn, dn (contributed by Mike Taschuk) * polyval, polyroots and related functions now use the same order for coefficients as scipy and matlab (i.e. the reverse order of what was used previously in mpmath) * fixed polyroots for degree-0 polynomials (contributed by Nimish Telang) * added convenience functions (log10, degrees, radians, frexp, modf, ln, arg, sign) * added fast cbrt and nthroot functions for computing nth roots (contributed by (Mario Pernici) * added various exponential integrals (ei, li, si, ci, shi, chi, erfi) * added airy functions (airyai, airybi) * more __op__ and __rop__ methods return NotImplemented where appropriate * external classes can define a special method _mpmath_ to interact with mpmath numbers and functions * fixed some corner cases in atan2 * faster rand() --0.8-- Released April 20, 2008 New features: * the full set of reciprocal trigonometric and hyperbolic functions and their inverses (cotangent, secant, etc) is available * oscillatory quadrature algorithm * the PSLQ algorithm and constant recognition functions * Richardson and Shanks transformations for computing limits and series * Euler-Maclaurin summation of series * basic ODE solvers (contributed by Ondrej Certik) * the Lambert W function * arithmetic-geometric mean function * generic hypergeometric series and some special hypergeometric functions (elliptic integrals, orthogonal polynomials) * several more mathematical constants * fast sequential computation of integer logarithms and Bernoulli numbers * Bessel function jv works for complex arguments and noninteger v * support for trapping complex results * using Sphinx to generate HTML documentation Bugfixes, speed enhancements, and other improvements: * compatibility tests should now pass on systems where Python is compiled to use 80-bit registers for floating point operations * fixed mpmath to work with some versions of Python 2.4 where a list indexing bug is present in the Python core * better algorithms for various complex elementary functions (tan and tanh by Fredrik; sqrt, acos, asin, acosh and asinh improved by Mario Pernici) * multiplication and integer powers for complex numbers is faster and more accurate * miscellaneous speed improvements to complex arithmetic (contributed by Mario Pernici) * faster computation of cos and sin when only one of them is needed (contributed by Mario Pernici) * slightly faster square roots at low precision (contributed by Mario Pernici) * fixed computation of exp(n) for negative integers and x**y for negative half integers y * mpf ** complex now works * faster generation of quadrature nodes (contributed by Mario Pernici) * faster change of variables for quadrature * comparisons and conversions have been optimized slightly. comparisons with float(nan) also work as intended. * str() is several times faster at very high precision * implementations of most elementary functions moved to the lib and libmpc modules for cleaner separation of functionality * the rounding argument for lib and libmpc functions, and for some functions also the the prec argument, are now optional, resulting in cleaner and slightly faster lib code * gamma and factorial are about 2x faster * polyroots returns nicer results * pickling now works for mpf and mpc instances --0.7-- Released March 12, 2008 * the interface for switching precision and rounding modes has been changed. instead of changing mpf.prec, there is a new object mp which holds the precision as mp.prec. this change improves flexibility in the implementation. it will unfortunately break any existing code written for mpmath, but the broken code should be trivial to update. * the functions workprec, workdps, extraprec, extradps have been introduced for switching precision in a more safe manner, ensuring that the precision gets reset when finished. they can be used with the 'with' statement available in python 2.5 * improved documentation (manual.html) * the round-half-down and round-half-up modes have been deprecated, since they added complexity without being particularly useful. round-half-even has been renamed to round-nearest. * implemented the functions nstr, nprint for printing numbers with a small or custom number of digits * accuracy of cos and sin near roots has been fixed. computing sin(x) or cos(x) where x is huge is also much faster * implemented a magical constant eps that gives the "machine" epsilon * additional mathematical functions: implemented Catalan's constant and Bessel functions J_n(x) for integer n and real x * new functions diff and diffc for numerical differentiation * implemented the ldexp function for fast multiplication by 2**n * mpf uses rich comparison methods (contributed by Pearu Peterson) * epydoc-friendly docstrings (contributed by Pearu Peterson) * support creating mpf from float nan or inf * fixed printing of complex numbers with negative imaginary part * flattened package structure to simplify inclusion of mpmath in other packages * external classes can interoperate with mpf and mpc instances by defining _mpf_ or _mpc_ properties * renamed lib.fpow -> lib.fpowi and implemented lib.fpow for general real powers. ** should now be slightly faster and more robust * the internal number representation has been changed to include an explicit sign bit. as a result of this change and other small tweaks, arithmetic is up to 20% faster and the total running time for mpmath's unit tests has dropped 10%. * miscellaneous speed improvements: * ** is 2-3 times faster (contributed by Mario Pernici) * * and * is roughly twice as fast * / is roughly twice as fast (contributed by Mario Pernici) * exp and log are about 10% faster * fast computation of e and exp(n) when precision is extremely high --0.6-- Released January 13, 2008 * added the mpi type for interval arithmetic * powers with integer exponents are computed with directed rounding all the way through to preserve interval bounds more robustly (however, the code is not fully tested and may have some bugs) * string input to mpf.__new__() can now be unicode * mpf.__eq__ now works in pypy * infs and nans are now implemented in mpmath.lib, resulting in considerable simplification of the mpf class implementation * partial support for infs and nans in functions, e.g. exp(inf) -> inf and exp(-inf) -> 0 now work. * renamed several files. created mpmath.apps and moved tests into the main mpmath directory * wrote script to permit running unit tests without py.test available * improved bit counting code in fadd, fmul and fdiv, plus other small performance tweaks, resulting in a 20-30% speedup for arithmetic --0.5-- Released November 24, 2007 * added the quad module for arbitrary-precision numerical integration * floor and ceil functions available * implemented __mod__ and __rmod__ for the mpf class * partial support for the special numbers +inf, -inf and nan * faster multiplication and division (up to 40% faster with psyco) * simplified syntax for conversion function (from_int instead of from_int_exact, etc) * renamed cgamma to euler * more documentation strings --0.4-- Released November 3, 2007 * new string conversion code (much faster; unlimited exponents) * fixed bug in factorial (it gave the wrong value, though gamma worked) * division now uses a rigorous algorithm for directed rounding (mpmath previously used a heuristic that got the last bit wrong in 1/10000 of cases) * misc. performance improvements (arithmetic is 15% faster) * refactored parts of the code; added many more docstrings and tests * added a function rand() for generating full-precision random numbers * rewrote the benchmark script to compare against Decimal and to automatically generate timings with psyco both disabled and enabled * rewrote unit tests to use py.test --0.3-- Released October 5, 2007 * fixed high-precision accuracy problem in complex sqrt * fixed high-precision accuracy problem in atan and complex log * fixed directed rounding for sqrt (always rounded to nearest) * implemented all hyperbolic and inverse functions (there are some accuracy issues left to sort out) * included gamma, factorial, erf, zeta incomplete gamma functions * made sin and tan more accurate for complex input very close to 0 * more docstrings * many more tests * including a benchmark script -- 0.2 -- Released October 2, 2007 * 50% faster exponential function * faster mpf <-> int ops * fixed import error in pidigits.py; added demos to source distribution * __rmul__ was missing on mpf * fixed bitcount bug also for -(2**n-1) * more docstrings * more tests; tests included in source distribution * approximate equality testing (.ae method) supported * implemented atan and atan2 functions * tan works for both mpfs and mpcs * complex logarithms and complex powers supported * more details in README -- 0.1 -- Released September 27, 2007 * imported code from SymPy's numerics module * renamed functions and restructured various parts of the code * fixed erroneous bitcount for 2**n-1 mantissa with directed rounding * various small speed improvements and bug fixes