Live data from Hacker News

Turns are better than radians

computerenhance.com

221–230 of 494 posts

Re: Turns are better than radians

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

> > But math never decreed that sine and cosine have to take radian arguments!

> Ummm, actually it did.

No, it didn't. Some specific uses looking better with radians does not mean you have to use radians always.

When I first learned sine and cosine, we used degrees, and that worked fine. Later we switched to radians, but there's no reason why you shouldn't use turns, and the article gives a very good argument why in some cases you definitely should.

Re: Turns are better than radians

#222

Earlier quoted context omitted.

> there are no important applications for those series. I cannot believe I just read this.

When have you ever used the Taylor series of sine and cosine for anything (outside school) ? When you approximate functions by polynomials, including the trigonometric functions, the Taylor series are never used, because they are inefficient (too much computation for a given error). Other kinds of polynomials are used for function approximations. The Taylor series are a tool used in some symbolic computations, e.g. f…

> When you approximate functions by polynomials, including the trigonometric functions, the Taylor series are never used, because they are inefficient (too much computation for a given error). Other kinds of polynomials are used for function approximations.

Can you point me to some implementation of sin that’s not actually using Taylor expansion in some form? Because most that I am aware of do in fact use Taylor series (others are just table lookup). See glibc for example:

https://github.com/bminor/glibc/blob/release/2.34/master/sys...

And here is musl

https://git.musl-libc.org/cgit/musl/tree/src/math/__sin.c

(The constants are easily checked to be -1/3!, 1/5! Etc)

This might have something to do with the Taylor’s theorem. You know, that the Taylor’s polynomial of the order n is the only polynomial of order n that satisfies |f(x)-T(x)|/(x-a)^(n+1) -> 0 as x -> a. In other words, the Taylor polynomial of order n is the unique polynomial approximation to f around a to the order n+1. This means you cannot get any better than Taylor close to the origin of the expansion. This causes implementers to focus on argument reductions instead of selecting polynomials.

Re: Turns are better than radians

#223
post #220

Earlier quoted context omitted.

At a high level you should be expressing something like one of "turn this by the angle between vector (1,0) and vector (1, 1)"; "point this in the direction of vector (1, 1)"; or "turn this by the square root of the rotation i " ( i = a quarter turn). If you use angle measures (of whatever units), when you say "rotate by an eighth of a turn" you are instead going to end up with something internally like: multiply som…

In most game engines, constructing the rotation matrix is trivial. Something like Quaternion.Euler(0, 45, 0). The ultimate position / rotation of any given object in a game is usually a compound transform computed via matrix multiplication anyway, e.g. a model view projection matrix. I'm not sure it's the best way, but that's just how most game engines work.

If your game engine is using quaternions as a canonical internal representation for rotations, it is already following my advice from above.

(Game engine developers are smart people and have lots of practical experience with the benefits of avoiding angle measures, as do developers of computer vision, computer graphics, robotics, physical simulations, aerospace flight control, GIS, etc. etc. tools.)

Re: Turns are better than radians

#224
post #94
post #41

Earlier quoted context omitted.

> there is no need to invent a new terminology. It's not a new terminology: https://en.wikipedia.org/wiki/Turn_(angle)

I am partial to the term "windings", defined as not modulo 1 turn. I e., we are talking here about two very different quantities. Angle is always within a turn, but rotation, using the same units, is not.

[deleted]

Re: Turns are better than radians

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

On a related note, it bothers me that there’s so much urgency to teach younger kids more and more advanced math. I use more and higher math on a day-to-day basis than practically anyone I know, but it’s very rarely even calculus, and even then it’s typically just discrete integrals or derivatives.

There’s just an absolute ton of math being taught that’s going completely to waste, and it’s at the expense of the humanities.

Re: Turns are better than radians

#226
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)

I might be strange but the second seems far more readable than the third to me. The first is of course nonsense.

In my opinion, it puts too much emphasis on the variables compared to the operators and numbers and makes the expression as a whole harder to parse at a glance as I have to actually read the names.

Re: Turns are better than radians

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

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

Otto had a heap of apples.

Re: Turns are better than radians

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

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

The Dutch version was SOSCASTOA, with a picture of a ship called the Castoa sending out an SOS because it was sinking. That picture really helped.

And I even remember what it means:

SOS: sine = opposing side divided by diagonal (schuine) side

CAS: cosine = adjacent divided by diagonal

TOA: tan = opposing divided by adjacent.

I don't think I've ever used it for anything practical, but I can still reproduce it after all this time (I'm 47 now).

Re: Turns are better than radians

#229
post #220

Earlier quoted context omitted.

In most game engines, constructing the rotation matrix is trivial. Something like Quaternion.Euler(0, 45, 0). The ultimate position / rotation of any given object in a game is usually a compound transform computed via matrix multiplication anyway, e.g. a model view projection matrix. I'm not sure it's the best way, but that's just how most game engines work.

If your game engine is using quaternions as a canonical internal representation for rotations, it is already following my advice from above. (Game engine developers are smart people and have lots of practical experience with the benefits of avoiding angle measures, as do developers of computer vision, computer graphics, robotics, physical simulations, aerospace flight control, GIS, etc. etc. tools.)

Yea, I see. I originally interpreted your comment as being about game developers, but you were actually talking about game engine developers. In which case, we agree :)

Re: Turns are better than radians

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

[deleted]
Post reply on HN