Mathematical preliminaries

In order to understand how arrays work in NumPy, it is useful to understand the mathematical parallel between accessing tensor (matrix and vector) elements by indexes and evaluating mathematical functions by providing arguments. We also cover in this section the generalization of the dot product as a reduction operator.

Arrays as functions

Arrays may be considered from several different points of view. We believe that the most fruitful one in order to understand arrays is that of functions of several variables.

For instance, selecting a component of a given vector in n may just be considered a function from the set of ℕn to ℝ, where we define the set:

Here the set ℕn has n elements. The Python function range generates ...

Get Scientific Computing with Python 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.