17 ms·
>But math never decreed that sine and cosine have to take radian arguments! Ummm, actually it did. The Taylor-series of sine and cosine is the simplest when th
by fbanon 4y ago
>But math never decreed that sine and cosine have to take radian arguments!
Ummm, actually it did. The Taylor-series of sine and cosine is the simplest when they work with radians. Euler's formula (e^ix = cosx + isinx) is the simplest when working with radians.
Of course you can work in other units, but you'll need to insert the appropriate scaling factors all over the place.
"Turns" don't generalize to higher dimensions either. With radians you can calculate arc length on a circle by multiplying with the radius. This extends naturally to higher dimensions: a solid angle measured in steradians lets you calculate surface area on a sphere by multiplying with the radius. How do you do the same with "turns" on a sphere? You can't in any meaningful way.
- doliveira 4y agosin(x) ~~ x only in radians, so honestly that's reason enough. Once in a while we get programmers wanting to disrupt mathematical notation for whatever reason... Worst I've seen so far was one arguing that equations should be written with long variable names (like in programming) instead of single letters and Greek letters. Using turns because it's a little easier in specific programming cases is just as short-sighted, I'd say, it doesn't "scale out" to the myriad of other applications of angles.
- MayeulC 4y agoThat's only for small angles though (stems from Taylor's expansion). With other units, you have a conversion factor, but it remains true enough at small angles.
- fbanon 4y agoOr just defining the result of division by zero as zero "for safety": https://www.hillelwayne.com/post/divide-by-zero/ https://www.hillelwayne.com/post/divide-by-zero/ It boggles the mind, truly!
- jgwil2 4y agoAre you claiming the author is incorrect that x/0 = 0 is mathematically sound?
- littlestymaar 4y agoDepends how you define “soundness”, but the idea of prolonging a function out of its definition domain with an arbitrary value that doesn't make it continuous is arguably a curious one. From an algebra perspective (the one given in the blog post) it may be fine, but from a calculus perspective it's really not. The lack of continuity really hurts when you add floating points shenanigans into the mix, just a fun example: When you have 1/0 = 0 but 1/(0.3 - 0.2 - 0.1) = 36028797018963970. Oopsie, that's must be the biggest floating point approximation ever made.
- fluoridation 4y agoBut for 1/x you have that issue anyway. If x is on the negative side of the asymptote but a numerical error yields a positive x, you'll still end up with a massive difference.
- RunSet 4y agoI don't know about "mathematically sound" but I would rather retain the convention that any number divided by itself equals 1.
- hutzlibu 4y agoWhats wrong with long variable names?
- doliveira 4y agoTry to solve the Schrodinger Equation for even an infinite well using long variable names. I'm not talking about using it in code, I'm talking about someone arguing that books and articles should do it as well.
- achn 4y agoYou can use whatever notation you want for your own work, but documenting with, at least, formal variable definitions would be a significant boon for math literacy.
- Olreich 4y agoIf you go watch math lectures, there's a bunch of "x means Puppy Constant" or, "let's substitute in k for the Real component", or "let's signify <CONCEPT> by collecting these terms into a variable". My argument wouldn't be to replace ALL the variables with meaningful names, just the ones with a lot of meaning that a reader might not understand. It'd also be great if constants, variables, and functions all got naming conventions. Lowercase letters are variables, all caps for constants, etc. It saves a little bit on writing to shorten the variable names, but if the goal of math is to share and spread knowledge within the community or without, better naming and less-memorization would both help. You can also rename things for the working out and use friendlier names for the final equations, just tell people how you're renaming them and everyone will follow along and the programmers will stop trying to sell you one readable code. Most importantly the flat dismissal and horror that many express when someone brings up adjusting the symbolic traditions of Maths should be investigated. Engage with why you feel so strongly that anything other than rigid adherence to tradition is sacrilege. Based on what I've heard, in order to be a great Mathematician, you need to hold onto tradition lightly and think outside the box. Rigid adherence to tradition doesn't sound like that to me.
- doliveira 4y ago
- Aardwolf 4y agoThose perfect radians use 2*pi, aka tau, though, a different math notation issue, where mathematicians have chosen the wrong option (imho) and a case for disrupting that part of math notation, to make radians easier to teach: 1/4th of a circle could be tau/4 radians, 1/8th could be tau/8, etc..., instead of confusing halved factors with radians expressed as amount of pi. Regarding long variable names: I'd rather have long variable names, than a mathematician using some greek symbol in formulas without telling what the meaning of it is (and it could be different depending on their background). But I have no issues with the single letter variables if they're specified properly.
- throwaway9870 4y agoJust out of curiosity, where did tau come from? I never heard of it used for 2pi, and frankly, it seems like a poor choice because in engineering it is one of the most common symbols used (time constant tau).
- airblade 4y agoLook up the Tau Manifesto: it’s all explained there.
- grey_earthling 4y agohttps://tauday.com/ https://tauday.com/ is a good entrance to this particular rabbit-hole.
- nkurz 4y ago
- ncmncm 4y agoThat is the way to do the math, but not the way to write the code. That said, I would like for my compiler to combine any multiplications involved down to one factor for input to the fastest sin/cos operations the machine has. And, to treat resulting multipliers close enough to 1, 1/2, and 1/4 as exact, and then skip the multiplication entirely. But the second part is a hard thing to ask of a compiler.
- doliveira 4y agoYeah, seems to me that languages should allow way more semantic expression than most do today. I wish I had done CS, those kinds of compiler optimization sounds so fun. I'd love to work on that
- ncmncm 4y agoGood news, optimization is engineering, not CS. CS is all about what a program would eventually do, if you were ever to run it. Once you run it, you have moved to the domain of technicians. Engineering is about making it run better.
- xchip 4y agoLOL
- RunSet 4y ago> Worst I've seen so far was one arguing that equations should be written with long variable names (like in programming) instead of single letters and Greek letters. That could never work. If anything the words comprising mathematical texts should be defined once and thereafter truncated to their first letter to reduce cognitive burden and facilitate greater comprehension. c = "could"; d = "don't"; f = "for"; g1 = "go"; g2 = "great"; i = "it"; i2 = "i"; m = "me"; s = "see"; w = "works"; w2 = "what"; w3 = "wrong" i w g2 f m; i2 d s w2 c g1 w3.
- chucksmash 4y agoReference Error: s is not defined.
- RunSet 4y agoThanks for the correction. I will be sure to credit you in the acknowledgements.
- NohatCoder 4y agoWhat really bothers me is that mathematicians seemingly never distinguish between doing and presenting mathematics. You can do your own scribbles with single letters, so do I, it works fine. But when you present maths in a scientific article, maths book, Wikipedia article or similar, your convenience as a writer should be secondary. Your task is to present information to someone who does not already know the subject. Presenting an equation as six different Greek letters mashed together means that the equation itself convey almost no information. You need a wall of text to make sense of it anyway.
- aaaaaaaaaaab 4y agoUh oh. I see you didn’t yet encounter the Einstein-notation for tensors :-)
- bmacho 4y agoThe sine and cosine that are defined with Taylor series are not the same sine and cosine that are defined for right triangles. The former are R->R functions, while the latter are defined on Angles (Angle is unfortunately not an SI physical dimension yet, but I expect it soon to change), and they don't care about the measurement unit. I have no idea what you mean by radians generalizing for higher dimensions, but not turns.
- gus_massa 4y agoIn 2D you can measure the solid angles using steradians. I guess that turns interpreted as parts of whole circles generalize to parts of whole spheres, and you should divide by 4pi instead of 2pi???
- jameshart 4y agosine and cosine are functions from ℝ->[-1,1]. They don't take in a value which has a unit, or even a dimension, they take in a real number. sin(x) is precisely the unique function f(x) such that f''(x) = -f(x). Similar to how exp(x) is the unique function g(x) such that g'(x) = g(x). Sine does not operate on 'angles measured in radians'. It operates on real numbers. It is zero whenever the real number passed in is a multiple of pi. It happens to have applications in relating angles to distances in circles and triangles, and in order to use sine in that context it is useful to introduce the concept of a 'radian' as a specific, constructed angle of a particular size, such that when you express an angle in terms of multiples of a radian, you can just use the sine function to generate useful values.
- adrian_b 4y agoThe simplicity of the Taylor series of sine and cosine is irrelevant, there are no important applications for those series. There is only one consequence of those series that matters in practice, which is that when the angles are expressed in radians, for very small angles the angle, its sinus and its tangent are approximately equal. While this relationship between small angles, sinuses and tangents looks like an argument pro radians, in practice it isn't. There are no precise methods for measuring an angle in radians. All angle measurements are done using an unit that is an integer divisor of a right angle, and then the angles in radian are computed using a multiplication with a number proportional with the reciprocal of Pi. So the rule about the approximate equality of angles, sinuses and tangents is at best a mnemonic rule, because to apply the rule one must convert the measured angles into radians, so no arithmetic operations can be saved. "Turns" generalize perfectly to higher dimensions. To the 3 important units for the plane angle, i.e. right angle, cycle and radian, there are 3 corresponding units for the solid angle, i.e. the right trihedron (i.e. an octant of a sphere), the sphere and the steradian. The ratio between the right trihedron and the steradian is the same as between the right angle and the radian, i.e. (Pi / 2). The ratio between the sphere and the right trihedron is 2^3, while that between cycle and right angle is 2^2. In N dimensions the ratio between the corresponding angle units becomes 2^N. Moreover, while in 2 dimensions there are a few cases when the radian is useful, in 3 dimensions the steradian is really useless. Its use in photometry causes a lot of multiplications or divisions by Pi that have no useful effect. There is only one significant advantage of the radian, which is the same as for using the Neper as a logarithmic unit, the derivative of the exponential with the logarithms measured in Nepers is the same function as the primitive, and that has as a consequence similarly simple relationships between the trigonometric functions with arguments measured in radians and their derivatives. Everywhere else where the radian is convenient is a consequence of the invariance of the exponential function under derivation, when the Neper and radian units are used. This invariance is very convenient in the symbolic manipulation of differential equations, but it does not translate into simpler computations when numeric methods are used. So the use of the radian can simplify a lot many pen and paper symbolic transformations, but it is rarely, if ever, beneficial in numeric algorithms.
- q-big 4y ago> The simplicity of the Taylor series of sine and cosine is irrelevant, there are no important applications for those series. The addition theorems for trigonometric functions can easily be shown by the multiplication theorem for Taylor series (and adding two Taylor series). This proof would be more convoluted if the Taylor series were not so easy. Also, because of the simplicity of their Taylor series, one immediately sees that sin and cos are solutions of the ODE y'' = -y. Another application of the Taylor series is that by their mere existence, sin and cos (as real functions) have a holomorphic extension.
- ascar 4y agoI already learnt in school to calculate trigonometry using radians or turns depending on the situation. It was part of the general math curriculum in Bavaria. As far as I am aware both are mathematically sound and there is no reason to religiously use one of them over the other. Let your use-case or input parameters decide. The examples given in the article definitely make no sense in radians.
- weinzierl 4y ago"I already learnt in school to calculate trigonometry using radians or turns depending on the situation. It was part of the general math curriculum in Bavaria. " Out of interest, when did you go to school in Bavaria and in which grade did you learn about turns? I was in school in Bavaria a long time ago and I don't remember learning about turns there. Could very well be that I forgot or our teacher forgot to teach it.
- ascar 4y agoThat should've been about 15 years ago. I don't remember the grade, but based on the subject probably 8th or 9th? I thought it was in the textbook but possibly our teacher just added it himself.
- WastingMyTime89 4y agoThe writer don’t seem to realise that radian is not an arbitrary unit but a dimensionless one which is defined so that 1rad is actually just 1. Reading the submission and the comments here, I’m under the impression that trigonometry is not extensively taught in middle schools and high schools in the USA. While I’m slightly envious you might not have to suffer developing powers of cosine and sine but that would explain the lack of familiarity with radian I see here. Am I wrong?
- ttoinou 4y agoCorrect, radians are a "fake" unit made up to understand better formulas (the same way we use types in programming languages)
- bluGill 4y agoWhile it is a fake unit, it was made to make the math easy. You could call the origin of everything the place where I'm standing - but good luck calculating a path for the mars rovers to travel if I happen to walk to the bathroom.
- foobarbecue 4y agoI drive a mars rover and this cracked me up. Understanding reference frames is indeed a big part of the job. We do have to deal with "site frame updates" based on rover observations of the sun -- important but annoying. I will bring your person-centered frame suggestion to the team :-)
- dtparr 4y agoSpeaking of reference frames, I deal with quite a few for Earth-bound things, and the primary ones we use are ECEF (Earth-Centered, Earth-Fixed) and ECI (Earth-Centered, Inertial), which then we will often move to a relative local frame for whatever object matters. Is the equivalent set available for Martian Nav (MCMF/MCI, I guess), or do you have different/specialized/etc. frames based on something unique to Mars.
- version_five 4y agoRight, radians are the "natural" units of angle, others generally just make a circle into some integral number of units for convenience, but you always have to go back to radians to actually do calculation. In the next installment, maybe he'll propose that turns can be limiting because diving up a circle requires the use of fractions, and suggest instead of 1 turn per circle, we make a number that's easily divisible into many integer factors. Maybe 216, or I don't know, 360?
- tromp 4y ago> you always have to go back to radians to actually do calculation. The article actually argues the opposite: that the common implementations of sine and cosine start by converting their radian based arguments to turns or halfturns by dividing by pi.
- adammarples 4y agoThis is not the common "implementation" of sine and cosine, its the common argument h, in his use case, he tends to want to calculate turns and half turns most often. He might be able to refactor his functions to optimize for this, but its not exactly something I would expect to be a good idea for library code, people do want to calculate other angles.
- bonzini 4y agoThat's just because the power series would take ages to converge for large arguments, so you take advantage of periodicity. But the implementation in a floating point world is a different thing than the definition in an infinite series world. For example, e^x can be implemented by handling the integer and fractional parts separately, for similar reasons. But no one really cares about the functions e^floor(y) and e^(y-floor(y)). They are only useful as part of an implementation trick.
- wnoise 4y agoThat's really not the only thing going on. Yes, it allows you to take advantage of periodicity. But many common function approximations work best (i.e. not requiring any transform of the argument) over the interval [-1, 1].
- deleted 4y ago[deleted]
- dosshell 4y agoI was taught that Eulers formula defined complex exponents? If we used turns for cos and sin we could redefine what e^ix means so it works without radians. From the other answer I guess this is completely wrong... (I do understand it is nuts to redefine, i'm just interested as a theoretical thought) Now, how is Eulers formula is deduced? How did we figure out what e^ix means?
- johnbcoughlin 4y agoOne way to understand where the formulas come from is the power series of e^x, remembering that that function is (can be) defined as the function whose derivative is itself. Sin and cos are functions whose second derivative is -sin and -cos respectively. If you plug in ix to the power series for e^x, the complex exponential comes right out. There are a couple other "paths" to this result, and the choice we have is by far the most elegant.
- phkahler 4y ago>> Ummm, actually it did. The Taylor-series of sine and cosine is the simplest when they work with radians. Euler's formula (e^ix = cosx + isinx) is the simplest when working with radians. That's nice, but as the article points out most implementations of trig functions on computers don't use things like Taylor series. Another terrific use of turns is in calculating angle differences, where you take a difference and just use the fractional part of the result. No bother with wrap around at some arbitrary 2*pi value. Since it wraps at integer values we simply discard the integer part. This can even be for free when using fixed-point math.
- topaz0 4y agoThat's an obfuscation from the blog post. If you read further down in the code that is mentioned, the actual computation of sin is done by a polynomial expansion in x (radians), not y (turns). The purpose of y is mainly in case x is more than pi, and if so, what the corresponding angle in [0,pi/4) is.
- jacobolus 4y agoYou can if you want make a polynomial in turns. The CPU isn’t going to care one way or the other. Implementations which are accurate in terms of turns even for values close to half a turn can be useful for avoiding numerical issues that sometimes pop up because π is not exactly expressible as a floating point number. These functions usually names like sinpi, cospi, etc. It would be nice if they were provided more often in standard libraries.
- bee_rider 4y agoBased on the article, CUDA has a sinpi instruction (or whatever they call them in CUDA-land). Does anyone know -- is sinpi commonly provided in the CPU assembly extension ecosystem (avx & friends)? Light googling showed me some APIs that had implementations, but I didn't dig in enough to see if they are directly implemented in assembly (this seems like the sort of info a wizard here would know about, and probably whether these types of instructions tend to be well-implemented...).
- techtinker 4y agoI do not see how higher dimensions invalidates the concept. Steradians are replace by a scaled unit-less number that I will called sterturns that goes from 0 to 1.
- mcv 4y ago> > But math never decreed that sine and cosine have to take radian arguments! > Ummm, actually it did. No, it didn't. Some specific uses looking better with radians does not mean you have to use radians always. When I first learned sine and cosine, we used degrees, and that worked fine. Later we switched to radians, but there's no reason why you shouldn't use turns, and the article gives a very good argument why in some cases you definitely should.
- p_j_w 4y ago>Some specific uses looking better with radians does not mean you have to use radians always. It's not just some specific use cases, it's the majority of cases if you look across all of math and science. Switching to turns would be stupid, especially once you start doing differentiation and integration. The fact that we use radians almost across the board isn't some accident.
- j7ake 4y agoThe shocking thing with some of these articles is somehow the author asked “why do people use radians” and ended up with an answer of “it was an arbitrary decision and the world would be better of not using it”. I feel a bit of humility would have helped the author and perhaps they would have considered the possibility that they didn’t think of the problem deep enough rather than hastily write a blog post about it. It speaks to the hubris and the superficiality of thinking for some authors.
- loup-vaillant 4y agoThe shocking thing about some of these comments is somehow they didn't consider that the original author spoke in a specific context. Casey didn't say the world would be better with turns instead of radiants. He said that game engine code would be better with turns instead of radiants. Be more charitable.
- 6gvONxR4sf7o 4y ago> Of course you can work in other units, but you'll need to insert the appropriate scaling factors all over the place. You probably take out more scaling factors than you introduce. > Euler's formula (e^ix = cosx + isinx) is the simplest when working with radians. Euler’s still simple: e^(2 i pi y) = cosy + isiny Or if you start noticing c = e^(2 pi) showing up all over the place: c^iy = cosy + isiny > How do you do the same with "turns" on a sphere?… You can't in any meaningful way. Why not do the same thing? One steradian is 1/(4 pi) of a sphere’s solid angle. What if one “steturn” or whatever just covered a full solid angle? And similarly for higher dimensions? Neither definition seems more natural to me, especially being used to all the factors of 2 and pi that pop over all over the place in the status quo.