Live data from Hacker News

Turns are better than radians

computerenhance.com

111–120 of 494 posts

Re: Turns are better than radians

#111
post #96
post #3

Earlier quoted context omitted.

... and the derivative of sin(x) is ... ?

> and the derivative of sin(x) is ... ? I believe it's cos(x). And I fail to see how that would change regardless of what unit x is expressed in. Sorry, my trig is veeery rusty.

Only when the angle is in radians ...

Re: Turns are better than radians

#112
Indeed, maths never "decreed that sine and cosine have to take radian arguments". But thinking that makes any sort of point is a fundamental misunderstanding of maths.

There are infinitely many sinusoidal functions out there. You can just adjust amplitude, frequency and phase to your heart's content.

Trigonometry basically requires that sine and cosine have specific amplitudes and phases, but gives not one shit about how you map angles to frequency. Degrees are completely arbitrary, but both radians and turns have pretty natural definitions, with turns indeed being the easiest to work with. So far so good.

Calculus does have an opinion on frequency, though. There is exactly one non-trivial pair of sinusoids s(x) and c(x) where c'(x) = - s(x) and s'(x) = c(x), among a bunch of other very useful properties.

When you put calculus and geometry together, s and c are have the same amplitude and phase as sine and cosine from geometry, and the two pairs are exactly the same if you match the frequencies such that the argument is the angle measured in radians. It's just so damned useful to use angles in radians and make everything play together nicely.

Re: Turns are better than radians

#113
post #85
post #71

Earlier quoted context omitted.

Or just defining the result of division by zero as zero "for safety": https://www.hillelwayne.com/post/divide-by-zero/ It boggles the mind, truly!

Are you claiming the author is incorrect that x/0 = 0 is mathematically sound?

Depends how you define “soundness”, but the idea of prolonging a function out of its definition domain with an arbitrary value that doesn't make it continuous is arguably a curious one.

From an algebra perspective (the one given in the blog post) it may be fine, but from a calculus perspective it's really not.

The lack of continuity really hurts when you add floating points shenanigans into the mix, just a fun example:

When you have 1/0 = 0 but 1/(0.3 - 0.2 - 0.1) = 36028797018963970. Oopsie, that's must be the biggest floating point approximation ever made.

Re: Turns are better than radians

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

sin(x) ~~ x only in radians, so honestly that's reason enough. Once in a while we get programmers wanting to disrupt mathematical notation for whatever reason... Worst I've seen so far was one arguing that equations should be written with long variable names (like in programming) instead of single letters and Greek letters. Using turns because it's a little easier in specific programming cases is just as short-sighte…

LOL

Re: Turns are better than radians

#116
post #106

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…

> you always have to go back to radians to actually do calculation. The article actually argues the opposite: that the common implementations of sine and cosine start by converting their radian based arguments to turns or halfturns by dividing by pi.

This is not the common "implementation" of sine and cosine, its the common argument h, in his use case, he tends to want to calculate turns and half turns most often. He might be able to refactor his functions to optimize for this, but its not exactly something I would expect to be a good idea for library code, people do want to calculate other angles.

Re: Turns are better than radians

#117
Fun fact: PICO-8 only provides turn-based trigonometric functions

https://pico-8.fandom.com/wiki/Sin

> PICO-8 uses an input range of 0.0 to 1.0 to represent the angle, a percentage of the unit circle. Some refer to these units as "turns". For instance, 180° or π (3.14159) radians corresponds to 0.5 turns in PICO-8's representation of angles. In fact, for fans of τ (tau), it's just a matter of dropping τ from your expression.

Re: Turns are better than radians

#118

Earlier quoted context omitted.

sin(x) ~~ x only in radians, so honestly that's reason enough. Once in a while we get programmers wanting to disrupt mathematical notation for whatever reason... Worst I've seen so far was one arguing that equations should be written with long variable names (like in programming) instead of single letters and Greek letters. Using turns because it's a little easier in specific programming cases is just as short-sighte…

Whats wrong with long variable names?

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)

Re: Turns are better than radians

#119
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

Basic trig is taught in middle school, but exclusively using degrees. Advanced trig is optional in high school if you take the "hard math" track.

Post reply on HN