Live data from Hacker News

Turns are better than radians

computerenhance.com

191–200 of 494 posts

Re: Turns are better than radians

#191
post #84

y’’ = -y Radians are God’s chosen angular unit. If you want to do mathematics, you have to use radians.

What subfield of mathematics? Surely if you do differential equations, your trigonometric functions will eat radians. But e.g. for geometry, where you do basic arithmetic operations on angles, turns are a bit more convenient than radians. (Radians are not that inconvenient if you denote 6.28 somehow, but then again, why not just use turns.)

The situation is similar to that of the logarithm and exponential functions[0].

There’s a log2 function and a log10 function and they are both useful. But when we talk about the log() function there can be no doubt that it is to base e.

If you want to define a sinT() function that works in turns then that’s totally fine. But the sin() function is defined as taking an argument scaled in radians, because it is mathematically natural.

Mathematically speaking, all trig functions are in radians. When you write sin(90°) the degree symbol ° is a conversion factor. I blame calculators for confusing high schoolers into believing that there is a separate set of functions that work in degrees.

[0] unsurprisingly because Euler’s formula equates the trigonometric and exponential functions.

Re: Turns are better than radians

#192
If you like turns you might like

https://en.wikipedia.org/wiki/Gradian

which is ¼₀₀ of a turn. I guess the metric way to do it is use centiturns (4 gradians), milliturns, etc.

On the other hand if you like metric and radians you might like

https://en.wikipedia.org/wiki/Milliradian

Re: Turns are better than radians

#193

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.

Sure, but are people here chefs? I would expect most programmers in mu country to remember this, but most chefs to have forgot it.

Re: Turns are better than radians

#194

Earlier quoted context omitted.

Right, radians are the "natural" units of angle, others generally just make a circle into some integral number of units for convenience, but you always have to go back to radians to actually do calculation. In the next installment, maybe he'll propose that turns can be limiting because diving up a circle requires the use of fractions, and suggest instead of 1 turn per circle, we make a number that's easily divisible…

The point of the original post is that depending on your field (e.g. game engine), maybe all the calculations you need can be done easier in the unit of convenience (e.g. sine of a turn is easier to calculate than sine of radian), so if that is the case you should stick with the unit of convenience thru all the layers and forget about converting to radians in your code. And using fraction of a turn is also a very goo…

If you are making something like a game engine using computer hardware from the past 30 years, you should avoid angle measures to the extent possible.

It is much computationally cheaper and more robust (and easier to reason about) to use vector algebra throughout. Then you have no transcendental functions, just basic arithmetic and the occasional square root. You need the dot product and the wedge product (or combined, the geometric product), and derived concepts like vector projection and rejection.

If you need to store a rotation, you can use a unit-magnitude complex number z = x + iy, where x = cos θ, y = sin θ, without ever needing to calculate the quantity θ directly. If you need to compress it down to one parameter for whatever reason, use the stereographic projection s = y / (1 + x) = (1 – x) / y. Reverse that by x = (1 – s²) / (1 + s²), y = 2s / (1 + s²). [If starting from angle measure for whatever reason s = tan ½θ, sometimes called the "half-tangent".]

The angle measure is the logarithm of the rotation, θi = log z. In some contexts logarithms can be very convenient, but it’s not the simplest or most fundamental representation.

With units of "radians" angle measure is the logarithm of base exp(i) [related to the natural logarithm], and with units of "turns" it is the logarithm of base 1 (sort of).

Re: Turns are better than radians

#195
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…

I'm 27, educated in the UK, all I remember about trigonometry is SOHCAHTOA.

Re: Turns are better than radians

#196

Earlier quoted context omitted.

Whats wrong with long variable names?

Nothing, but their use in mathematical equations will certainly conflict with the implicit multiplication in equations (i.e. `abc` in a formula means `a * b * c`, not a variable abc).

You can use a different font.

Re: Turns are better than radians

#197

Earlier quoted context omitted.

Well this isn’t very fair. Yes, triangles have very little to do with the true nature of sin and cos. It’s also true that they are the basic building blocks of cyclicity. But to say they are not geometric tools is dishonest. They instead show us that geometry is deeply connected to many other, sometimes-surprising, areas of mathematics.

"triangles have very little to do with the true nature of sin and cos" <- this is what I mean.

Sure, but circles are geometric too :)

Re: Turns are better than radians

#198
post #32

>But math never decreed that sine and cosine have to take radian arguments! Ummm, actually it did. The Taylor-series of sine and cosine is the simplest when they work with radians. Euler's formula (e^ix = cosx + isinx) is the simplest when working with radians. Of course you can work in other units, but you'll need to insert the appropriate scaling factors all over the place. "Turns" don't generalize to higher dimens…

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…

> I’m under the impression that trigonometry is not extensively taught in middle schools and high schools in the USA

Education quality and quantity vary greatly across the country. Many schools don't require trig at all or lump it in with other classes. I memorized SOH CAH TOA and brute forced a CLEP test (the state of MN is required to allow you to test out of classes and to write a test if one doesn't exist; usually AP and CLEP tests are accepted, and they don't count for/against your GPA).

It's also culturally accepted to "be bad at math," with undertones of defeat and that it's the world doing that to you and not something you can change (maybe the blame lies elsewhere like with how math is taught as a sequence of dependencies and bombing one course makes the rest substantially more difficult). I don't know how many people scrape by a D in trig and subsequently forget it all, but I'd wager it's a lot.

Re: Turns are better than radians

#199
Oof. This is one of those not-even-wrong cases in which the misunderstanding is revealing.

Math education is so lacking among people who could really benefit from understanding it. Sad state of affairs.

Re: Turns are better than radians

#200
post #32

>But math never decreed that sine and cosine have to take radian arguments! Ummm, actually it did. The Taylor-series of sine and cosine is the simplest when they work with radians. Euler's formula (e^ix = cosx + isinx) is the simplest when working with radians. Of course you can work in other units, but you'll need to insert the appropriate scaling factors all over the place. "Turns" don't generalize to higher dimens…

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…

I agree with you. People confuse their edge case with Math as a whole.

To sum it up: "Computer Science has nothing to do with Math!" ;)

Post reply on HN