Live data from Hacker News

Turns are Better than Radians (2022)

computerenhance.com

211–220 of 225 posts

Re: Turns are Better than Radians (2022)

#211

Earlier quoted context omitted.

1^x = 1 for any complex x. So that library can be very simple and fast!

Wrong. 1^x is multi-valued, and like with all other multi-valued complex functions it is possible to select a branch of the function that is a proper function. Defined correctly, the value of 1^x for any rational x is the corresponding smallest root of unity, and for irrational arguments it is defined by continuity. Therefore 1^x rotates on the unit circle for increasing x. The standard complex exponential and comple…

>The standard complex exponential and complex logarithm functions are defined exactly in the same way, because they are also multi-valued, so the same kind of equalities like yours would also be true for them.

Example values of e^z and 1^z:

e^2 ~= 7.389

1^2 = 1

e^(i\pi) =-1

1^(i\pi) = 1

e^-7 ~= 0.000912

1^(-7) = 1

e^(1+i) ~= 1.46869394 + 2.28735529 i

1^(1+i) = 1

Re: Turns are Better than Radians (2022)

#212

Earlier quoted context omitted.

Your argument is correct and I'm sure you're really smart and all that. However, Proportion of code where radians are used to represent rotation in 2D (i.e. turns): 99.9999% Proportion of code where radians are used to perform higher degree derivatives, symbolic computation, etc: 00.0001%

That is true, but only due to a historical accident, which has been preserved by the inertia of the mathematical education system. The use of the trigonometric functions with arguments in radians, which are unfortunately standard in most programming languages, wastes time and introduces unnecessary rounding errors at each function evaluation. The functions with arguments in cycles perform exact argument reduction ins…

Thanks for agreeing with me, GPT.

Re: Turns are Better than Radians (2022)

#213
post #124

Earlier quoted context omitted.

> The natural logarithm being its own derivative the derivative of ln(x) is 1/x > the derivative a radians-based sin(x) being cos(x) and so on. Make it any other unit, and you have a mess of conversion factors worse than 2pi. the derivative (with respect to x) of sin(x) is cos(x), regardless of units for x. Otherwise the chain rule wouldn't work

> the derivative (with respect to x) of sin(x) is cos(x), regardless of units for x. Not if you use "turn"-trigonometric functions, as the author suggests. turn-sin `t sin(x) = sin(2pi * x)` has `d/dx tsin(x) = 2pi * tcos(x)`.

such a weird thread because everyone seems to know what they are talking about but definitely seem to miss something.

but basically one would be differentiating to 2pi x rather than x. and things will work out

Re: Turns are Better than Radians (2022)

#214
post #10

Very bold title! Turns are very convenient until you need to calculate a rate of change, as of course d/dx sin(2pi x) = 2pi cos(2pi x). Unfortunately this is a common enough problem that I will be sticking with the radian.

but surely u differentiate by turns?

Re: Turns are Better than Radians (2022)

#215
post #53

Earlier quoted context omitted.

I basically agree, at least for standard functions like sin, cos, tan, exp etc. It is even possible to see mistakes in equations just by checking that all the units to standard functions cancel out making the arguments dimensionless. On the other hand I am still unhappy with calling the ratio of two quantities, that happen to have the same units, "dimensionless". This way, you could create any two "dimensionless" qua…

This is a great paper from NIST that gets into some of the problems with the limit of ‘dimensionlessness’ in metrology and the SI, and in particular issues like the fact that Hertz is considered a coherent SI unit but radian isn’t. https://www.nist.gov/publications/dimensionless-units-si A key takeaway: > one conclusion that is not optional is that the unit hertz cannot be regarded as a coherent unit of the SI, in co…

Really interesting read, thank you!

One thing I found especially interesting: They argue that you can express the (complex) exponential function exp(x) as a power series with powers x^k. They do not say it explicitly, but if we assume the power series comes from a Taylor series, then the k-th factor 1/(k!) is the derivative evaluated at x=0. And the k-th derivative has exactly the unit needed to cancel the unit of x^k. So, all summands of the series are unitless and hence the exponential function's argument is unitless.

This argument would hold for any function which can be written as a series like this. I am wondering whether this is actually a "problem" of the derivative operator.

Re: Turns are Better than Radians (2022)

#216

Earlier quoted context omitted.

I think it's Tau[0]. [0] https://en.wikipedia.org/wiki/Tau_(mathematics)

You either (i) don't know the Greek alphabet, or (ii) can't read people's short posts. I literally mentioned tau and why it might be a silly name (it clashes with other mathematical uses of the symbol tau). First sentence of the Wikipedia link: > The number τ (spelled as tau)

Your short post in full:

> In another comment, I asked why people chose to use the symbol τ over just writing turn or "rev(olution)" (defined to be the constant ≈ 6.28318530718) given how unambiguous the latter is as a name for 2π. And why not just write sinrev() or sinturn(), and leave the symbols sin() and rev (defined to be ≈ 6.28318530718) alone?

You were asking why they used the symbol τ rather than the words "rev" or "turn". You didn't give a clue that you knew any of the rest, including what the symbol meant.

Re: Turns are Better than Radians (2022)

#217

Earlier quoted context omitted.

Dimensions and units are separate things, though. For example, 1 minute and 1 second are different units of the same time dimension. Similarly, 1 rad and 1 degree are both dimensionless, but they are both different units.

Theoretically, you can define systems of measurement where a lot of seemingly separate things fall on the same units and dimensions. There are "natural units" in physics where you take the fundamental nature of particles and relativity into account and make some convenient choices for some physical constants such as the speed of light c := 1. Then the speed becomes dimensionless, length and time have the same unit an…

> Then the speed becomes dimensionless, length and time have the same unit and dimension

Uh, that is not what the article you linked is saying. Natural units don’t make speed dimensionless, nor allow you to use the same unit for length and time. Natural units remove the conversion constants, not the units or dimensions.

Re: Turns are Better than Radians (2022)

#218
post #145

Let's do a full circle. It all began with replacing frequent occurrence of 2π in calls of sin and cos functions with τ. This post suggests an optimisation by getting rid of τ by getting rid of radians. That way one can get rid of frequent and adjacent radians to degrees conversions and back. I say, let's get rid of sin and cos itself ! Of course I am being over the top here. However, if you represent angle not as a s…

>As an API it might not be convenient but consider converting angles internally into a tuple of sin and cosine My friend, it's called a complex number . A unit complex number, to be specific. >Recall rotation is a linear transformation with a matrix whose entries are in terms of sin and cosine. That's what multiplication of complex numbers is. Can't wait till people here rediscover that a 3D rotation matrix has an ax…

> Can't wait till

You have to wait and inordinate amount of negative time then.

Or maybe it's us who has to do the waiting for you to catch up on what HN folks in general are knowledgeable about.

I have a suggestion. Scroll to the bottom of this page. You will find a search box. Plug in the names of concepts you were thinking of. Enjoy.

To be honest, I too have come close to sounding a smug clueless smartass in my youth - lectured a guy on longest common subsequence not knowing that he was the original author of the file compression utility on AT&T Unix that used the same several decades ago.

Re: Turns are Better than Radians (2022)

#219

I think I cautiously agree with this notion to some extent, but IMHO the real answer is that it's application-dependent, and if you're writing a low-level trig library and you have to pick one or the other, it really isn't clear to me that turns should win over radians. I expect many systems that use trigonometry would sometimes use small-angle approximations either for efficiency or to bootstrap to the general case.…

Why are math libraries consistently treated as space hogs if you don't keep them as barebones as possible? I've had sinDeg/cosDeg overloads for a while and I don't see why they can't be built into the base library; the same would go for a sinT/cosT that takes turns instead of radians or degrees. Why do we have to pick one and meticulously avoid having multiple?

Re: Turns are Better than Radians (2022)

#220
post #2

I like to store angles as turns in my own code, because (as noted) it makes quarter-turns computable without rounding. OTOH if you need, say, twelfths of a turn, you might want to just store angles as degrees since that’s already common. Michael Spivak, in Calculus (3rd ed p. 301) considers the unit choice to be a property of the function and initially defines sin° and sinʳ (before settling on sin meaning sinʳ) and c…

I don't think of it as units (as the sibling comment pointed out, angles are dimensionless); I think of ° as a postfix unary operator that does the conversion. In other words, I read sin(x°) as a shorthand for sin(x*Pi/180).
Post reply on HN