I don't know what you mean by a 1D vector, but for a 3-vector, you can 
do this (also works for N-dimensions)

In [1]: a=r_[1.,2.,3.]
In [2]: a
Out[2]: array([ 1.,  2.,  3.])
In [3]: b=a/norm(a)
In [4]: b
Out[4]: array([ 0.26726124,  0.53452248,  0.80178373])

Gary R

> bit of a newb question, is there a method for normalising a 1D vector
> so it ends up with magnitude 1?
> 
> I can do it manually but I was hoping there was a neat numpy - or
> scipy -  trick.  I've been web surfing but nothing really leaps out

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to