Live data from Hacker News

Turns are Better than Radians (2022)

computerenhance.com

181–190 of 225 posts

Re: Turns are Better than Radians (2022)

#181
post #177
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…

That will introduce an interesting new bit-bending avenue since almost all tuples of floats are not valid angle representations in that form.

Good point.

If you also incorporate scale then it is, otherwise they need to be unit normalised.

The unnormalized case is essentially a complex number.

Re: Turns are Better than Radians (2022)

#182

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…

That formula as such has no importance at all, it is just a correspondence between different notations. What you really mean is that there are certain mathematical problems where the complex exponential function is useful and for the complex exponential it is more convenient to measure the real part in nepers and the imaginary part in radians (in order to have a simple formula for computing its derivative and its pri…

It’s good to know you don’t want your house powered by AC power anymore. It’s a weird take, but you do you.

Re: Turns are Better than Radians (2022)

#183

Earlier quoted context omitted.

That formula as such has no importance at all, it is just a correspondence between different notations. What you really mean is that there are certain mathematical problems where the complex exponential function is useful and for the complex exponential it is more convenient to measure the real part in nepers and the imaginary part in radians (in order to have a simple formula for computing its derivative and its pri…

It’s good to know you don’t want your house powered by AC power anymore. It’s a weird take, but you do you.

As I have already said, and I am an electronics engineer, the design of any electrical or electronic system, including anything that uses AC power, can be done faster and with less numerical errors, if instead of using complex exponentials one uses 2 other exponential functions: "2^x" and "1^x", with arguments and value domains as I have written above.

Unfortunately, this requires the use of a custom library of transcedental functions, because the standard libraries of most programming languages provide only the functions with arguments in nepers and radians.

The standard C library has attempted to add the missing functions, but for a completely impossible to understand reason the standard has defined wrongly the trigonometric functions, requiring arguments measured in half cycles, instead of cycles.

This is an extraordinarily stupid mistake, but at least if a standard C library implementation has all the functions, it is easy to modify the sources of the trigonometric functions with arguments in half cycles, to take arguments in cycles instead.

Re: Turns are Better than Radians (2022)

#184

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…

The radians provide absolute no help for your problem.

There are alternative trigonometric functions with the argument measured in cycles that can be used instead of those with argument measured in radians. All formulae written with sin, cos and atan can be rewritten with sin2pi, cos2pi and atan2pi, or whatever names you want for those functions.

Moreover, before the electronic computers, nobody in the entire history of mankind had used trigonometric functions with arguments measured in radians for any practical problem, like astronomical or geodesy problems.

The radians became popular in the 19th century, only for symbolic computations, because they simplify the formulae for derivatives and primitives.

For all numeric computations, even in the 19th century, nobody used trigonometric functions with arguments measured in radians, but only trigonometric functions with arguments measured in sexagesimal degrees, which behave much more similarly to the functions with arguments measured in cycles, than to the functions with arguments measured in radians, which cannot be computed exactly for any rational argument, and where the argument can never be reduced exactly to a value in the first quadrant.

While the trigonometric functions with arguments in radians are harmful, the constant 2Pi remains an essential constant, which must be used to convert between the length and the central angle that correspond to a circular arc, and also to compute the derivatives and primitives of the exponential 1^x and of the trigonometric functions.

Re: Turns are Better than Radians (2022)

#185

Earlier quoted context omitted.

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…

Writing full articles takes time and effort. But the effort is cumulative, so these stub articles are really just the start. Some of the comment you made here would definitely improve the article. You are always welcome to edit and improve Wikipedia. I mean this literally and sincerely, it is one of the few places on the internet where you might benefit from posting.

It's not a "stub article" though, it's just a paragraph and then a bunch of stuff plagiarised from a maths textbook.

I already edit quite a bit on Wikipedia. I stay away from the maths bits, because it's a little outside my area of expertise - and because it's just things like "it's a function to calculate distance, and here's ten pages of algebra with no explanation" I can't really improve that on Wikipedia.

Re: Turns are Better than Radians (2022)

#186

Earlier quoted context omitted.

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…

You might enjoy the much longer and more detailed article https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid which discusses the context.

I've read that, quite some time ago, which is how I understand how the Haversine function works. Kind of. A bit. Enough to make it work, anyway.

Re: Turns are Better than Radians (2022)

#187

Earlier quoted context omitted.

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…

It would sure be better if it had some concrete explanations and examples why vincenty is preferred. It's also barely any more computational load on modern computers so very little reason not to use it. Haversine is strongly deprecated in even short distance applications like planning a 35 km point to point licensed band radio microwave link, because you risk having both slightly the wrong distance and the azimuth fi…

I've actually implemented Haversine in a SQL query to find what can be summed up as "which of these moving things is closest to this thing right now". It's not the tidiest, and I had to ask someone better at SQL than I am to make it entirely work, but it looks like it is easier than doing Vincenty.

I should try it, right?

Edit: I also wonder what's to be gained by being accurate to nanometres over the surface of a fairly inaccurate planet.

My application was to locate movable things to identify which was nearest to a moorland wildfire, where you need to be accurate to within about 1km at best - you don't need to drop the pin right on it, you'll know where you're going when you see it ;-)

Re: Turns are Better than Radians (2022)

#188
post #122

Earlier quoted context omitted.

> 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

I tried to make my code exactly match the math it came from, but I didn’t have enough memory to store sqrt(2)

What? "sqrt(2)" is literally 7 bytes. :)

Re: Turns are Better than Radians (2022)

#189
post #63

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…

> 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. I mostly agree with your explanation, but wou…

The reason for preferring functions defined over domains like R is that it’s a field, and so I can do things like multiply and divide and add and subtract inside it.

If instead we start defining ‘amounts of distance’ as some set D and ‘amounts of time’ as some set T, I have all sorts of extra work to do to make it so that products of amounts of distance are ‘amounts of area’ and amounts of distance over amounts of time are ‘amounts of speed’.

‘Dimension’ is the mathematical tool that lets us bundle all that up into something that we can deal with separately, alongside a real number. And of course you can totally make functions that are dimensional - but it affects what you can do with your functions, like composition and differentiation.

Re: Turns are Better than Radians (2022)

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

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 contrast to its designation in the current form of the SI, where cycles are ignored and Hz may be replaced by s^−1

Post reply on HN