[Numpy-discussion] Vector magnitude?

Matthieu Brucher matthieu.brucher at gmail.com
Wed Sep 5 13:21:05 EDT 2007


2007/9/5, Robert Dailey <rcdailey at gmail.com>:
>
> Hi,
>
> I have two questions:
>
> 1) Is there any way in numpy to represent vectors? Currently I'm using
> 'array' for vectors.



A vector is an array with one dimension, it's OK. You could use a matrix of
dimension 1xn or nx1 as well.


2) Is there a way to calculate the magnitude (length) of a vector in numpy?


Yes, len(a)

Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070905/94609ed3/attachment.html>


More information about the NumPy-Discussion mailing list