# Chapter 15. Numeric Processing

In Python, you can perform numeric computations with operators (as covered in Chapter 4) and built-in functions (as covered in Chapter 8). Python also provides the math, cmath, operator, and random modules, which support additional numeric computation functionality, as documented in this chapter.

You can represent arrays in Python with lists and tuples (covered in Chapter 4), as well as with the array standard library module, which is covered in this chapter. You can also build advanced array manipulation functions with loops, list comprehensions, iterators, generators, and built-ins such as map, reduce, and filter, but such functions can be complicated and slow. Therefore, when you process large arrays of numbers in these ways, your program's performance can be below your machine's full potential.

The Numeric package addresses these issues, providing high-performance support for multidimensional arrays (matrices) and advanced mathematical operations, such as linear algebra and Fourier transforms. Numeric does not come with standard Python distributions, but you can freely download it at http://sourceforge.net/projects/numpy, either as source code (which is easy to build and install on many platforms) or as a prebuilt self-installing .exe file for Windows. Visit http://www.pfdubois.com/numpy/ for an extensive tutorial and other resources, such as a mailing list about Numeric. Note that the Numeric package is not just for numeric processing. Much of Numeric is about multidimensional arrays and advanced array handling that you can use for any Python sequence.

Numeric is a large, rich package. For full understanding, study the tutorial, work through the examples, and experiment interactively. This chapter presents a reference to an essential subset of Numeric on the assumption that you already have some grasp of array manipulation and numeric computing issues. If you are unfamiliar with this subject, the Numeric tutorial can help.  Part I: Getting Started with Python  Part II: Core Python Language and Built-ins  Part III: Python Library and Extension Modules  Chapter 10. File and Text Operations  Chapter 11. Persistence and Databases  Chapter 12. Time Operations  Chapter 13. Controlling Execution  Chapter 14. Threads and Processes  Chapter 15. Numeric Processing  15.1 The math and cmath Modules  15.2 The operator Module  15.3 The random Module  15.4 The array Module  15.5 The Numeric Package  15.6 Array Objects  15.7 Universal Functions (ufuncs)  15.8 Optional Numeric Modules  Chapter 16. Tkinter GUIs  Chapter 17. Testing, Debugging, and Optimizing  Part IV: Network and Web Programming  Part V: Extending and Embedding