1
$\begingroup$

So today I have a car zig-zaggging, and I want to compute its average orientation (as compared to the horizontal) at each time (blue arrows). The first idea that comes in mind is : just take the start and end points, draw a straight line between them instead of your zig-zag, and you're done, this straight line (in red) has your average orientation. enter image description here

I took an example : $$f(x) = \begin{cases} x,\ \text{if }0\le x\le\frac{4}{5}\\ \frac{8}{5}- x,\ \text{if } \frac{4}{5}<x\le 1\end{cases}$$ So basically it's a straight line aiming at $45°$ until $x=\frac{4}{5}$ where it breaks and aims at $-45°$.

enter image description here

The average angle can be easily computed by decomposing the integral over the two segments : $A = \frac{4}{5}\cdot 45°-\frac{1}{5}\cdot 45° = \frac{3}{5}\cdot 45° = 27°$.

Moreover $f(1) = \frac{3}{5}$ ; so a straight line from beginning to end (red) would yield $g(x) = \frac{3}{5}x$ and its angle $B = \arctan\left(\frac{3}{5}\right)$ which is about $31°$ and not $27°$ !

So did I successfully demonstrate that this straight line idea doesn't work ?

This is actually just an application of the fundamental theorem of calculus, which says that if you want to calculate the integral of a function (here, the angle of a curve as compared to the horizontal), you can just take the primitive at the start and end points.

And here the angle function is $\arctan$ (with factors and stuff, but still), which has a primitive of $x\arctan(x) + ln(x^2)$ (again, with factors and stuff, but still). Which means that this wasn't supposed to work. Correct ?

$\endgroup$
2
$\begingroup$

The basic problem with your counterexample -- and perhaps with your entire calculation -- seems to be that you fail to distinguish between "average angle" and "average slope".

Suppose you want to find the average between $0^\circ$ and $88^\circ$. In one sense you want to get $44^\circ$, but if you just average the slopes (that is, $\tan 0$ and $\tan 88^\circ$), you get something much closer to vertical.

A different take on the problem is that you don't seem to have made an explicit decision how you want to weight the angle the car is pointing in at different times. By distance traveled? Or by time?

And that again points to the fact that "averages" of angles don't really work well on the best of days -- since angles wrap around you can't get rid of cases where very small differences in one of the angles have very large effects on whichever "average" you compute.

For example it is not clear what the "average" of $0^\circ, 120^\circ, 240^\circ$ should be, due to symmetry. You can say that there shouldn't be any average, because these angles correspond to going around an equilateral triangle and ending up at your starting point, getting nowhere -- but that doesn't take care of the effect that the averages of $\{0^\circ, 119^\circ, 240^\circ\}$ and $\{0^\circ, 121^\circ, 240^\circ\}$ would be close to $30^\circ$ and $210^\circ$, with a difference that is much larger than that between $119^\circ$ and $121^\circ$. It seems hardly fair to call such a thing an "average".

$\endgroup$
0
$\begingroup$

Your reasoning looks fine. The average 'angle' is not just the angle of the line from the start to the finish .. which is no surprise, because that angle isn't related to the difference of values of a primitive at the two ends.

$\endgroup$
  • $\begingroup$ Yet it's so tempting ... This is currently being implemented in software, and I think I heard someone pretty much describing the red line thing as implementation ... $\endgroup$ – Charles Apr 28 '15 at 13:51
  • $\begingroup$ If you trust what coders do to "implement" stuff, I've got a bridge to sell you. :) What IS reasonable is to use $\arctan( (y_2 - y_1) / (x_2 - x_1) )$ as an estimate of the angle when the two points are very close together (although "atan2" is a better choice, in general). But the notion that it's therefore OK to use it over a large interval...is essentially the assumption that arctan is linear...which it isn't. $\endgroup$ – John Hughes Apr 28 '15 at 13:54
  • $\begingroup$ Actually what the FTC brings is that this would all work if we were talking about SLOPE and not ANGLE (which is pretty much the arctangent of the slope). This arctangent dude is really the killer of the story ... $\endgroup$ – Charles Apr 28 '15 at 13:55
  • $\begingroup$ Nice point! $ $ $\endgroup$ – John Hughes Apr 28 '15 at 13:55
  • $\begingroup$ About your bridge, our thing is driving over 10 or 15 meters, but probably close to perfectly straight (depends on the quality of the driver, but in average it should be ok). So if driving towards positive x on the usual plane (e.g. between +90° and -90°), the difference in y would not be too big compared to the difference in x. But that doesn't make your bridge valid, does it ? $\endgroup$ – Charles Apr 28 '15 at 13:58
0
$\begingroup$

An even clearer counterexample is comparing 1) having the car stay still and 2) having the car complete a quarter cloverleaf. In the first case, the car kept the same orientation, and in the second it rotated by 90 degrees. In both cases the car's starting and ending positions are the same.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.