|Original author(s)||Travis Oliphant|
|Stable release||1.7.0 / February 9, 2013|
NumPy is an extension to the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large library of high-level mathematical functions to operate on these arrays. The ancestor of NumPy, Numeric, was originally created by Jim Hugunin with contributions from several other developers. In 2005, Travis Oliphant created NumPy by incorporating features of Numarray into Numeric with extensive modifications. NumPy is open source and has many contributors.
Because Python is currently implemented as an interpreter, mathematical algorithms written in it often run slower than compiled equivalents. Numpy seeks to address this problem for numerical algorithms by providing multidimensional arrays and functions and operators that operate efficiently on arrays. Thus any algorithm that can be expressed primarily as operations on arrays and matrices can run almost as quickly as the equivalent C code.
Using NumPy in Python gives functionality comparable to MATLAB since they are both interpreted, and they both allow the user to write fast programs as long as most operations work on arrays or matrices instead of scalars. In comparison, MATLAB boasts a large number of additional toolboxes, notably Simulink; whereas NumPy is intrinsically integrated with Python, a more modern, complete, and open source programming language. Moreover complementary Python packages are available; SciPy is a library that adds more MATLAB-like functionality and Matplotlib is a plotting package that provides MATLAB-like plotting functionality. Internally, both MATLAB and NumPy rely on LAPACK for efficient linear algebra computations.
The following is a simple example of how to do interactive array manipulations and plot a graph with NumPy and Matplotlib.
>>> import numpy >>> from matplotlib import pyplot >>> x = numpy.linspace(0, 2 * numpy.pi, 100) >>> y = numpy.sin(x) >>> pyplot.plot(x, y) >>> pyplot.show()
NumPy is based on two earlier Python array packages. The original one, Numeric, which is reasonably complete and stable, remains available, but is now obsolete. It was originally written in 1995 largely by Jim Hugunin with the help of many people including Jim Fulton, David Ascher, Paul DuBois, and Konrad Hinsen. A newer implementation, Numarray, is a complete rewrite of Numeric but is also deprecated. NumPy is a merge between the two that builds on the code base of Numeric and adds the features of Numarray.
There was a desire to get Numeric into the Python standard library, but Guido van Rossum (the author of Python) was quite clear that the code was not maintainable in its state then. Another problem was that for large arrays Numeric is very slow. As a result, another package called Numarray was created. Numarray is faster for large arrays, but slower for small arrays. For a time both Numeric and Numarray were used, both with different ways to accomplish similar goals. The last version of Numeric v24.2 was released on 11 November 2005 and numarray v1.5.2 was released on 24 August 2006.
In early 2005, Travis Oliphant wanted to unify the community around a single array package. The Numeric code was adapted to make it more maintainable and flexible enough to implement the novel features of Numarray. This new project was part of SciPy. To avoid installing a whole package just to get an array object, this new package was separated and called NumPy. While the source code is freely available and it contains significant documentation, there is also an extensive official Guide to NumPy. The documentation is built around a unified docstring standard.
The release version 1.5.1 of NumPy is compatible with Python versions 2.4–2.7 and 3.1–3.2. Support for Python 3 was added in 1.5.0. In 2011, PyPy started development on an implementation of the numpy API for PyPy.
There are several videos recorded in the seminars and the conferences. These videos may help beginners learn how NumPy works. 2009 SciPy meeting had several sessions on SciPy and NumPy.
- "SciPy PerformancePython". Retrieved 2006-06-25.
- Paul was lead developer for Numerical Python, Paul F. Dubois' web page
- "Numarray Homepage". Retrieved 2006-06-24.
- "NumPy Sourceforge Files". Retrieved 2008-03-24.
- Oliphant, Travis E. (2006-12-07). Guide to NumPy (PDF).
- "NumPy Docstring Standard". Retrieved 2009-11-01.[dead link]
- "NumPy 1.5.0 Release Notes". Retrieved 2011-04-29.
- "PyPy Status Blog: Numpy funding and status update". Retrieved 2011-12-22.
- "8th Annual Python in Science Conference". Retrieved 2009-10-04.
- Bressert, Eli (2012). Scipy and Numpy: An Overview for Developers. O'Reilly Media. ISBN 978-1-4493-0546-8.