[Numpy-discussion] Regarding Matrices

Sven Schreiber svetosch at gmx.net
Mon Aug 14 15:58:50 EDT 2006


Hi,

Satya Upadhya schrieb:

>>>> from Numeric import *

Well this list is about the numpy package, but anyway...

> the power function is giving a resultant matrix in which each element of
> matrix B is raised to the power of 0 so as to make it 1. But, taken as a
> whole i.e. matrix B to the power of 0 should have given the identity
> matrix.

afaik, in numpy terms if you are dealing with a numpy array, such
functions are elementwise by design.
In contrast, if you have a numpy matrix (a special subclass of the array
class) --constructed e.g. as mat(eye(3))-- then power is redefined to be
the matrix power; at least that's the rule for the ** operator, not 100%
sure if for the explicit power() function as well, but I suppose so.

>  
> Also, what is the procedure for taking the log of an entire matrix
> (log(A) where A is a matrix takes the log of every individual element in
> A, but thats not the same as taking the log of the entire matrix)

I don't understand what you want, how do you take the log of a matrix
mathematically?

-Sven




More information about the NumPy-Discussion mailing list