> 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 then what do we make of:
ncos x + i nsin x
This has to be
cos 2πx + i sin 2πx
which is then
2πix ( 2π) ix ix
e = ( e ) = f
2π
Where f = e is a weird number like 535.4916. This f doesn't have nice properties. E.g.:
d x x
- f /= f
dx
Otherwise it works; for instance 90 degrees is 0.25 and surely enough
0.25i
f = i
In situations not involving e in relation to angular representations via Euler, f cannot replace e.
I'm all for having parallel trig functions in libraries that work with turns, though.
The annoying 2π factor shows up in lots of places though. Should way, say, in electronics, redefine a new version of capacitive reactance which doesn't have 2πf in the denominator, but only f?
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. If you take it to the power of something divisible by 2 you get itself raised to zero. What's up with this spooky periodicity? Also if you have x=1/4, then we get weird numbers like sqrt(-1) what on earth is that all about? No way that will fly, no way. No I'll take my 2.718^((-1)^(1/2)) and multiply through with 6.28318 that way I don't have to bother understanding what I'm doing I can sleep comfortable at night knowing that someone else has done all the thinking that needs to be done on the matter, and that turns or rotations are a blasphemous concept that breaks the very concept of math through scaling of an axis. You'd think math was strong enough to withstand such a minor change, but the textbooks do not mention it thus it must not be contemplated!
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 this equation relies on cos and sin taking radians as arguments. If they take turns instead, then you need to insert messy extra constants to state this equation!
jVinc's counter-point, made with lots of snark, is that there's an equation that's even nicer if you just instead measure angles in turns with ncos and nsin:
(-1)^(2x) = ncos(x) + i nsin(x)
It's similar, but doesn't require the magic constant e.
A proof sketch that these are equivalent:
(-1)^(2x) = e^ln((-1)^(2x)) = -e^(2x) = e^(i * (2 pi x)) using e^(pi i) = -1
That's a nice result. If we rearrange the products in the exponent we get
2πix πi2x ( πi ) 2x
e -> e -> (e )
Where e^(πi) is -1. That shows there is something to the turns units; we can express the analog of the Euler identity using exponentiation using a base and factor which are integers.
> Because you’re obscuring the connection of sin/cos with their hyperbolic counterparts.
Only because we forgot the name change: these are supposed to to be nsin and ncos.
Remember also that people use sin and cos with 360-degree degrees just fine; and don't worry about wrecking the connection to the hyperbolic counterparts --- and without changing the names, either.
That version of euler's formula might make a nice case for half turns. Then it's just
(-1)^x = ncos(x) + i nsin(x)
It's obvious how to handle it for integers (an even number of half turns is 1, an odd number is -1), and the extension to real numbers aids the intuition.
Or, depending on your focus, quarter turns are very clean too:
i^x = ncos(x) + i nsin(x)
Either way, turns > radians (it's what I think in when doing most fourier kinds of work anyways!).
>The actual equation you come to for ncos an nsin is:
>(-1)^(2x) = ncos(x) + i nsin(x)
Try to formally define this procedure, though. You end up going in circles.
Here's another version:
lim[N->infinity] (1 + ix/N)^N = cos(x) + i sin(x)
Now there are no "weird numbers", and both sides of the equation can be calculated directly, even by hand if you wanted.
If all you're teaching students is a bunch of formulas to be memorized, the (-1)^x notation is kind of cute. But usually when teaching math, we want to build some kind of understanding.
> 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 understandable in terms of roots of -1.
When you want to know the principal N-th root of number on the complex plane, you can simply divide its argument (i.e. angle) by N. The other roots are then equidistant points around the circle. So for instance, the square root of -1, which is sitting at 180 degrees, is found at 90 degrees, and is therefore i.
We can use -1 as the reference for measuring angles. The turns unit (one circle) is twice as far around the circle as as -1, so that's where we get the 2. Because 90 degrees in turns isn't 0.5, but 0.25.
We could use 1 directly, but then we need the first complex root of unity. For instance, here is the Wikimedia diagram of the fifth roots:
That root which is close to i, has an angle which is exactly 1/5 turns. There is a relationship between turns and roots of unity, because N roots occupy N equidistanct points on the circle spaced by 1/N turns.
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/3) is (1 + isqrt(3))/2 and not just -1.
By contrast, the Bernoulli formula is actually computable. In fact, the CORDIC algorithm corresponds quite closely to computing the Bernoulli formula by repeated squaring. The use of arctan(2^(-n)) is just like taking (1 + i2^(-n))^(2^n).
There's a reason why math is structured the way it is.
> 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.
> 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.
Well, 2.718 is different than those numbers, because the derivative of 2.718^x is 2.178^x, which is a very interesting property of 2.718. The same cannot be said about 535.4. (6.283 is the ratio of a circle's, diameter to radius, which is just something intrinsic to the universe. I think it even transcends the universe, but that's hard for me to reason about. But basically, both 2*pi and e are fundamentally interesting.)
But it really has nothing to do with the universe, except insofar as maths happen to (imperfectly) match it.
Presumably if the universe seemed to match some other maths, we would have invented that variety instead. The Greeks knew the Earth was round, yet made up plane geometry; and never touched on spherical geometry, as far as we know.
Astonishingly, the concept of the number line did not surface until 2000 years later. With the number line, school children can do on command what the best mathematicians of antiquity struggled with for centuries.
If you're not using derivatives, integrals, or complex numbers, maybe you'd be better off using Wildberger's "rational trigonometry" with quadrances and spreads instead of angles? I haven't actually tried it myself. Wildberger's motivation is a sort of ultra-strict Platonism* mixed with the desire to extend analytic geometry to fields other than the real numbers, though, so it wouldn't be surprising if it wasn't actually a simpler way to write Asteroids. Doing trigonometry in Galois fields sounds super cool though and I hope I understand it one day.
Alternatively you can just directly represent angles as unit vectors in the desired direction, which is pretty much the same as using complex numbers. Angle addition is complex multiplication, angle bisection is complex square root, and computing the sine and cosine is simplicity itself. (This takes twice as much space. If you choose to store only the real part of the complex number, you can only represent angles up to half a turn, same as in Wildberger's approach, you lose some precision near the limits, and the other operations require some extra computations.) I have tried this, for example in http://canonical.org/~kragen/sw/aspmisc/my-very-first-raytra... and https://gitlab.com/kragen/bubbleos/-/blob/master/yeso/sdf.lu..., and in the cases I've tried it, it works great.
I'm interested to hear other people's experiences on this count!
______
* His main concern is that irrational numbers don't, in some sense, really exist, so they're a bad basis for trigonometry. As I understand it, not only is Platonism now a minority among foundations-of-mathematics types, but even Platonists generally believe that irrational numbers are just as real as rational ones, so as I understand it, Wildberger's viewpoint is held by quite a small minority. That doesn't, of course, imply anything about whether it's correct.
I never saw rational trigonometry, but I imagine it is mathematically overkill in another sense. When calling `sin` or `cos` in code you get back a rational approximation to the presumably irrational answer.
From what I quickly gleamed, using spreads would be really annoying to represent rotations, because you lose 'aditivity'. Two subsequent rotations with spreads a and b do not have spread `a` and spread `b`.
Lots of code using trig is about rotations, so losing that feature would probably not be the nicest.
In order to reason about the quality of the rational approximation, you need to reason about the irrational number it's an approximation to, for example as a Dedekind cut. Wildberger, rightly or wrongly, doesn't trust reasoning about that sort of thing; he wants to ground everything in the rationals. Maybe he's worried about finding some equivalent of Russell's barber paradox in the irrationals.
Also, of course, irrational numbers don't allow you to extend trigonometric theorems to Galois fields, complex numbers, and so on, which to my mind is a much more interesting direction. I don't know how much you lose if you use Wildberger's construction into a division algebra like the quaternions.
I don't actually know how you compute the "angle sum" in terms of Wildberger's spreads, but I'm pretty confident that there's a way to compute it, and it's pretty simple.
In the unit-vector representation I described, angle-sum is not just simple addition, but it's really not that bad: (a + bi)(c + di) = (ac - bd) + (ad + bc)i. That's four real multiplications, an addition, and a subtraction, and the result is exact if computed in bignums or bignum rationals. This is usually cheaper than computing sine and cosine, especially if you can use SIMD or vectors, and of course if you want to rotate some points around a center, you end up having to multiply by the sin and cos in exactly the same way anyway. (Maybe in strength-reduced fashion if you're texture-mapping or something, but that applies just as well to representing the angles as sin and cos.)
So if I wanted to, say, calculate the height of a pole from the length of its shadow, I should use Wildberger's rational trig, because I don't need derivatives, integrals, or complex numbers?
You can do that without derivatives, integrals, complex numbers, sines, cosines, tangents, exponentials, square roots, or even addition and subtraction. If the pole is plumb, erect a pole smaller than you with a plumb bob, measure its length a and its shadow's length b, and then calculate the height of the original pole from its shadow's length c as ac/b.
If you have a slide rule, you can do this in a single motion: align c on the C scale over b on D and read off the answer on C above a on the D scale.
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.
That is not entirely true. It comes from the relationship between those functions and the complex numbers via the Euler formula.
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:
So then what do we make of: This has to be which is then Where f = e is a weird number like 535.4916. This f doesn't have nice properties. E.g.: Otherwise it works; for instance 90 degrees is 0.25 and surely enough In situations not involving e in relation to angular representations via Euler, f cannot replace e.I'm all for having parallel trig functions in libraries that work with turns, though.
The annoying 2π factor shows up in lots of places though. Should way, say, in electronics, redefine a new version of capacitive reactance which doesn't have 2πf in the denominator, but only f?