Live data from Hacker News

Turns are better than radians

computerenhance.com

231–240 of 494 posts

Re: Turns are better than radians

#231

Earlier quoted context omitted.

The writer don’t seem to realise that radian is not an arbitrary unit but a dimensionless one which is defined so that 1rad is actually just 1. Reading the submission and the comments here, I’m under the impression that trigonometry is not extensively taught in middle schools and high schools in the USA. While I’m slightly envious you might not have to suffer developing powers of cosine and sine but that would explai…

> Am I wrong? Yes. Trigonometry is extensively taught in the US. People forget this stuff if they don’t use it. Ask some 30 year old chef in whatever country you fantasize teaches properly to compare and contrast turns vs radians and you’ll get similar responses.

It's taught extensively in the US, but what's never done is showing how terrible many of those identities or integrals are in degrees.

Derivative of sin(x) is cos(x). Many people probably think this works for degrees, but it's actually some abomination like pi cos(pi x/180)/180.

Of course, turns are very reasonable units sometimes for sure.

Re: Turns are better than radians

#232
There are a lot of comments here saying that radians are the only true way to deal with angles, however I agree with the author of the original article that turns are a legitimate alternative - I just wouldn't use the same language. Instead I would say that the new function I'm calculating is sin(2π t), and maybe also say that t is measured in turns, where (1 turn) = (2π rad).

It still has a nice small angle approximation: sin(2π t) ≈ 2π t for small t (arguably this is easier to interpret than sin(x) ≈ x), and its derivative is slightly more complicated: d/dt sin(2π t) = 2π cos(2π t). But everything is still perfectly workable and makes sense. I don't think you would find a mathematician or engineer surprised to come across functions such as these. (They may prefer to make the standard [1] substitution ω = 2πt if there is going to be a lot of differentiation involved, but this is a choice, not a requirement).

Turns can also be helpful as an intermediate unit which is to be translated both to an angle, and something else (colour, pitch, etc). I used turns internally for a pitch pipe application [2], where a turn became both an angle around a circle (t ↦ (cos(2πt), sin(2πt)), and a pitch moving up and down in equal temperament (t ↦ C4_FREQUENCY * 2^t). That way t=1.5 means either 1.5 octaves higher, or 1.5 full turns around the circle.

What mathematicians or engineers would be unhappy with is finding a redefinition of sin(t) to sin(2π t). Instead, lean into the fact that algebra can be a compact and unambiguous method of communication, and make a new library function called sin2π or something, and document that it calculates sin(2π t). Everyone will know what you mean.

[1]: https://en.wikipedia.org/wiki/Angular_frequency

[2]: https://www.jgibson.id.au/blog/pitch-pipe/

Re: Turns are better than radians

#233

Earlier quoted context omitted.

The writer don’t seem to realise that radian is not an arbitrary unit but a dimensionless one which is defined so that 1rad is actually just 1. Reading the submission and the comments here, I’m under the impression that trigonometry is not extensively taught in middle schools and high schools in the USA. While I’m slightly envious you might not have to suffer developing powers of cosine and sine but that would explai…

>> The writer don’t seem to realise that radian is not an arbitrary unit but a dimensionless one which is defined so that 1rad is actually just 1. It's been a while, but I used to have an argument that rad should be a unit. This even plays well in physics where it allows torque to not have the same units as a joule.

rad is a unit already. https://en.wikipedia.org/wiki/Rad_(unit)

Re: Turns are better than radians

#234
post #183

Earlier quoted context omitted.

> Am I wrong? Yes. Trigonometry is extensively taught in the US. People forget this stuff if they don’t use it. Ask some 30 year old chef in whatever country you fantasize teaches properly to compare and contrast turns vs radians and you’ll get similar responses.

I'm a 50 yo programmer. I have a CS degree. I don't even remember my college calculus much less my high school trig. I just haven't had cause to use it in my career, not as a sysadmin, not as a programmer. My son is taking calc 3 and I knew I happened to have my calc 3 notes from the mid-90s, so I pulled them out of the filing cabinet and my very carefully taken notes, my proofs, my hand drawn graphs, it was all gibb…

Honestly the typical developer needs a solid understanding of algebra, but not much beyond that. Though any time I get into game dev stuff I start ripping my yair out over quaternions

Re: Turns are better than radians

#236
post #18

> Some time ago, much effort was expended to convince people to replace approximations of “pi” (3.14159…) with approximations of “tau” (6. 28318…). IMO the effort was simply to replace the use of pi with the use of tau. What does approximation have to do with it?

The point is PI and it’s brother TAU, being transcendental, is always approximated. Which is important to think about if you care about accuracy.

And I think that's the most important part of the argument here. By using radians in this case, you do extra calculation steps only to reduce the accuracy. That seems like a poor investment of the processor's time.

Re: Turns are better than radians

#237

Well I don't think they are. Sure they make computing the function simpler. But I would hazard that most people that use these functions are not doing geometry and they are already working with radians. In short if you give any kind of engineer working on any kind of signal processing domain a sine function where sin(1) = 0 you are only going to confuse them. PS: that's why mathematicians don't use turns they are mos…

> sin(1) = 0 you are only going to confuse them. Not really, pretty much every single one would assume you just forgot the pi, because everyone writes “sin(1 pi)” and never actually “sin(3.14…)” because no one ever writes down numbers in the unit of radians, they already convert to half rotations or full rotations by scaling with pi. Imagine if someone went “nanometers are a dumb unit, because I always write down my…

In my example you would not actually write it out but instead have something like this.

[sin(x) for x in sample]

My point is that the trig functions are abstract and useful in multiple domains and in most of these domains turns does not make sense. Turns only makes sense in geometry and maybe some physics but most of the time in these cases you might be better off working with other units, like say quaternions.

The fact is in the vast majority of literature trig functions take rads as arguments, it's the sane default for that reason alone.

Re: Turns are better than radians

#238
post #101
post #29

Earlier quoted context omitted.

360 comes from the Babylonians, who used base-60 for numbers much for the reasons you describe (and who gave us the 24-hour day, 60 minute hour and 60-minute second, not to mention the 7-day week). NATO forces have compasses labelled in mils or milliradians, which are not actually 1/1000 of a radian but as an approximation 1/6400 of a full turn. I still have my Silva military compass from 1989 graduated thus. https:/…

Wait, like instead of 1/6283.185307 of a turn? That's wild! (It is off by 1.86%. That much error matters, nowadays, though it wouldn't have, back when.)

And apparently the Warsaw Pact had an even worse 6000, and Sweden a more accurate (but less divisble) 6300.

Re: Turns are better than radians

#239
post #118

Earlier quoted context omitted.

Did you ever need to do involved mathematical manipulations using pen and paper? How would you judge the readability of the following expressions: zero_point equals negative prefactor divided_by two plus_or_minus square_root_of( square_of(prefactor divided_by two) minus absolute_term ) zero_point = -prefactor/2 ± √((prefactor/2)² - absolute_term) x = -p/2 ± √((p/2)² - q)

Yeah, when doing it with hand, I surely would shorten it. But when doing math on the computer with help of autocomplete, why not? But well, I do not really know if that in pure math shape exists, I am only doing Math in the context of programming. And for pedagogic purposes, I do would like more meaningful names at times.

It's definitely a lot harder to read and make sense of an equation that is sprawled out. In some domains, I would contend that using greek letters in code would increase readability, especially for those familiar with the underlying formula, and especially if the code is not edited frequently (e.g. implementing a scientific formula which won't change).

A good compromise might be to put the equation in the comments in symbol-heavy form, and use the spelled out names in code.

Re: Turns are better than radians

#240
I appreciate the article encouraging programmers to think about API design.

At the same time, I look forward to a future (or present?) where compilers and static analysis tools can point out examples like this; e.g, many examples of calling code multiplying by pi followed by function code dividing by pi.

P.S. This reminds me somewhat of the Department of Redundancy Department.

Post reply on HN