[Numpy-discussion] Characteristic of a Matrix.

Colin J. Williams cjwilliams43 at gmail.com
Mon Jan 5 13:40:44 EST 2015


One of the essential characteristics of a matrix is that it be rectangular.

This is neither spelt out or checked currently.

The Doc description refers to a class:

   - *class *numpy.matrix[source]
   <http://github.com/numpy/numpy/blob/v1.9.1/numpy/matrixlib/defmatrix.py#L206>

Returns a matrix from an array-like object, or from a string of data. A
matrix is a                specialized 2-D array that retains its 2-D
nature through operations. It has certain special operators, such as *
(matrix multiplication) and ** (matrix power).

This illustrates a failure, which is reported later in the calculation:

A2= np.matrix([[1, 2, -2], [-3, -1, 4], [4, 2 -6]])

Here 2 - 6 is treated as an expression.

Wikipedia offers:

In mathematics <http://en.wikipedia.org/wiki/Mathematics>, a *matrix*
(plural *matrices*) is a rectangular
<http://en.wikipedia.org/wiki/Rectangle> *array
<http://en.wiktionary.org/wiki/array>*[1]
<http://en.wikipedia.org/wiki/Matrix_%28mathematics%29#cite_note-1> of
numbers <http://en.wikipedia.org/wiki/Number>, symbols
<http://en.wikipedia.org/wiki/Symbol_%28formal%29>, or expressions
<http://en.wikipedia.org/wiki/Expression_%28mathematics%29>, arranged in *rows
<http://en.wiktionary.org/wiki/row>* and *columns
<http://en.wiktionary.org/wiki/column>*.[2]
<http://en.wikipedia.org/wiki/Matrix_%28mathematics%29#cite_note-2>[3]
<http://en.wikipedia.org/wiki/Matrix_%28mathematics%29#cite_note-3> The
individual items in a matrix are called its *elements* or *entries*. An
example of a matrix with 2 rows and 3 columns is
[image: \begin{bmatrix}1 & 9 & -13 \\20 & 5 & -6 \end{bmatrix}.]In the
Numpy context, the symbols or expressions need to be evaluable.

Colin W.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150105/e73aa199/attachment.html>


More information about the NumPy-Discussion mailing list