The emphasis of the second part of this chapter is on mastering the following operations:

- Scalar multiplication, matrix addition, and matrix multiplication
- Traces and determinants
- Transposes and inverses
- Norms and condition numbers

Let us start with the matrices stored with the `ndarray`

class. We accomplish scalar multiplication with the `*`

operator, and the matrix addition with the `+`

operator. But for matrix multiplication we will need the instance method `dot()`

or the `numpy.dot`

function, since the operator `*`

is reserved for element-wise multiplication:

In [54]: 2*AOut[54]:array([[ 2, 4],[ 8, 32]])In [55]: A + 2*AOut[55]:array([[ 3, 6],[12, 48]])In [56]: ...

Start Free Trial

No credit card required