Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #16272

Re: Another little puzzle

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.programming
Subject Re: Another little puzzle
Date 2023-01-08 20:41 +0000
Organization A noiseless patient Spider
Message-ID <877cxwwyhc.fsf@bsb.me.uk> (permalink)
References (6 earlier) <878rioifnh.fsf@bsb.me.uk> <868rinskhk.fsf@linuxsc.com> <topmiu$4ps$1@gioia.aioe.org> <868ridni7g.fsf@linuxsc.com> <tpeqaf$vje$1@gioia.aioe.org>

Show all headers | View raw


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On 2023-01-08 16:45, Tim Rentsch wrote:
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>
>>> Averaging arcs is equivalent to averaging angles.
>> Angles are a one-dimensional measure.
>
> Averaging arcs is still equivalent to averaging angles, which is trivial result of elementary trigonometry.
>
>> Finding an arc length
>> "average" of points on a sphere needs a two-dimensional result.
>
> Points do not have arcs.
>
>>>> Now that I think about it, finding the point that minimizes the
>>>> great circle distances squared would be at least computationally
>>>> unpleasant.
>>>
>>> See above, it is just angles to average.
>> Apparently you have not yet understood the problem.
>
> Again, averages of arcs and angles are equivalent up to a multiplier.
>
>> Why don't
>> you try writing a program that inputs a set of points normalized
>> to be on the unit sphere, and then calculates the arc length
>> average point (on the unit sphere) of those input points?
>
> Why don't you write a formula specifying your need?

You seemed to understand the need sufficiently to dismiss the problem:
"averaging angles, which is trivial", "it is just angles to average" and
"averages of arcs and angles are equivalent up to a multiplier".  But
the problem is /finding/ a specific average -- the point (or angle) that
minimises the sum of squares of the distances (or angles) from that
average point (or angle).

The fact that it makes no odds (as everyone knows) whether we consider
angles (often called central angles in this context) or great circle
distances is not the issue.  It's finding the average that minimises the
sum of squares of differences that's the issue.

You say you need a formula, so I'll try...  Let P_n be a collection of n
unit vectors specifying n points on a unit sphere.  Find the unit vector
A that minimises

  Sum_{i=1,n} ( arctan( |A x P_n|  /  A . P_n ) )^2

(arctan is the "all quadrant" version that is often called atan2 in
programming languages.)

> Programs are written according to the specifications. Numeric programs
> require a properly stated problem, rather than a bunch of words
> arbitrarily thrown in a meaningless sentence as above.

Given the context, I think that's a very biased characterisation of
what's been said here.

My first job was as a "numerical analyst", and the very first program I
was employed to write was for a professor of statistics.  It was to
calculate a novel kind of fit line.  The specification was just a few
sentences.  No formulas.  It was perfectly clear, and I could get the
job done.  I don't think this is unusual.  Words are often enough, and
they can avoid undue over specification.  For example, the problem in
question is essentially the same if the points are given by latitude and
longitude on a non-unit sphere, but the formula would look very
different.

-- 
Ben.

Back to comp.programming | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-12-30 01:00 +0000
  Re: Another little puzzle Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-29 23:25 -0800
    Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-12-30 14:04 +0000
      Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-12-31 00:24 +0000
        Re: Another little puzzle Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-31 06:42 -0800
          Re: Another little puzzle "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2022-12-31 17:04 +0100
            Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-01 01:24 +0000
            Re: Another little puzzle Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-01-08 07:45 -0800
              Re: Another little puzzle "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2023-01-08 17:17 +0100
                Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-08 20:41 +0000
                Re: Another little puzzle Richard Heathfield <rjh@cpax.org.uk> - 2023-01-08 21:14 +0000
                Re: Another little puzzle "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2023-01-08 22:31 +0100
                Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-09 03:25 +0000
                Re: Another little puzzle "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2023-01-09 11:22 +0100
                Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-09 20:37 +0000
                Re: Another little puzzle "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2023-01-10 09:06 +0100
                Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-11 02:41 +0000
                Re: Another little puzzle "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2023-01-11 10:01 +0100
                Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-12 01:00 +0000
                Re: Another little puzzle Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-01-10 23:36 -0800
                Re: Another little puzzle Y A <ya00000100000@yahoo.com> - 2023-01-11 02:39 -0800
          Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-01 01:10 +0000
            Re: Another little puzzle Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-01-08 07:17 -0800
              Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-08 19:43 +0000
                Re: Another little puzzle Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-08 19:59 +0000
                Re: Another little puzzle Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-01-10 23:25 -0800
      Re: Another little puzzle Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-31 06:20 -0800
        Re: Another little puzzle Augǝl <angel0000000001000000000000@mail.ee> - 2022-12-31 10:23 -0800

csiph-web