Live data from Hacker News

Turns are better than radians

computerenhance.com

451–460 of 494 posts

Re: Turns are better than radians

#452
post #339

Earlier quoted context omitted.

The fact that it is natural doesn't make it performant and straightforward for all applications. For example linear algebra is the natural and general way to handle vectors. However game developers still find quaternions faster and more performant.

>The fact that it is natural doesn't make it performant and straightforward for all applications. How does changing the scale make anything more or less performant? If anything, it makes things less performant since to use any hardware supported trig functions you now have to convert your weird angle representation into radians. For simple addition or fractions of your angle, it is just as performant as using angles…

> How does changing the scale make anything more or less performant?

As the article shows, in application code we are multiplying by 2 pi, and the very first step in the optimized assembly is to divide by 2 pi. Therefore changing the scale to what both sides want saves 2 operations.

And why would the optimized version want that division? It is because the next step is to reduce down to a fixed range, then use a lookup table.

> They only use quaternions for a few things, like slerp, and mostly because of gimbal lock.

And yet they still do use them.

> For everything else they still use linear algebra, and linear algebra is used much, much more than quaternions for nearly any 3d program.

Re: Turns are better than radians

#453

> But math never decreed that sine and cosine have to take radian arguments! That is not entirely true. It comes from the relationship between those functions and the complex numbers via the Euler formula. ix e = cos x + i sin x There may be arithmetic/numerical inconveniences, but that's not all there is to "math". Let's define ncos and nsin ("nice cos, nice sin") as follows: nsin x = sin 2πx ncos x = cos 2πx So the…

It's simpler than that. Draw a circle of radius 1, and draw two lines through the center. The distance along the circumference between those lines is the angle between them in radians. If you really want to remove the multiplicative identity as a magic number, you can define the radian angle as the ratio of the subtended circumference over the radius.

IMO this is at least the most accessible argument for why radians are special, and while I don't pretend to understand complex exponentiation, I expect it's the root of why other math involving radians turns out nicely.

Re: Turns are better than radians

#454
post #357

Earlier quoted context omitted.

I see where you're coming from, if the formulas end up having weird numbers like 535.4916 or numbers like 2.718 or 6.28318 then obviously there's something suspicious about the equation. But small correction though. You got the number wrong, it's actually much more weird than any of those mentioned. The actual equation you come to for ncos an nsin is: (-1)^(2x) = ncos(x) + i nsin(x) And yes, -1 is a very weird number…

This is a very good point, but it took me a minute to get what you were saying beneath the snark. Translating without the snark: There's a famous equation relating sin and cos to complex exponentiation. It also helps explain the Taylor expansions of sin and cos, which is one way to compute them and to find properties about them. It's a very important equation. It is: ix e = cos x + i sin x kazinator's point was that…

Perhaps an even nicer equation:

    1^x = ncos(x) + i nsin(x)
using a multi-valued definition of the exponentiation on the left hand side.

Re: Turns are better than radians

#455

As already mentioned by others, radians are not arbitrary units for angles; in fact, they are the "natural" "units", so to speak. By definition, an angle is just the ratio of a circular arc ( s ) to its radius ( r ), θ = s / r (as an exercise, imagine how to apply this definition to the angle between two intersecting lines). When the length of the circular arc equals its radius ( s = r ), the angle subtended is exact…

A radian is 1turn/2pi.

It is not dimensionless.

A radian, or a turn, has a dimension: angle.

Saying 1radian=1 is just as senseless as saying 1m=1=$1.

It's true that abstract math often drops units because some things (like Taylor series) work nicely in certain units. That doesn't make the unit meaningless.

Street-Fighting Mathematics, thesis/book by Sanjoy Mahajan, shows what amazing things you can die in abstract math if you don't forget units.

Re: Turns are better than radians

#456
post #446

Earlier quoted context omitted.

All those approximations have error and the behaviour you describe depends on where you are on Earth. Moreover, degrees are not natural from a mathematical perspective.

Out of curiosity, given a degree/calendar/time system could one localize the culture that created it?

You can tell that 'gradians' (and 'decimal time') were created by the base-ten-obsessed French revolutionaries who brought us the metric system.

Re: Turns are better than radians

#457

Earlier quoted context omitted.

> Degrees are completely arbitrary Degrees are very natural in the context of ancient astronomy/astrology, where you have (1) ~365 days in a year, so that if you look at the path of something that takes a year you get about one degree change per day but with a number that is more easily divisible. (2) approximately 4y, 10y, 8y, 15y, 12y, 30y cycles for the moon and various planets. (3) A calendar with 12 months, 12 z…

All those approximations have error and the behaviour you describe depends on where you are on Earth. Moreover, degrees are not natural from a mathematical perspective.

[deleted]

Re: Turns are better than radians

#458
post #357

Earlier quoted context omitted.

I see where you're coming from, if the formulas end up having weird numbers like 535.4916 or numbers like 2.718 or 6.28318 then obviously there's something suspicious about the equation. But small correction though. You got the number wrong, it's actually much more weird than any of those mentioned. The actual equation you come to for ncos an nsin is: (-1)^(2x) = ncos(x) + i nsin(x) And yes, -1 is a very weird number…

This is a very good point, but it took me a minute to get what you were saying beneath the snark. Translating without the snark: There's a famous equation relating sin and cos to complex exponentiation. It also helps explain the Taylor expansions of sin and cos, which is one way to compute them and to find properties about them. It's a very important equation. It is: ix e = cos x + i sin x kazinator's point was that…

Isn’t this just changing units to suit your purpose?

Same way we might use electron volts rather than volts to make the equations nice.

Re: Turns are better than radians

#459
post #444

Earlier quoted context omitted.

> Try to formally define this procedure, though. You end up going in circles. The cos(x) + isin(x) formula gives us a way to find the point on the complex plane's unit circle corresponding to an angle x, given in radians. (Plus it does more, because the argument is complex valued.) The new formula with ncos and nsin does the same thing for an angle given in turns. E.g 0.25 (90 degrees): -1^(0.5) = i. It's understanda…

>It's understandable in terms of roots of -1. You seem to have missed the point. You need the formula I gave to rigorously compute the roots of -1. Of course, you could notice that (cos(x) + i sin(x))^n = cos(nx) + i sin(nx), but that's what I meant by "going in circles". You end up defining (-1)^x in terms of sines and cosines, making the "formula" trivial. It's difficult, working this way, to understand why (-1)^(1…

> You end up defining (-1)^x in terms of sines and cosines

But we are explicitly doing that; we have "nsin" and "ncos" on the other side, and those are explicitly defined as just cos and sin with a scale factor applied to the argument.

The goal is simply, if there is a goal, can we have a nice correspondence between complex exponentiation of some base and the scaled sine and cosine that work with turns.

Hey look; if we change the angle coordinate so that a full circle is just 1 rather than an irrational number, then the transcendental e disappears from our version of this famous equation.

Re: Turns are better than radians

#460
post #434

Earlier quoted context omitted.

The one that I still use is the 3-4-5 rule to ensure a right angle. Still use that one to chalk off sporting fields of play.

I use that one all the time, but that's Pythagoras, not sin and cos.

Yeah, I know it's not the same type of math, but it's one of the few things that I still use today. To be honest, I can't think of one time in my professional career that I have needed to calculate the area under a curve to solve a life problem. Geometry has been the most used branch of math past basic arithmetic, oh, and algebra. It amazes me the number of people that don't realize how many times in a day they have solved for X.
Post reply on HN