Turns are Better than Radians

(computerenhance.com)

14 points | by mayoff 2 hours ago ago

12 comments

  • traes 17 minutes ago

    Very bold title! Turns are very convenient until you need to calculate a rate of change, as of course d/dx sin(2pi x) = 2pi cos(2pi x). Unfortunately this is a common enough problem that I will be sticking with the radian.

  • chabska 33 minutes ago

    The problem is that trigonometric functions are used in many more fields beyond geometry. The input is not always an angle around a point in euclidean space, it could be phase angle of a periodic signal. You can make an alternative set of trig functions that take turns, but you will anger a lot of people if you mess with the vanilla trig functions.

    • sriku 26 minutes ago

      You'll have to bring in the 2π factor somewhere. Cant escape it. If sint is the sin function but with angle give in turns, then d/dx sint(x) = 2π cost(x). sin(x) ~ x for small x but sint(x) ~ 2πx for small x.

  • mayoff 2 hours ago

    I like to store angles as turns in my own code, because (as noted) it makes quarter-turns computable without rounding. OTOH if you need, say, twelfths of a turn, you might want to just store angles as degrees since that’s already common.

    Michael Spivak, in Calculus (3rd ed p. 301) considers the unit choice to be a property of the function and initially defines sin° and sinʳ (before settling on sin meaning sinʳ) and considers “sin x°” and “sin x radians” to be misleading, saying that ‘a number x is simply a number—it does not carry a banner indicating that it is “in degrees” or “in radians”’. I don’t really understand this argument, since in science and engineering we constantly carry units around with our quantities.

    • math-man 29 minutes ago

      It's because both radians and degrees are are a ratio of a length to another length and are thus dimensionless. No matter how you measure it, all angles are without a unit.

      It's most obvious with radians but it's also the case with degrees.

      Using radians, you are guaranteed to not introduce unusual extra terms to rescale angles, if you use any other scale of angle you will have to keep track of extra terms.

      That may be useful in whatever you're doing. I work in degrees quite often and I'm careful to keep track of the 2pi/360 terms that crop up all over the place. With grade measure you have to keep track of 2pi/400 terms and with turns you have to keep track of 2pi/1 terms that will repeatedly show up.

      Again, depending on what you're doing, this may or may not make sense to do.

      In general, mathematics works out easier when the scaling term is 2pi/2pi because then you have a lovely 1 scale factor you don't have to keep track of.

      • eru 6 minutes ago

        Agreed. Though sometimes it's useful to keep track of 'fake' units like for angles, to make something like dimensional analysis work for you.

        But that's more for analysis of your code / formulas than when you actually go and compute things.

  • groundzeros2015 5 minutes ago

    Fails to mention that radians relates angle to arc length.

  • slwvx 30 minutes ago

    Yes, the idea of a turn [1] is interesting. And maybe useful.

    I have a different question: What would it take for a compiler to remove (elide) the multiply by pi + divide by pi that the author uses as an example? I guess one would not have to go as far as a Lean proof that two bits of code produce the same result?

    [1] https://en.wikipedia.org/wiki/Turn_(angle)

    • eru 4 minutes ago

      Well, they don't produce the same result in floating point math, I'm afraid.

      So you'd need to teach your compiler about what your formulas mean and what context you are using them in. (Ie are you actually doing geometry, or is your AI coding agent just trying arbitrary activation functions for your neuronal net experiments and some of them happen to look like geometry?)

  • zahrevsky 25 minutes ago

    > It turns out (pun intended!)

    Thanks, I was waiting for this pun the moment turns were introduced in the article.

  • jp57 36 minutes ago

    Or you could use 1/360 of a turn.

  • traes 15 minutes ago

    The title should say (2022)