I haven't had many puzzle posts on this blog. So, I was chatting online today with a friend of mine, and he was curious what it was that I did at work (besides chatting online, surfing the web, disrupting others, and making coffee). After describing to him a problem that I had to face recently at work, we deemed it interesting enough and generic enough to merit a blog entry. Without further ado, here's the problem. I've taken the liberty of remapping the problem so that the general audience can appreciate it more readily.

Say we have two points each with a tail angle from 0º to 360º. For example, let's say we have Point A with a tail angle = 5º and Point B with a tail angle = 25º. The average angle is 15º. Likewise, if we had Point A with angle 10º and Point B with angle 280º, then the average angle would be 325º. We want the average angle to be taken from within the more acute angle formed by the two tails. Simple. No issues at all.

What if we had N angles? For example, N = 3, and we have the following angles: 88º, 268º, and 2º. Then, the average angle would be 359 1/3º. Now, what if we want not only the average angle, but also some measure of coherence. Let me clarify this a bit. If all N angles were in a tight range from 0º to 10º, then the coherence would be very high. If the N angles were scattered fairly uniformly from 0º to 250º, then the coherence would be quite low. So, the question is... what's a good way to go about obtaining an average angle and a coherence value given N angles?

There are many ways to go about this. At work, we came up with numerous ideas and methods. Some methods were rather novel, but unfortunately were inefficient. Others were straightforward and efficient, but produced faulty results. The method we ultimately settled on worked well for our needs, but I'll keep that method hidden... for now.

One final note... for now, pathological cases can be ignored. An example of a pathological case would be where N = 4, and the four angles were 0º, 180º, 5º, and 185º. In this case, the average angle could conceivably be either of two possibilities. Have fun with the problem.

## 1 comment:

Lots of subtle kinks in this one--watch out!

Post a Comment