NumPy

From Wikipedia, the free encyclopedia

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. An early version of NumPy was originally created by Jim Hugunin but it is open source and has many contributors.

Contents

[edit] Motivation

Since Python is an interpreted language, mathematical algorithms often run much slower than they do in compiled languages like C or even Java. NumPy addresses this problem for many numerical algorithms by providing multidimensional arrays and lots of functions and operators that operate on arrays. Thus any algorithm that can be expressed primarily as operations on arrays and matrices can run almost as fast as the equivalent C code.[1]

Some see NumPy as a good free alternative to MATLAB, since MATLAB's programming language is similar in some superficial ways to NumPy: 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. MATLAB has the mathematical advantage in that it has many thousands of built-in mathematical functions and many more available as commercial products, while NumPy has the advantage that Python is a more modern and complete programming language, and it is also open source and free. SciPy is a library that adds more MATLAB-like functionality; Matplotlib is a plotting package that provides MATLAB-like plotting functionality

[edit] History of NumPy

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.[2] 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 father 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 November 11, 2005 and numarray v1.5.2 was released on August 24, 2006.[3]

In early 2005, Travis Oliphant wanted to reunify 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 a book for sale that gives complete information about the system. The book is entitled Guide to NumPy.[4] It is available for a fee, but will be made available for free at the SciPy conference in August 2008.

[edit] See also

[edit] References

  1. ^ SciPy PerformancePython. Retrieved on 2006-06-25.
  2. ^ Numarray Homepage. Retrieved on 2006-06-24.
  3. ^ NumPy Sourceforge Files. Retrieved on 2008-03-24.
  4. ^ Oliphant, Travis E. (December 7, 2006). Guide to NumPy. 

[edit] External links

Languages