Live data from Hacker News

Turns are better than radians

computerenhance.com

271–280 of 494 posts

Re: Turns are better than radians

#271

Earlier quoted context omitted.

Why do they need to be at multiple integers of pi, instead of at half turns?

If you differentiate sin(x) with respect to x then you get cos(x), but only if your trig functions are using radians. Any other unit results in an extra coefficient appearing. That’s not an insurmountable problem, but radians are the fundamental unit here, not just an arbitrary choice.

I could forget something but sin'(ax) = cos(ax). If a is a constant factor.

Re: Turns are better than radians

#272
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 the opposite, Im 15 years into my career of applied research which for me is like an extension of university. I tend to lean on Mathematica to do my calculus though. I think high school curriculum was optimized to expose a lot of people to things they won’t need on the off chance that a few will end up as researchers of some sort. It would be more efficient to identify such people earlier and split them off. I think historically that was the idea but there has been an egalitarian push to broaden the pool.

Re: Turns are better than radians

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

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 humani…

I doubt the students would actually learn humanities in the extra time allotted if it's not used for math. I remember a distinct refusal to internalize, especially in my male peers, during "English" classes.

Re: Turns are better than radians

#274
post #267

Earlier quoted context omitted.

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 humani…

My biggest “Screw everything” moment about math was the first lecture of my numerical methods class in college when the professor said: “All that calculus you’ve been learning your whole lives? It’s useless. Carefully curated set of a few dozen problems that are doable by hand. Here’s how it’s really done for anything remotely practical” And then we learned a bunch of algorithms that spit out approximate answers to a…

100% agreement on teaching stats as the "pinnacle" of high school mathematics. Those are what directly rule the lives of the average non-engineer.

Re: Turns are better than radians

#275
post #269
post #231

Earlier quoted context omitted.

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.

> 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. That's what it would be if you are using sin in degrees and cos in radians. But if you are using degrees for both then the derivative of sin(x) is pi/180 cos(x).

Yup, I knew I'd mess it up. :D

Re: Turns are better than radians

#276
post #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.

The abstraction Unity provides allows you to do neat things without fully understanding the math behind it. But if you don't also learn the math, now you are limited by what those abstractions allow you to do and by the performance cost due to the fact that these abtractions can't make good use of special-case information that would be available to you if you handcrafted the operation.

It is perfectly legitimate to rely on abstractions a lot of the time because it's safe and easy, and _also_ want to roll your own manipulations sometimes, because 1) when you're accustomed to solving weird trig problems with trig, that's the most straightforward way to write the code, or 2) for performance, which, for a game developer, I think ought to be a major concern.

Re: Turns are better than radians

#277
post #266

Earlier quoted context omitted.

>> 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. That's nice, but as the article points out most implementations of trig functions on computers don't use things like Taylor series. Another terrific use of turns is in calculating angle differences, where you take a difference and…

That's an obfuscation from the blog post. If you read further down in the code that is mentioned, the actual computation of sin is done by a polynomial expansion in x (radians), not y (turns). The purpose of y is mainly in case x is more than pi, and if so, what the corresponding angle in [0,pi/4) is.

You can if you want make a polynomial in turns. The CPU isn’t going to care one way or the other.

Implementations which are accurate in terms of turns even for values close to half a turn can be useful for avoiding numerical issues that sometimes pop up because π is not exactly expressible as a floating point number. These functions usually names like sinpi, cospi, etc. It would be nice if they were provided more often in standard libraries.

Re: Turns are better than radians

#278
post #56
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 sine and cosine that are defined with Taylor series are not the same sine and cosine that are defined for right triangles. The former are R->R functions, while the latter are defined on Angles (Angle is unfortunately not an SI physical dimension yet, but I expect it soon to change), and they don't care about the measurement unit. I have no idea what you mean by radians generalizing for higher dimensions, but not…

sine and cosine are functions from ℝ->[-1,1]. They don't take in a value which has a unit, or even a dimension, they take in a real number.

sin(x) is precisely the unique function f(x) such that f''(x) = -f(x). Similar to how exp(x) is the unique function g(x) such that g'(x) = g(x).

Sine does not operate on 'angles measured in radians'. It operates on real numbers. It is zero whenever the real number passed in is a multiple of pi. It happens to have applications in relating angles to distances in circles and triangles, and in order to use sine in that context it is useful to introduce the concept of a 'radian' as a specific, constructed angle of a particular size, such that when you express an angle in terms of multiples of a radian, you can just use the sine function to generate useful values.

Re: Turns are better than radians

#279
post #222

Earlier quoted context omitted.

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 seri…

If any of those libraries uses the Taylor expansion for approximation, that is a big mistake, because the approximation error becomes large at the upper end of the argument interval, even if it is small close to zero.

What is much more likely is that if you will carefully compare the polynomial coefficients with those of the Taylor series, you will see that the last decimals are different and the difference from the Taylor series increases towards the coefficients corresponding to higher degrees.

Towards zero, any approximation polynomial begins to resemble the Taylor series in the low-degree terms, because the high-degree terms become negligible and the limit of the Taylor series and of the approximation polynomial is the same.

So when looking at the polynomial coefficients, they should resemble those of the Taylor series in the low-degree coefficients, but an accurate coefficient computation should demonstrate that the polynomials are different.

Re: Turns are better than radians

#280

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.

I'd argue it's not so much taught in the US as it is tested. The common core standards say [0] that students should:

> Understand radian measure of an angle as the length of the arc on the unit circle subtended by the angle.

> Explain how the unit circle in the coordinate plane enables the extension of trigonometric functions to all real numbers, interpreted as radian measures of angles traversed counterclockwise around the unit circle.

and so on. However, in practice, this means that students need to be able to answer "C" when presented with the question:

> One radian is:

> A) Another word for degree.

> B) Half the diameter.

> C) The angle subtended on a unit circle by an arc of length 1.

> D) Equal to the square root of 2.

A surprising number of students can get through without ever really comprehending what a radian is. They might just choose the longest answer (which works way too often), identify trick answers and obviously wrong answers, and eventually guess the teacher's password from a lineup by association of the word salad of "radians" and "subtended."

They might not even have a clue what the word "subtended" means, but they know it's got something to do with "radian" and that's enough. It is more important for the school that the students answer (C) than that they understand what a radian is.

[0] https://web.archive.org/web/20220112000314/http://www.corest...

Post reply on HN