NumPy

NumPy
NumPy logo
Developer(s) Community project
Initial release 1995 (1995)
Stable release 1.6 / May 14, 2011; 6 months ago (2011-05-14)
Operating system Cross-platform
Type Technical computing
License BSD-new license
Website numpy.scipy.org

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. NumPy is open source and has many contributors.

Contents

Motivation

Since the standard Python implementation is an interpreter, mathematical algorithms often run much more slowly than compiled equivalents, such as those written in C. 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 quickly as the equivalent C code.[1]

NumPy is a free alternative to MATLAB (PyLab) 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. One advantage of MATLAB is the large number of additional toolboxes that are available, including the Simulink packages. NumPy, on the other hand, has the advantage that Python is a more modern and complete programming language and is open source. Other complementary Python packages are available: SciPy is a library that adds more MATLAB-like functionality; Matplotlib is a plotting package that provides MATLAB-like plotting functionality. Internally, both MATLAB and NumPy rely on LAPACK for efficient linear algebra computations.

Example

The following is a simple example of how to do interactive array manipulations and plot a graph with NumPy and Matplotlib.

>>> from numpy import *
>>> from matplotlib.pyplot import *
>>> 
>>> x = linspace(0, 2*pi, 100)
>>> y = sin(x)
>>> plot(x, y) # call Matplotlib plotting function
>>> show()

History

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,[2] and Konrad Hinsen. A newer implementation, Numarray, is a complete rewrite of Numeric but is also deprecated.[3] 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.[4]

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 an extensive official Guide to NumPy.[5] The documentation is built around a unified docstring standard.[6]

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.[7]

Video Source

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.[8]

See also

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • NumPy — Тип расширение языка Python Разработчик Проект сообщества Операционная система Кроссплатформенное программное обеспечение Последняя версия 1.6.1 (20 июля 2011) …   Википедия

  • NumPy — Python Fichier:NumPy logo.png Système d exploitation Multiplate forme Site web www.numpy.org NumPy est une extension …   Wikipédia en Français

  • Numpy — An affectionately derogatory term, used to describe someone of slothful or slow demeanour. May also be used in the form of an adjective. Geoff (referring to Dean): What s Numpy up to today? Greg (referring to Dean): I dunno. Last time I checked… …   Dictionary of american slang

  • Numpy — An affectionately derogatory term, used to describe someone of slothful or slow demeanour. May also be used in the form of an adjective. Geoff (referring to Dean): What s Numpy up to today? Greg (referring to Dean): I dunno. Last time I checked… …   Dictionary of american slang

  • Eigenvalue algorithm — In linear algebra, one of the most important problems is designing efficient and stable algorithms for finding the eigenvalues of a matrix. These eigenvalue algorithms may also find eigenvectors. Contents 1 Characteristic polynomial 2 Power… …   Wikipedia

  • CUDA — Developer(s) Nvidia Corporation Stable release 4.0 / May 17 2011; 6 months ago (May 17 2011) Operating system Windows XP and later Mac OS X Linux …   Wikipedia

  • CUDA — Тип GPGPU Разработчик NVIDIA Corporation Операционная система Windows XP и выше, Mac OS X, Linux Аппаратная платформа …   Википедия

  • Sage — У этого термина существуют и другие значения, см. Sage (значения). Sage …   Википедия

  • Singular value decomposition — Visualization of the SVD of a 2 dimensional, real shearing matrix M. First, we see the unit disc in blue together with the two canonical unit vectors. We then see the action of M, which distorts the disk to an ellipse. The SVD decomposes M into… …   Wikipedia

  • Python — У этого термина существуют и другие значения, см. Python (значения). Python Класс языка: му …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”