[Numpy-discussion] dot function or dot notation, matrices, arrays?

Wayne Watson sierra_mtnview@sbcglobal....
Sat Dec 19 11:38:58 CST 2009


Yes, flat sounds useful here. However, numpy isn't bending over 
backwards to tie in conventional mathematical language into it.
I don't recall flat in any calculus books. :-) Maybe I've been away so 
long from it, that it is a common math concept? Although I doubt that.


Alan G Isaac wrote:
> On 12/19/2009 11:45 AM, Wayne Watson wrote:
>   
>> A 4x1, 1x7, and 1x5 would be examples of a 1D array or matrix, right?
>>
>> Are you saying that instead of using a rotational matrix  ...
>> that I should use a 2-D array for rotCW? So why does numpy have a matrix
>> class?  Is the class only used when working with matplotlib?
>>
>> To get the scalar value (sum of squares) I had to use a transpose, T, on
>> one argument.
>>     
>
>
> At this point, you have raised some long standing issues.
> There are a couple standard replies people give to some of them.
> E.g.,
>
> 1. don't use matrices, OR
> 2. don't mix the use of matrices and arrays
>
> Matrices are *always* 2d (e.g., a "row vector" or a "column vector" is 2d).
> So in fact you should find it quite natural that that transpose was needed.
> Matrices change * to matrix multiplication and ** to matrix exponentiation.
> I find this very convenient, especially in a teaching setting, so I use
> NumPy matrices all the time.   Many on this list avoid them completely.
>
> Again, if you want a *scalar* as the product of vectors for which you
> created matrix objects (e.g., a and b), you can just use flat:
> np.dot(a.flat,b.flat)
>
> hth,
> Alan Isaac
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>   

-- 
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet  
                
             "... humans'innate skills with numbers isn't much
              better than that of rats and dolphins." 
                       -- Stanislas Dehaene, neurosurgeon 
 
                    Web Page: <www.speckledwithstars.net/>



More information about the NumPy-Discussion mailing list