## 'Average Angle'

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

Strilanc
Posts: 646
Joined: Fri Dec 08, 2006 7:18 am UTC

### 'Average Angle'

I've often found myself wanting the average of a bunch of angles. But thinking about it more, angles are not so easy to average.

I used the definition "x is the average of a set of angles if the sum of all angles to the left equals the sum of all angles to the right" (exactly opposite and equal don't count). The first thing I noticed with this definition is there may be multiple averages: {0, pi} has averages 0, pi/2, pi, and 3pi/2. In fact every set of two distinct angles has at least two averages.

So I refined the definition to require that the sum of absolute differences be minimized at the average (vs other averages). This eliminates most multiple averages, but not all. Unfortunately, it also eliminates the pi/2 and 3pi/2 answers for {0,pi} (which are perhaps more intuitive than 0 and pi being averages for that set).

I think this all has to do with the fact that division over the reals (modulo some constant) is a multi-valued function.

So it comes down to this: what is a good definition of the average of a set of angles? How do you compute it? Given my above definition, can you have more than 2n averages for a set of n angles?
Don't pay attention to this signature, it's contradictory.

++$_ Mo' Money Posts: 2370 Joined: Thu Nov 01, 2007 4:06 am UTC ### Re: 'Average Angle' Strilanc wrote:So I refined the definition to require that the sum of absolute differences be minimized at the average (vs other averages). This eliminates most multiple averages, but not all. Unfortunately, it also eliminates the pi/2 and 3pi/2 answers for {0,pi} (which are perhaps more intuitive than 0 and pi being averages for that set). I don't see how this eliminates [imath]\pi/2[/imath] or [imath]3\pi/2[/imath]. Nevertheless, you should probably minimize the sum of the squares of the differences instead. csrjjsmp Posts: 34 Joined: Wed May 14, 2008 5:02 am UTC Contact: ### Re: 'Average Angle' To find the average of two angles ABC and XYZ, with vertices at B and Y respectively, move one to share a side with the other, so that BC coincides with XY, and B=Y. Bisect angle ABZ. In general, you can't find the average of more than two angles. Edit: If you use a system in which you assign measures to angles, you can average those in the normal way. Last edited by csrjjsmp on Wed May 14, 2008 9:35 am UTC, edited 2 times in total. Cycle Posts: 146 Joined: Mon Feb 25, 2008 1:55 am UTC ### Re: 'Average Angle' The best definition I can think of is to represent the angles as points on the unit circle (in C), sum them, and then take the argument. This is undefined for samples that are perfectly balanced, but I think that's ok (there's no good way to define the average of {0, pi}). It gives you what you would expect (a unique answer) whenever it's defined (and it usually is). For example, the average of {0, pi/2} is pi/4. As an interpretation: if you placed weights, corresponding to the given angles, on a CD balanced on a beer bottle, the average tells you which direction it will fall. Strilanc Posts: 646 Joined: Fri Dec 08, 2006 7:18 am UTC ### Re: 'Average Angle' Cycle wrote:The best definition I can think of is to represent the angles as points on the unit circle (in C), sum them, and then take the argument. This is undefined for samples that are perfectly balanced, but I think that's ok (there's no good way to define the average of {0, pi}). It gives you what you would expect (a unique answer) whenever it's defined (and it usually is). For example, the average of {0, pi/2} is pi/4. As an interpretation: if you placed weights, corresponding to the given angles, on a CD balanced on a beer bottle, the average tells you which direction it will fall. Good idea: just calling it undefined when there are multiple averages makes it much simpler (divide by zero, anyone?). Don't pay attention to this signature, it's contradictory. ventusignis Posts: 19 Joined: Wed May 14, 2008 9:34 pm UTC ### Re: 'Average Angle' There are two parts of an angle. Position (which shall be represented by using the angle bisector in standard form) and Width (How wide the angle is, like 90 degrees for perpendicular legs) (I totally made up these terms). If you average the position, and average the width, you can get an average angle with it's own position and width. And by average, I mean add up all 'n' elements and dividing the sum by 'n' Strilanc Posts: 646 Joined: Fri Dec 08, 2006 7:18 am UTC ### Re: 'Average Angle' ventusignis wrote:There are two parts of an angle. Position (which shall be represented by using the angle bisector in standard form) and Width (How wide the angle is, like 90 degrees for perpendicular legs) (I totally made up these terms). If you average the position, and average the width, you can get an average angle with it's own position and width. And by average, I mean add up all 'n' elements and dividing the sum by 'n' Ummm, what? Angles don't have a width. Adding up all the elements and dividing by n will either give multiple answers or sometimes an incorrect answer. For example: 3/2 pi and 0. The 'falling' average is 7/4 pi, but naive sum-and-divide will give 3/4 pi. Don't pay attention to this signature, it's contradictory. ventusignis Posts: 19 Joined: Wed May 14, 2008 9:34 pm UTC ### Re: 'Average Angle' What I was thinking was there were multiple angles in a unit circle, each with their own pairs of rays. what I was refering to as 'width' was the angle measure actually. 3/4 pi and 0 ? Are these angles in standard position? Actually, I don't know what an average of an angle is anymore. Teki-Teki Posts: 7 Joined: Sat Jan 12, 2008 3:08 am UTC ### Re: 'Average Angle' More generally, if we have some angles [imath]\theta_k[/imath], we can define the average simplistically as $\frac{1}{n}\sum_k \theta_k$$. But the trouble is that actually any rotation of this angle through [imath]\frac{2\pi}{n}[/imath] radians will give an angle that could be interpreted as the "average".

Basically, you can think of it as the problem you get with square roots: [imath]\sqrt{4} = \pm 2[/imath], except that here you can have more than just 2 possible answers. The real reasons lie in the complex plane:

Consider $z_k = e^{i\theta_k}$ and $Z = \prod_k z_k .$ Then the average is really the argument of $Z^{\frac{1}{n}},$ which of course has n possible values unique up to a power of $\zeta = e^{\frac{2\pi i}{n}} .$

Note that this definition still works if you allow your angles to be negative, which can happen if you're using directed angles. In general, though, directed angles are pretty useless except to make proofs airtight for different configurations.

Also, why is my math not working?

jestingrabbit
Factoids are just Datas that haven't grown up yet
Posts: 5967
Joined: Tue Nov 28, 2006 9:50 pm UTC
Location: Sydney

### Re: 'Average Angle'

Teki-Teki wrote:Also, why is my math not working?

Probably not using the right skin. More here

viewtopic.php?f=17&t=21939

If I'm right you need to go to the user control panel and change to one that is supported, either prosilver or prosilver-left.

Totally agree with your analysis too.
ameretrifle wrote:Magic space feudalism is therefore a viable idea.

skeptical scientist
closed-minded spiritualist
Posts: 6142
Joined: Tue Nov 28, 2006 6:09 am UTC
Location: San Francisco

### Re: 'Average Angle'

Teki-Teki wrote:Also, why is my math not working?

Most of the time you are using $when you should be using [imath]. The [math] tag puts a formula on its own line, while [imath] puts it inline in the text. For the last one, you have a missing argument for \frac according to jsMath. The correct usage is \frac{numerator}{denominator}, and you seem to be using \frac{{num}{denom}}. In other words, you should have \zeta = e^\frac{2\pi i}{n} instead of what you have (although I would prefer [imath]\zeta = \exp(\frac{2\pi i}{n}[/imath]) since having a fraction in an exponent makes things hard to read). I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side. "With math, all things are possible." —Rebecca Watson Nimz Posts: 580 Joined: Thu Aug 02, 2007 9:49 am UTC Location: the origin ### Re: 'Average Angle' Teki-Teki wrote:why is my math not working? Like skeptical scientist said, your bad \frac is due to where you put your brackets. e^{\frac{2\pi i}{n}} would have worked, but again, \exp is nice in the case of having a fraction within the exponent. Something else you may wish to try is putting your punctuation inside the [math] tags. That way they don't get placed on the next line. If you want to make sure they don't affect the mathematics, wrap them up in \mbox{}. E.g. If you consider Euler's famous equation, [math]e^{i\pi} = -1,$ it is plain to see why logs of negative numbers should be complex.
If you consider Euler's famous equation, $e^{i\pi} = -1,$ it is plain to see why logs of negative numbers should be complex.

[imath]\frac{2}{3}\cdot 10^5 \mbox{. Some stuff in an mbox. } 2^{2^{2^{\dots}}}[/imath]
LOWA

Teki-Teki
Posts: 7
Joined: Sat Jan 12, 2008 3:08 am UTC

### Re: 'Average Angle'

The tip worked - I didn't realize my skin had changed when I logged in. All good now, and darn that was a dumb LaTeX mistake for me to make after this long.

BeetlesBane
Posts: 138
Joined: Sun Apr 27, 2008 2:32 pm UTC
Location: Not Chicago

### Re: 'Average Angle'

To return to the OP. srtilanc why are you wanting "the average of a bunch of angles"? This more than anyhing else will determine the answer to your question. It may meaningful to ignore the equivalence of two angles that differ by a integral number of rotations; in this case, the familiar real number procedures will work quite well.

Strilanc
Posts: 646
Joined: Fri Dec 08, 2006 7:18 am UTC

### Re: 'Average Angle'

It was just an in-general question I was thinking about.
Don't pay attention to this signature, it's contradictory.

0SpinBoson
Posts: 92
Joined: Thu Oct 04, 2007 5:28 pm UTC

### Re: 'Average Angle'

Here's another way: Take each angle \alpha as a unit vector with direction \alpha as measured from the x axis. Resolve components, add them all, find the overall direction, divide by the number.