Summary
Python offers built-in support for mathematics with some basic numerical types, arithmetic, extended precision numbers, rational numbers, complex numbers, and a variety of basic mathematical functions. However, for more serious computations involving large arrays of numerical values, you should use the NumPy and SciPy packages. NumPy provides high-performance array types and basic routines, while SciPy provides more specific tools for solving equations and working with sparse matrices (among many other things).
NumPy arrays can be multi-dimensional. Two-dimensional arrays have matrix properties that can be accessed using the linalg
module from either NumPy or SciPy (the former is a subset of the latter). Moreover, there is a special operator in Python for matrix multiplication, @
, which is implemented for NumPy arrays. SciPy also provides support for sparse matrices via the sparse
module. We also touched on matrix theory and linear algebra, which underpins most of the numerical...