Live data from Hacker News

Turns are Better than Radians (2022)

computerenhance.com

121–130 of 225 posts

Re: Turns are Better than Radians (2022)

#122

The math is definitely not fine with turns, because your Euler formula e^ix = cos x + i sin x no longer holds. We can use a base other than e , namely B = e^2pi which around 535.4916. This doesn't have the nice e properties like d/dx e^x = e^x. The elegant fact that the base of the natural logarithm, which produces an exponential function that is its own derivative, also shows up as the basis for the above Euler's fo…

The author's not talking about doing math, but about porting math into code. Counting turns is the same as counting cycles. People do that all the time. It works fine. And this math is kind of a mess. exp(x) is its own derivative but the log is not. (d/dx)log(x) = 1/x But, agreed, if you're going to do calculus, use radians.

> The author's not talking about doing math, but about porting math into code.

If your code doesn't look like the math it's "ported" from, the odds of it being bad code go up like 100x

Re: Turns are Better than Radians (2022)

#123

The math is definitely not fine with turns, because your Euler formula e^ix = cos x + i sin x no longer holds. We can use a base other than e , namely B = e^2pi which around 535.4916. This doesn't have the nice e properties like d/dx e^x = e^x. The elegant fact that the base of the natural logarithm, which produces an exponential function that is its own derivative, also shows up as the basis for the above Euler's fo…

For graphics rendering Euler equation doesnt matter. Colours are 0.0-1.0 and have no relation to reality, but it works. Same with rotations (if we’re not using Quaternikns)

> For graphics rendering Euler equation doesnt matter.

Huh?? "Euler angles" are one of the most popular representations in computer graphics! The only other good alternative is quaternions, where as you say this also matters!

Re: Turns are Better than Radians (2022)

#124

The math is definitely not fine with turns, because your Euler formula e^ix = cos x + i sin x no longer holds. We can use a base other than e , namely B = e^2pi which around 535.4916. This doesn't have the nice e properties like d/dx e^x = e^x. The elegant fact that the base of the natural logarithm, which produces an exponential function that is its own derivative, also shows up as the basis for the above Euler's fo…

> 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)`.

Re: Turns are Better than Radians (2022)

#125
post #106

Earlier quoted context omitted.

This is precisely why (programming language) types are poor model of physics units, despite often being touted for this exact use case. 3m is not the same thing as "the value 3 of type meter". It is the multiplication of the dimensionless scalar 3 with the special "m" constant for meters. That's why pow(3m, 2) = 9 m^2, and not `the value 9 of type meter`. Of course, you can define the type `square meter` as well, and…

> with the special "m" constant for meters. Isn't the "special constant" exactly "value 1, type meters", defined as equal to "value type atoms" etc? If not, then what would be the result of the multiplication of 3 with "m"? > Of course, you can define the type `square meter` as well, and define `pow -> meters -> positive integer -> square meters` As long as your power is an integer, you can reduce it to multiplicatio…

> If not, then what would be the result of the multiplication of 3 with "m"?

The answer is not, and the result of 3 multiplied by m is 3m. Just like 3 multiplied by pi is 3pi; or, perhaps more accurately, you can view m as a kind of vector unit, and 3m as the scalar product. Of course, none of this is exactly matching - dimensions are different from irrationals, vectors, complex numbers, etc, they are mostly a thing of their own.

> What this gets you in the end is a type algebra, but that is also not exactly a new concept.

Sure, that's why I said specifically programming language types. I am aware that type theory has way more complex operations on types. I think some of these may even be expressible in Idris or Haskell + some appropriate extension. But in almost all programming languages, even ones like OCaml, SML, plain Haskell, Rust, C++ with template magic, Scala, F# and what have you, there is no way to specify that the result of multiplying two values of type A is of type "A * A", especially not in a way that then allows you specify that the division of a value of type "A * A" by A has type A. So types as exposed in any of the common programming languages are horrible for modelling dimensions as used in even high school physics.

Re: Turns are Better than Radians (2022)

#127
post #110

Earlier quoted context omitted.

Ensuring units agree is indeed a form of type checking. A more thorough procedure for the former is dimensional analysis. I think the fact that action and angular momentum have the same units played an illuminating role in making sense in Bohr's model regarding why only certain orbits are allowed. Not sure how that would play out once angle is considered a fundamental entity. This sure is a rabbit hole. Thanks for yo…

In another comment I made in this thread https://news.ycombinator.com/item?id=49373317 I think it came to the understanding that a "turn" is similar to a dimensionless quantity, as it takes the full circle/cycle as a fundamental 1. Apparently, using the turn as a unit allows one to get rid of pi and e in Euler's formula in favor of 1 and -1.

Yeah. @ttoinou too, I think, had the same thing in mind.

https://news.ycombinator.com/item?id=49371421

Re: Turns are Better than Radians (2022)

#128

The math is definitely not fine with turns, because your Euler formula e^ix = cos x + i sin x no longer holds. We can use a base other than e , namely B = e^2pi which around 535.4916. This doesn't have the nice e properties like d/dx e^x = e^x. The elegant fact that the base of the natural logarithm, which produces an exponential function that is its own derivative, also shows up as the basis for the above Euler's fo…

I can only imagine what a ridiculous problem it would be to try to re-do, for example, the Vincenty formula for distance between two latitude/longitude points on an oblate spheroid (the earth) if it couldn't use radians. https://en.wikipedia.org/wiki/Vincenty%27s_formulae https://www.johndcook.com/blog/2018/11/24/spheroid-distance/ Further, inverse vincenty is pretty much an essential in anything that needs to find t…

I absolutely love how full Wikipedia is of completely useless pages like the Vincenty's Formulae one, where someone has just gone "look this is what it says in my maths textbook" without any explanation.

No discussion of why you'd use this over for example the Haversine function, of course, just a straight out copypasta and a demonstration of how clever someone is at the mathematical notation markup.

Incidentally you'd use this instead of Haversine if you wanted to be really really accurate down to millimetres across a long baseline, as opposed to lots and lots of "it's ten miles that way in a straight line" very quickly and simply.

Re: Turns are Better than Radians (2022)

#129
post #53

Earlier quoted context omitted.

You generally can’t apply functions to dimensional units. The only thing units can do is be multiplied or divided together. So I can multiply a mass by a distance or divide a distance by a speed, and I can multiply the result by a scalar; but I can’t take the sine of a distance or the logarithm of a time or exponentiate a mass. Those are things I can only do to scalars. ‘But wait!’ You may cry: ‘the formula for a tra…

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…

You can also create meaningless dimensionless quantities by blindly mashing the number keys on your keyboard. Should we stop using keyboards?

Re: Turns are Better than Radians (2022)

#130
post #123

Earlier quoted context omitted.

For graphics rendering Euler equation doesnt matter. Colours are 0.0-1.0 and have no relation to reality, but it works. Same with rotations (if we’re not using Quaternikns)

> For graphics rendering Euler equation doesnt matter. Huh?? "Euler angles" are one of the most popular representations in computer graphics! The only other good alternative is quaternions, where as you say this also matters!

Yes, but do you really need to scale all your values to make the rotation amount fit into a sin() call, only to have to scale them back again when you're done?

I think what they're getting at is "why are we scaling everything so one full turn is sin(6.28ish) when we can just say sin(1)?"

You could easily try it out by defining a function that replaces sin(), cos(), and tan() with their "turn" equivalents, and seeing how you get on.

Post reply on HN