Live data from Hacker News

Turns are better than radians

computerenhance.com

251–260 of 494 posts

Re: Turns are better than radians

#251
post #202
post #183

Earlier quoted context omitted.

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…

By far the most annoying myth I face when trying to discuss the pros and cons of various education techniques is the pervasive idea that everybody is a magical knowledge sponge and will go to their grave still remembering how to integrate by parts and every detail about some particular battle they covered in seventh grade, and therefore, if we slightly tweak a curriculum plan to drop something that was included on th…

I remember being amused by this same observation when my own country decided to reduce mandatory education from k+12 to k+10 (cutting two years of high-school). They immediately began re-arranging the curriculum in high-school, for example to move organic chemistry from 11th grade to 10th grade, on the basis that it's important for students who only finish the mandatory 10th grade to know some organic chemistry as well, instead of the old curriculum which would have only taught them inorganic chemistry after 10th grade (this has the bonus of making the chemistry curriculum inorganic I -> organic I -> inorganic II -> organic II, for maximum confusion).

To me, even though I was barely out of high-school at the time, this was obviously absurd - expecting especially someone who wants to drop out of high-school early to retain any notion of organic chemistry taught in a school year, that they couldn't learn on the job if it was really required, seems so obviously nonsense that I couldn't help but laugh. Especially since the same thing was done to basically every other subject as well, with the same intentions.

One note: in my country, the curriculum is completely centralized; there is some small amount of choice, but it amounts to, at most, 1-2 classes per semester; everything else is fixed.

Re: Turns are better than radians

#252
post #55
post #53

Earlier quoted context omitted.

Right, it is a funny way to say it. Computationally, we all only ever work with approximations, but when doing mathematics, pi is exact all the way out to the infinity-th digit. To multiply by pi (or any irrational, but particularly transcendental) in a pure mathematical context is to audaciously specify an infinitely long computational process. It is dizzying to contemplate, almost mystical. Sort of like modular ari…

Is any number mod infinity equal to itself?

What do you want mod infinity to mean?

Re: Turns are better than radians

#253
post #72

Earlier quoted context omitted.

Correct, radians are a "fake" unit made up to understand better formulas (the same way we use types in programming languages)

While it is a fake unit, it was made to make the math easy. You could call the origin of everything the place where I'm standing - but good luck calculating a path for the mars rovers to travel if I happen to walk to the bathroom.

I don't understand your comment. What I meant is that we can use the numeric values of radians without ever writing the radians unit, it is indeed dimensionless (it is length / length = 1, no unit)

Re: Turns are better than radians

#254
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 shocking thing with some of these articles is somehow the author asked “why do people use radians” and ended up with an answer of “it was an arbitrary decision and the world would be better of not using it”.

I feel a bit of humility would have helped the author and perhaps they would have considered the possibility that they didn’t think of the problem deep enough rather than hastily write a blog post about it.

It speaks to the hubris and the superficiality of thinking for some authors.

Re: Turns are better than radians

#255
post #202
post #183

Earlier quoted context omitted.

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…

By far the most annoying myth I face when trying to discuss the pros and cons of various education techniques is the pervasive idea that everybody is a magical knowledge sponge and will go to their grave still remembering how to integrate by parts and every detail about some particular battle they covered in seventh grade, and therefore, if we slightly tweak a curriculum plan to drop something that was included on th…

I just wanted to say I deeply appreciate the eloquence of this comment. Thank you

Re: Turns are better than radians

#256

Earlier quoted context omitted.

"[..] and then C never made sense to me" I had my fair share of higher math, but C never made really sense to me either. It's not us, it's C that's to blame.

So which programming language makes sense to you? Dare I say… Rust?

Yes, Rust does indeed and a long time before that it was Pascal. I really love Pascal's syntax, it makes a lot of sense when you approach it with a math background.

- '=' is for equality only

- assignment is ':=' which is the next best symbol you can find in math for that purpose

- numeric data types are 'integer' and 'real', no single/double nonsense

- 'functions' are for returning values, 'procedures' for side effects

- Function and procedure definitions can be nested. I can't tell you what shock it was for me to discover that's not a thing in C.

- There is a native 'set' type

- It has product types (records) and sum types (variants).

- Range Types! Love'em! You need a number between 0 and 360? You can easily express that in Pascal's type system.

- Array indexing is your choice. Start at 0? Start at 1? Start at 100? It's up to you.

- To switch between call-by-value and call-by -reference all you have to do is change your function/procedure signature. No changes at the call sites or inside the function/procedure body. Another bummer for me when I learned C.

Pascal wasn't perfect but I really wish modern languages had syntax based on Wirth's languages instead of being based on BCPL, B and C.

Re: Turns are better than radians

#257
A motivation seems to be performance (avoiding useless multiplications followed by divisions by the same factor). I'm not sure that you really "pay" for these multiplications, with code optimization?

Re: Turns are better than radians

#258
The author makes the point that turns allow for exact representation of many commonly used angles, but with binary floating point, many common angles (1/6 of a turn, for example) are inexact.

This could be addressed by using a whole number other than 1 to represent a turn ... one that is a multiple of 3 (or 3x3) and 5, and while we're at it, 2 (or 2x2x2), so most commonly-used angles are whole numbers! That gives us 360 as the value representing a whole turn.

Re: Turns are better than radians

#259
I use vectors for everything in game programming. If I want to rotate something, Unity has this:

transform.rotation = Quaternion.LookRotation(directionVector);

I never touch sin, cos, pi. When I see a sin function in someone's code, my first instinct is that they're doing something wrong.

Re: Turns are better than radians

#260

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…

Yes and no. The Taylor expansion works out like sin θ = θ - θ³/₆ + θ⁵/₁₂₀ - θ⁷/₅₀₄₀ + ⋯ if θ is in radians. This is ideal for small θ but if you want to cover, say, 0 https://en.wikipedia.org/wiki/Chebyshev_polynomials which are optimized across the range. You could rewrite these just as easily to work in degrees as radians. One of the best ways to calculate sin and cos is CORDIC, https://en.wikipedia.org/wiki/CORDIC…

CORDIC is not based on radians or turns; it is based on decomposing the angle into a sum of:

phi_n = atan(2^-n)

and then using an abbreviated sum formula where computing cos(theta + phi_n) depends only on sums and bitshifts.

The small-angle approximations sin(x) ≈ x and cos(x) ≈ 1-x^2/2 are the real killer feature of radians, though, because when you can deal with the loss of accuracy you get to avoid using any loops whatsoever. They're also fundamental to understanding simple physical systems like a pendulum.

Post reply on HN