Best way to compute length of arbitrary dimension vector?
Algis Kabaila
akabaila at pcug.org.au
Thu Jun 2 17:26:21 EDT 2011
On Monday 30 May 2011 23:38:53 Gabriel wrote:
> Thanks a lot to both of you, Chris & Peter!
>
> (I knew the solution would be simple ... ;-) )
import math
length = math.hypot(z, math.hypot(x, y))
One line and fast.
OldAl.
--
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110603/2554c539/attachment-0001.html>
More information about the Python-list
mailing list