Clever Geek Handbook
📜 ⬆️ ⬇️

Numpy

NumPy is an open source library for the Python programming language . Opportunities:

  • support for multidimensional arrays (including matrices );
  • support for high-level mathematical functions designed to work with multidimensional arrays.
Numpy
NumPy logo.svg
Type ofPython library
Author
DeveloperCommunity
Written onand
operating systemCross-platform software
First edition
Latest version1.16.4 ( May 28, 2019 )
LicenseBSD
Sitenumpy.org

Purpose

Mathematical algorithms implemented in interpreted languages (e.g., Python) often work much slower than the same algorithms implemented in compiled languages (e.g., Fortran , C , Java ). The NumPy library provides implementations of computational algorithms (in the form of functions and operators) that are optimized for working with multidimensional arrays. As a result, any algorithm that can be expressed as a sequence of operations on arrays (matrices) and implemented using NumPy works as fast as the equivalent code executed in MATLAB [2] .

Comparison with MATLAB

NumPy can be seen as a free alternative to MATLAB. The MATLAB programming language looks like NumPy: both are interpreted, both allow operations on arrays (matrices), and not on scalars . The advantage of MATLAB is the availability of a large number of packages ("toolboxes"), for example, Simulink . Similar “packages” exist for NumPy, for example, the SciPy library provides more MATLAB-like functionality, the Matplotlib library allows you to create graphs in the MATLAB style. Both MATLAB and NumPy use code based on the code of the LAPACK library to solve the basic problems of linear algebra .

Example

 
Script output

Let's look at an example of working with NumPy in the interactive IPython shell.

Running Python from the command line:

  ipython -pylab

Code:

  x = linspace ( 0 , 2 * pi , 100 )
 y = sin ( x )
 plot ( x , y , 'ro-' )
 show ()

As a result of the script, the Matplotlib library will create the graph shown in the figure.

History

In 1995, programmer Jim Hugunin wrote the Numeric library for the Python language. The library was developed with the participation of many people, among whom were Jim Fulton, David Ascher, Paul DuBois and Konrad Hinsen. The library is available to this day, it is considered quite stable and complete, but outdated.

It was suggested that Numeric be added to the standard Python language library, but Guido Van Rossum (author of Python) made it clear that the code in its then state was impossible to maintain.

In addition, the Numeric library slowly processed large amounts of data.

Based on the Numeric library, the NumArray library was created. Numeric code has been completely rewritten.

The NumArray library processed large arrays of data faster than the Numeric library, but small arrays processed more slowly.

For some time, both the Numeric library and the NumArray library were used. The latest version of Numeric (v24.2) was released on November 11, 2005 . The latest version of NumArray (v1.5.2) was released on August 24, 2006 [3] . The NumArray library is no longer recommended for use [4] .

At the beginning of 2005, programmer Travis Oliphant wanted to unite the community around one project and created the NumPy library to replace the Numeric and NumArray libraries. NumPy was created based on Numeric code. Numeric code was rewritten to be easier to maintain, and new features could be added to the library. NumArray features have been added to NumPy.

NumPy was originally part of the SciPy library. To allow other projects to use the NumPy library, its code was placed in a separate package.

The source code for NumPy is publicly available. There is a lot of documentation. There is even a detailed “ NumPy Guide ” [5] .

NumPy v1.3.0 was released on April 5, 2009 and supports Python v2.6 [6] . Python v3 support has been added since version 1.5.0.

See also

  • Matplotlib
  • Scipy

Notes

  1. ↑ The numpy Open Source Project on Open Hub: Languages ​​Page - 2006.
    <a href=" https://wikidata.org/wiki/Track:Q124688 "> </a> <a href=" https://wikidata.org/wiki/Track:P1972 "> </a>
  2. ↑ SciPy PerformancePython (unspecified) . Date of treatment June 25, 2006. Archived April 3, 2012.
  3. ↑ NumPy Sourceforge Files (unspecified) . Date of treatment March 24, 2008. Archived April 3, 2012.
  4. ↑ Numarray Homepage (Neopr.) . Date of treatment June 24, 2006.
  5. ↑ Oliphant, Travis E. Guide to NumPy . - December 7, 2006 .
  6. ↑ NumPy 1.3.0 Release Notes (unspecified) . Date of treatment May 2, 2009. Archived April 3, 2012.

Links

  • Official NumPy website .
  • pyprog.pro (Russian-language resource about NumPy)
  • NumPy Project Homepage
  • History of SciPy
  • Building Arrays
  • Numpy Example List With Doc

Literature

  • Andreas Muller, Sarah Guido. Introduction to machine learning with Python. Guide for Data Scientists = Introduction to Machine Learning with Python: A Guide for Data Scientists. - Williams , 2017 .-- 480 s. - ISBN 978-5-9908910-8-1 , 978-1-449-36941-5.
  • J. Vander Place. Python for complex tasks. Data Science and Machine Learning = Python Data Science Handbook: Essential Tools for Working with Data. - Peter , 2017 .-- 576 p. - ISBN 978-5-496-03068-7 .
Source - https://ru.wikipedia.org/w/index.php?title=NumPy&oldid=100975130


More articles:

  • Glazov
  • Heterodyne
  • Claycomb, Laura
  • ChatZilla
  • Flag of Taman Rural Settlement
  • Calendar
  • Flag of the Leningrad Region
  • Flag of Mosty District
  • 2nd Zachatievsky Lane
  • Haberler, Gottfried von

All articles

Clever Geek | 2019