Treffer: A Peek on Numerical Programming in Perl and Python

Title:
A Peek on Numerical Programming in Perl and Python
Contributors:
The Pennsylvania State University CiteSeerX Archives
Collection:
CiteSeerX
Document Type:
Fachzeitschrift text
File Description:
application/pdf
Language:
English
Rights:
Metadata may be used without restrictions as long as the oai identifier remains attached to it.
Accession Number:
edsbas.84D08F08
Database:
BASE

Weitere Informationen

In this note we peek at the capabilities for numerical programming in the two high-level scripting languages Perl and Python, both having numerical libraries providing increased efficiency for iterating over large arrays of data. We do a superficial investigation on the efficiency of both languages with and without using numerical libraries. Using high-level languages can quite often increase the speed substantially for software development. High-level scripting languages makes rapid prototyping of new ideas and concepts possible with a minimal amount of effort. However, one crux of numerical software is efficient traversal of large amounts of data. High-level languages per se has a deficiency in the sense that such operations are notoriously slow. To overcome this, both Perl and Python has add-on libraries providing special data types that can hold large chunks of data efficient, in regard to both memory usage as well as access speed. Given one can formulate one’s algorithm as element-by-element operations over n-dimensional arrays, both Perl and Python provide functionality with performance comparable to compiled C code. Numerical Python[1] (NumPy) provides fast multidimensional capabilities to Python. A new implementation, numarray[2], is available as well. Perl has its own counterpart to NumPy, the Perl Data Language[3] (PDL). PDL brings number-crunching capabilities to Perl as well as an interactive shell and other goodies. To shed some light on the numerical capabilities of high-level scripting languages, we have implemented the trapezoidal quadrature rule in Python and Perl, both with and without add-on libraries, as well as in standard C for reference. We used a formulation of the quadrature rule which takes advantage of the type of element-by-element operations over arrays that are optimized by the add-on libraries, b f(x) dx = h