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


Groups > comp.programming > #16188

Re: Another little puzzle

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.programming
Subject Re: Another little puzzle
Date 2022-12-30 01:00 +0000
Organization A noiseless patient Spider
Message-ID <87tu1diu2s.fsf@bsb.me.uk> (permalink)
References <puzzle-20221214131815@ram.dialup.fu-berlin.de> <algorithm-20221221130021@ram.dialup.fu-berlin.de> <average-20221228125821@ram.dialup.fu-berlin.de>

Show all headers | View raw


ram@zedat.fu-berlin.de (Stefan Ram) writes:

> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>I waited a few days before answering to allow 
>>sufficient time to think about the problem.
>
>   (A few lines in this post contain more than 72 characters.)

???  That's an odd thing to say!

>   I sometimes look at records of events like when someone got
>   up or went to bed on different days and wonder about the
>   "average time" he gets up or goes to bed. Some years ago,
>   I asked in another newsgroup how to average times, and from
>   answers there I kept this expression for a spreadsheet and
>   two times in cells A1 and B1:
>
> REST(1.5+1/6.28318530717959*ARCTAN2((COS((A1-0.5)*6.28318530717959)+COS((B1-0.5)*6.28318530717959))/2,(SIN((A1-0.5)*6.28318530717959)+SIN((B1-0.5)*6.28318530717959))/2),1)

I'm not going to try to unravel that (it is most likely the conventional
atan2 of the sum of sines and cosines), but the problem is barely worth
considering for two times.  What did you do with more than two?

>   . I added a bit, like "REST", but the trigonometric part
>   came from that newsgroup. (Times t of a day in spreadsheets
>   often are 0 <= t < 1 because they often use the day as the
>   unit of time). At that time, I did not understand what was
>   going on! In hindsight, today, I see that this seems to
>   calculate the average via the average of the position of 
>   the two points on a 24-hour clock in two dimensions.
>
>   The corresponding Wikipedia page is called, "Mean of circular
>   quantities".
>
>   I also have a copy of a page "Circular Values Math and
>   Statistics with C++11" saved. Other pages I found were
>   "Averages-Mean angle - Rosetta Code", "Averaging Angles -
>   The Math Doctors", or "algorithm - How do you calculate
>   the average of a set of angles - Stack Overflow". Maybe
>   some of these pages can still be found in the Web today.
>
>   There was also another web page that used lines some of
>   which have more than 72 characters. It contained,
>
> |A good way to estimate an average angle, A, from a set of angle measurements
> |a[i] 0<=i<N, is:
> |
> |                   sum_i_from_1_to_N sin(a[i])
> |    a = arctangent ---------------------------
> |                   sum_i_from_1_to_N cos(a[i])

I think it's easier to think in terms of vectors (for one thing you get
a useful magnitude as well).  Also the programmer's atan2 is more
helpful here than the mathematician's arctan.

I found this problem interesting but only later in the discussion as I
have been using this metric for some time.  What got interesting (to me)
was that there is another sound interpretation of the average as
suggested by Tim, ironically prompted but a general definition of what
might constitute an average that I had posted and failed to follow
through on.

So thank you for bringing it up.

> |A very careful study of the properties of this estimator is in the book
> |"Statistics On Spheres", Geoffrey S. Watson, University of Arkansas Lecture
> |Notes in the Mathematical Sciences, 1983 John Wiley & Sons, Inc.

Rant: This book is now out of print and effectively dead.  What a shame.
I can't imagine that either the author or the publisher (John Wiley and
Sons) hold out much hope of making any more money from it, so with
things as they stand, all that person's hard work is now lost to anyone
not lucky enough to have access to a library that happens to have it, or
patient enough to wait (and prepared to pay) for the inter-library loan
system to work it's magic.

And for people no where near any library, tough!

-- 
Ben.

Back to comp.programming | Previous | NextNext 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