Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6980
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '(using': 0.05; 'involves': 0.07; 'though.': 0.07; 'precision': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'underlying': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'enigma': 0.16; 'kern': 0.16; 'received:216.62': 0.16; 'received:216.62.213': 0.16; 'received:enthought.com': 0.16; 'subsequent': 0.16; 'question.': 0.16; 'repeated': 0.19; 'thanks,': 0.19; 'header:In-Reply-To:1': 0.21; 'seems': 0.21; 'expect': 0.25; 'up.': 0.26; 'subject:?': 0.29; 'elements': 0.29; 'interpret': 0.29; 'expression': 0.32; 'header:X-Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'list': 0.33; 'header:User- Agent:1': 0.35; 'matter,': 0.35; 'using': 0.35; '(with': 0.36; 'floating': 0.37; 'received:org': 0.38; 'but': 0.38; 'though': 0.38; 'size,': 0.38; 'subject:: ': 0.38; 'attempt': 0.39; 'header :Mime-Version:1': 0.39; 'goes': 0.39; 'to:addr:python.org': 0.39; 'really': 0.40; 'world': 0.63; 'our': 0.63; 'believe': 0.66; 'roughly': 0.67; 'square': 0.67; 'lose': 0.84; 'so:': 0.84; 'eco': 0.91; 'gabriel': 0.91; 'subject:Best': 0.91; 'roots': 0.95 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: Best way to compute length of arbitrary dimension vector? |
| Date | Fri, 03 Jun 2011 18:12:05 -0500 |
| Organization | The Church of Last Thursday |
| References | <43d7a46e-3f48-4c11-a66b-a47a3d6b9b9d@k16g2000yqm.googlegroups.com> <mailman.2258.1306749013.9059.python-list@python.org> <a951396d-446b-4ad6-8ad3-d12420e251af@hg8g2000vbb.googlegroups.com> <201106030726.21147.akabaila@pcug.org.au> <mailman.2409.1307056774.9059.python-list@python.org> <c48d6e64-696a-4d4f-9099-c9137bf25fac@16g2000yqy.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | outbound.enthought.com |
| User-Agent | Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 |
| In-Reply-To | <c48d6e64-696a-4d4f-9099-c9137bf25fac@16g2000yqy.googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2443.1307142739.9059.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1307142739 news.xs4all.nl 49178 [::ffff:82.94.164.166]:35307 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6980 |
Show key headers only | View raw
On 6/3/11 4:53 PM, Gabriel wrote: > >> The dimension is arbitrary, though, so: >> >> length = reduce(math.hypot, self._coords, 0) >> > > > Thanks, I was going to ask Algis that same question. > > But still, is this solution really faster or better than the one using > list comprehension and the expression 'x*x'? > It seems to me that the above solution (using hypot) involves repeated > square roots (with subsequent squaring). It also means that the floating point numbers stay roughly the same size, so you will lose less precision as the number of elements goes up. I don't expect the number of elements will be large enough to matter, though. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Best way to compute length of arbitrary dimension vector? Gabriel <snoopy.67.z@googlemail.com> - 2011-05-30 02:11 -0700
Re: Best way to compute length of arbitrary dimension vector? Chris Rebert <clp2@rebertia.com> - 2011-05-30 02:24 -0700
Re: Best way to compute length of arbitrary dimension vector? Peter Otten <__peter__@web.de> - 2011-05-30 11:46 +0200
Re: Best way to compute length of arbitrary dimension vector? Gabriel <snoopy.67.z@googlemail.com> - 2011-05-30 06:38 -0700
Re: Best way to compute length of arbitrary dimension vector? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-02 17:19 -0600
Re: Best way to compute length of arbitrary dimension vector? Gabriel <snoopy.67.z@googlemail.com> - 2011-06-03 14:53 -0700
Re: Best way to compute length of arbitrary dimension vector? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-03 16:17 -0600
Re: Best way to compute length of arbitrary dimension vector? Robert Kern <robert.kern@gmail.com> - 2011-06-03 18:12 -0500
Re: Best way to compute length of arbitrary dimension vector? "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-05-30 16:01 -0300
Re: Best way to compute length of arbitrary dimension vector? Gabriel <snoopy.67.z@googlemail.com> - 2011-06-01 12:35 -0700
csiph-web