Obsolete trig functions and why we don't use them anymore (2013) 221 points by lelf on Dec 3, 2020 | hide | past | favorite | 134 comments

 Let me teach you a secret: You don't need to memorize any trig identities, you just need to know Euler's formula and one or two more facts: exp(ix) = cos(x) + i*sin(x) [cos(x)]^2 + [sin(x)]^2 = 1 i*i = -1  That is, the complex number exp(ix), which lies on the unit circle in the complex plane, has real component cos(x) and imaginary component sin(x). Consequently, the line from 0 to exp(ix) in the complex plane makes an angle of x radians with the real axis.Any complex number can be written as an exponent like rexp(ix), where x is the angle and r is the distance from the origin in the complex plane. Using this understanding, we can interpret complex number multiplication as a rotation in the complex plane: (a * exp(ix)) * (b * exp(iy)) = ab * exp(i (x+y))  Ok, the above was a digression, let's get to the trig identities. Let's derive the double angle formula. We can start with the point on the unit circle representing an angle of 2x, and use Euler's formula to simplify it one way: exp(i*2x) = cos(2x) + i * sin(2x)  Ok, we can also use the fact that a^(bc) = (a^b)^c to write the same expression a different way, then FOIL it: exp(i*2x) = [exp(i*x)]^2 = [cos(x) + i*sin(x)]^2 = [cos(x)]^2 + (i*i)*[sin(x)]^2 + 2i * cos(x) * sin(x) = [cos(x)]^2 - [sin(x)]^2 + 2i * cos(x) * sin(x)  Now, comparing the two expressions, we see that cos(2x) + i * sin(2x) = [cos(x)]^2 - [sin(x)]^2 + 2i * cos(x) * sin(x)  Taking real and imaginary parts of both sides, we find that: cos(2x) = [cos(x)]^2 - [sin(x)]^2 sin(2x) = 2 * cos(x) * sin(x)  This works for most identities you want to derive, and there is a variation for things like cosh and sinh. This trick came in handy on calc 3 exams whenever I couldn't remember the silly trig identities that were required to perform integrals.
 The trouble is that it is rare that trig identities are used for simplifying computations.Most often they are used for simplifying expressions. For that purpose it's not a matter of deducing what they are, but recognizing them in the expression, and spotting the opportunity to use the identity on the path to eliminating terms.For that purpose one needs to have them memorized in order to spot the opportunity -on the carefully derived homework problem- in the wild.
 I generally just know that any trig formula can be converted to quite a few different other ones visa trig identities. Whether a certain expression is more or less complex than another is a matter of perspective and context.If I'm stuck with a trig function I don't know what to do with, I just look on Wikipedia for a trig identity and don't worry about derivations or memorization.This trick is good for exam settings though! My memory is terrible so I always relied on tricks like this in school
 What kind of exam requires you to memorize trig identities? Were they trying to prepare you for a world without paper or computers to look them up on? Or to be a smidgen faster at hand calculations?
 > Were they trying to prepare you for a world without paper or computersYes, most high schools spend a few months teaching “trigonometry” as a system for simplifying formulas that was primarily useful historically to save time for human calculators working with pen/paper and a printed lookup table. In the modern world this is entirely anachronistic and the content could be profitably compressed down to a couple weeks, with the saved time spent on something else. The main remaining utility is as rather cumbersome, unpleasant, and unenlightening algebra practice.
 I think it would be enlightening but rarely done in school, is focus on the geometry of it and how the relationships are connected, such as https://math.wikia.org/wiki/Unit_circle?file=Unit_circle_ind...
 lynndotpy on Dec 3, 2020 [–] I always understood the memorization part as a stopgap to truly understanding them.In the same sense that doing this work by hand will build depth of understanding, I know that remembering the trig identities came before really understanding their relationships. And that also came far before I could truly understand Euler's formula, radians, etc.
 As the math teacher at the first year of university once said:"i know two things:[cos(x)]^2 + [sin(x)]^2 = 1i*i = -1but can re-derive all the rest"
 My math teacher was in love with the Euler's identity written like this: 1+e^(i*pi) = 0He said it relates the most important numbers and constants of the universe. He had it embroidered and framed on his office wall
 “Euler’s identity” is a flashy way of stating that a half-turn rotation in the plane is equivalent to a reflection across the center of rotation. This is a fact which can be easily understood by young children.The part that makes the expression flashy is that the rotation is written via its logarithm, which can be represented as the length of a circular arc (“angle measure”).It’s a useful fact to know, but is vastly overrated.
 MayeulC on Dec 3, 2020 [–] Well, as far as I know, cosinus and sinus have relatively little to do with exponential and imaginary numbers, just like imaginary numbers have intrinsically little to do with the 2D plane. I just think of it as a convenient notation since those obey similar composition rules (that probably stem from their odd and even-ness, and taylor series decomposition from there).So you need at least that one, since it is by convention, and not really derivable[1]: exp(ix) = cos(x) + i*sin(x)  I personally just use Euler's notation (using exp) as a tool to derive trig formulas, since I know power composition rules quite well already, and those tend to be more useful in general. [cos(x)]^2 + [sin(x)]^2 = 1  Is just the Pythagorean theorem on a unit circle, which also defines sin and cos :)[1] OK, you can look at the taylor series expansion, but you need to remember the derivatives for this.
 cos(x) and sin(x) are just the unit circles applied over the 2-dimesnional real + imaginary axis.Because x^2 + y^2 = 1 defines a unit circle, if you perform x^2 + i * y^2 = 1, you get a unit circle over the real/imaginary planes.Or to put it in a picture: https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Eu...Remember the definition of sin / cos: https://upload.wikimedia.org/wikipedia/commons/b/bd/Sine_and...-------Once you realize that "the imaginary axis" is just an arbitrary 2-dimension extension field (and that "imaginary" is a very bad name for it), it becomes way easier to see.-------Now if you had a 3-dimension graph (real, imaginary, and time), and then you project the unit-circle over the real + time axis, you get a sin (or cos) respectively.-----------Or to put it another way: there's a periodic nature of i:* i = i* i^2 = -1* i^3 = -i* i^4 = 1 -- Cycle-length 4* i^5 = i* i ^ x = i^(x mod 4) (In general)This period itself forms a circle, moving from real-to-imaginary and back. (e^i^x) = (e^(ix)) therefore is periodic as well. And the most natural periodic cycle is a circle (which is of course, just sin/cos).To make this "period 4" into a proper circle, multiply by pi/2.i^(pi/2)^x == period 3.141592.... or the "circumference" of the unit circle.e^i^(pi/2)^x == e^(i * pi/2 * x). Done.
 gmadsen on Dec 3, 2020 [–] how can you say imaginary numbers have intrinsically little to do with the 2D plane? it is entirely possible and equally correct to define imaginary numbers geometrically. It is nice and convenient that this is equivalent to the algebraic definition.
 for anyone interested, a great text on this is https://www.amazon.com/Visual-Complex-Analysis-Tristan-Needh...
 beervirus on Dec 3, 2020 [–] It's not just a convenient notation. Sine and cosine are intimately connected with exponentials and imaginary numbers.
 amelius on Dec 3, 2020 [–] From these two facts, you can come to the conclusion that sin(x) == 0 and cos(x) == 1, for any x. I.e., you need to know more.
 No, you can't. You can come to the conclusion that if there exits an x with sin(x) = 0, then cos(x) = 1. The expression as it stands is true for every x \in R without any additional assumptions.
 Yes, I agree that was badly worded, but in any case you need more than those two equations to do anything meaningful with sin(x) and cos(x).
 but you could conclude that cos and sin are both jsut the constant function: x->sqrt(0.5)
 Not at all, same reason.
 eru on Dec 3, 2020 [–] Good luck deriving group theory from that. :)(Though, yes, there's a bit of a connection with group theory, but not enough to help you.)
 Well, unit-circles over a finite field are a periodic "square". So you gotta redefine the norm from norm = sqrt(x^2 + y^2) into norm = max(x, y).From there, you get extension fields from real vs imaginary already. (Ex: you can form a new extension field from x + y*j, where x and y are complex numbers), which forms a new periodic cycle.I mean, deriving it all is hard because group theory is hard. I'm not sure if its because the tools "aren't there". Some super-AI or super-human probably can derive it all from those given facts.
 Yes, I know about the unit circle.But that's just a way to embed some of group theory. It doesn't actually help you much.(It's similar to how you can use eg set theory to construct the integers. It's possible, but doesn't actually help you prove anything about interesting about integers that you wouldn't have been able to prove without embedding them like this.)> I mean, deriving it all is hard because group theory is hard. I'm not sure if its because the tools "aren't there". Some super-AI or super-human probably can derive it all from those given facts.Yes, but that task wouldn't be made easier by this approach compared to starting from just the group theory axioms instead.
 You don't need to treat "[cos(x)]^2 + [sin(x)]^2 = 1" separately either.e^(iθ) times e^(-iθ) = e^(iθ-iθ) = e^0 = 1 = (cosθ+isinθ)(cosθ-isinθ) = cos²θ + sin²θ
 Sure, this takes "[cos(x)]^2 + [sin(x)]^2 = 1" off the list, but doesn't it require you to put "cos(-x) = cos(x)" and "sin(-x) = -sin(x)" on it, to get "(cosθ-isinθ)" from "e^(-iθ)"?
 Only if you forget about how complex conjugation works. (e^-ix) = (e^ix)* = cos x - i sin x
 sriku on Dec 4, 2020 [–] As indicated in the other reply, think of the minus as changing the sign of i instead of x.
 > This trick came in handy on calc 3 exams whenever I couldn't remember the silly trig identities that were required to perform integrals.Why do people even have to memorize stuff like this? I simply don't understand what's wrong with referencing stuff you don't remember during a test. That's what we do in real life!
 You don't even need to think specifically about exp(ix) unless you're doing calculus and taking derivatives or antiderivatives. Just the fact that there's SOME base of exponentiation such that cos is the even component of exponentiation with this base and i * sin is the odd component of exponentiation with this base is enough for all these trig laws.Incidentally, we can derive [cos(x)]^2 + [sin(x)]^2 = 1 from the fact that cos and i * sin are even and odd components of exponentiation with some base, like so: 1 = exp(ix) * exp(-ix) = (cos(x) + i * sin(x)) * (cos(x) - i * sin(x)) = [cos(x)]^2 + [sin(x)]^2.
 I'm not that old, but I learned the haversine formula in a marine navigation class I took through (boy) scouts. Our instructor was a retired merchant navy officer who was somewhat upset that the curriculum didn't include it, and deemed that we should know it.My A-level (≈ AP) maths teacher was mildly amused that I knew it and digressed about log tables. We were (I believe) the last cohort to be issued log-tables, but given the choice in examinations between log-tables, slide-rule, or calculator, we all made the same choice.
 I recently learned about the existence of the Prosthaphaeresis algorithm [0], an even more ancient and obsolete trigonometric calculation technique. It allows you to use a trig table to do calculations when you don't have a log table. To calculate a x b, find arccos(a) and arccos(b), then use the product-to-sum formula: cos(a) x cos(b) = 1/2 x [cos(a + b) + cos(a - b)]. For example, to calculate 4294967296 x 2147483648. First, scale both numbers down by a factor of 1e10, a ≈ 0.4295, b ≈ 0.2147. Next, do inverse trig table lookup: x = arccos(a) ≈ 1.1269, y = arccos(b) ≈1.3544. Now, sum and difference: y + x = 2.4813, y - x = 0.2275. Finally, do trig table lookup and scale up, (cos(2.4813) + cos(0.2275)) x 1/2 x 1e20 ≈ 9221026434613711000. The true answer is 9223372036854775808, error is less than 0.03%. It was used by astronomers in the 16th century before logarithm was invented.I learned it while reading the Wikipedia article Slide Rule, it mentions that two math educators David B. Sher and Dean C. Nataro invented a Prosthaphaeresis slide rule in 2004 - it's what a slide rule may look like in an alternative universe. Unfortunately, I still haven't seen it - I couldn't find the original paper, it doesn't seem to have a DOI, can't use Sci-Hub.
 Prosthaphaeresis works because an angle measure inherently is a type of logarithm. It’s the logarithm of a rotation, instead of the logarithm of a scale. Like other kinds of logarithms, this converts multiplication (composition of rotations) to addition (addition of angle measures).If you want to multiply two numbers, you can treat them as rotations, take the logarithm of each (i.e. find the angle measure), add the two, then take the exponential.
 Is there a more general definition of logarithms than being the inverse of the exponential function?Mathworld says Prosthapharesis formulas "convert a product of functions into a sum or difference" [0], which resembles a property of logarithms (i.e. log(ab) == log(a) + log(b)). However I don't quite get how angle measurement itself is a type of logarithm.Maybe something to do with Euler's formula?
 Starting for Euler's formula you can write cos(x) = (exp(ix) + exp(-ix))/2 so the cosine is in some sense a "type of exponential". If the cosine is a type of exponential then its inverse (the function that takes you to the angle measurement) is inherently a "type of logarithm".This is a very handwavey statement. I would say a more precise statement is that the proper exponential and log maps are the "correct" thing to use to map multiplication to adidtion and vice-versa. They are exactly the maps that do this properly. The fact that cosine is a sum of exponentials means that you can write the inverse of cosine as a (slightly ugly) formula in terms of logarithms (arcos(z) = -i log(sqrt(1-z^2) + z). This is the sense in which the map to angle measures is a "type of log".
 The angle measure i acos(x) is the logarithm of the rotation x + i√(1 − x²).If you want to compute the product of two rotations, you can take logarithms and rewrite it as a sum of angle measures:[x + i√(1 − x²)][y + i√(1 − y²)] = exp(i acos(x) + i acos(y))[x + i√(1 − x²)][y − i√(1 − y²)] = exp(i acos(x) − i acos(y))Now if you just look at the real parts, you can write:xy − √(1 − x²)√(1 − y²) = cos(acos(x) + acos(y))xy + √(1 − x²)√(1 − y²) = cos(acos(x) − acos(y))Taking the sum on each side:2xy = cos(acos(x) + acos(y)) + cos(acos(x) − acos(y))This method is rather more cumbersome (due to rescaling and then converting the factors to rotations as an intermediate step) but fundamentally based on the same concept as:xy = exp(log(x) + log(y))
 scythe on Dec 3, 2020 [–] There is an axiomatic approach that defines a logarithm as any function f(x) such that f(x•y) = f(x) + f(y). But it's easy to prove that this reduces to the usual definition for logarithms on the real numbers.
 This is funny because when I was in school being taught navigation, we were told that celestial navigation would basically tell you where you were half an hour ago, because doing all the math with trig tables and a slide rule or log tables (forced to learn how to do it without electronic calculators), it would take about 30 minutes to reduce a star sight to a position on Earth surface.So now we use that algorithm and you've just calculated where the ship was a few hours ago :-)
 Is that really true? Maybe it takes 30 min to calculate from first principles, but I'd expect you could have a book of tables that tells you with just one or two lookups.
 From first principles would take a lot longer. 30 minutes is roughly what I remember to reduce about 4 stars. I could be off a bit since it's been a really long time and I forget all the steps, but I remember a lot of table lookups and interpolations to get to a final fix.
 It's also commonly used in astronomy to measure the distance on the sky between two objects: https://en.wikipedia.org/wiki/Haversine_formulaI could imagine these could be useful to be defined by computer libraries, as (see article) it would help reduce large reductions in accuracy for some calculations (e.g. by subtracting similar numbers, or wanting to calculate sin^2).
 We were apparently allowed to ask for log tables in our A-level physics exams, even if we already had a calculator with us (which of course we all did). Our teacher took the step of proactively putting them on our desks before the start of the exam because that seemed to be consistent with the rules and didn't hurt.Oh and by the way the log tables supplied by the exam board also had some useful formulae printed in them we'd otherwise have to memorise. Not that that had anything to do with it...
 I'm also mildly amused that the author failed to mention the hyperbolic functions, of which there is one for each of the regular circular trig functions
 Maybe they are not considered obsolete?
 > given the choice in examinations between log-tables, slide-rule, or calculator, we all made the same choiceStudents would benefit greatly if given a slide rule instead of an electronic calculator for their exams. The former is an effective teacher which viscerally reveals crucial insights, while the latter is pedagogically almost useless; using an electronic calculator to solve problems consists of nothing beyond punching keys and looking at the result, given as a disembodied string of digits entirely out of any context. The slide rule probably even ends up slightly more efficient for the type of problems students typically see in high school, after a bit of practice. Precision is more than sufficient.Any assigned problem which needs a calculator would be more effective if the calculator were removed and the numbers involved were simplified to the point students could manage them mentally or with a trivial amount of scratch work.Where electronic computers really shine is in their programmability, and for that students should be working with a full programming language and a real keyboard.
 This seems to imagine that the only thing being taught/worth teaching on the mathematics curriculum is number sense.Firstly, that's not the case. If you want students to answer a problem with any practical application (e.g. money/finance, statistics), or more complex problems where the point is to follow the logic, being able to use the calculator in your pocket is great.A perfectly reasonable assigned problem might be: add the 7.1% sales tax to this ticket price, do you have enough cash?And secondly, number sense is easier to teach without depending on particular algorithms.This is the same complaint as people grumbling about "common core" math, or saying we should go back to the basics of just rote learning times tables and long division.Students are learning about number sense by different routes now - routes that don't end up with most students blindly trying to follow a particular algorithm with no sense of what is actually happening.
 I once taught in a physics curriculum that went a step beyond calculators. Students never had to do numerical calculations in the exams. For example, a question asking you to find a force, could have an answer like "F=ma where m=3 kg and a=2m/s". There were higher grades for showing insight into the physics that you could get by looking at the form of the symbolic equations you'd derived but would have trouble noticing if you'd substituted numbers early on.I wish I had learned times tables properly as a kid though. I struggle with things like 6*7 on a near daily basis for my work and general life. Not really for number sense but for not having to shift my attention to a basic math problem while I'm working on something else.
 jacobolus on Dec 3, 2020 [–] I think you are misunderstanding me / underestimating students. The slide rule teaches in a very direct physical way how logarithms work and how they can be used. This is something that most people never learn, but is extremely valuable.> This seems to imagine that the only thing being taught/worth teaching on the mathematics curriculum is number senseFirst of all, number sense is extremely important. Probably the most important thing taught in primary/secondary math courses. But it is certainly not the only important thing.Students can learn to use an electronic calculator in very little time. A person of average intelligence who understands the relevant math should be able to learn to use their calculator pretty much independently, and become fluent at it with a tiny bit of practice over a short time. There are very quickly diminishing returns to teaching “calculator skills”, because those are extremely shallow.> And secondly, number sense is easier to teach without depending on particular algorithms.I really have no idea which ‘particular algorithms’ you are talking about. Have you ever used a slide rule? It is a very flexible general-purpose tool.> This is the same complaint as people grumbling about "common core" math, or saying we should go back to the basics of just rote learning times tables and long division.No, it is precisely the opposite recommendation to those.> A perfectly reasonable assigned problem might be: add the 7.1% sales tax to this ticket price, do you have enough cash?This is a reasonable problem to teach students about for like 1 week at age ~10. If they learn how to do it using pen and paper, or a soroban, or mental arithmetic, or a slide rule, or a pile of loose pebbles, they’ll have no trouble accomplishing the same with a calculator. It is not a reasonable problem to spend 5 more years on. We are talking about exams for 15-year-olds.
 > This is a reasonable problem to teach students about for like 1 week at age ~10.I'm afraid you have a completely unrealistic expectation of the median student (which is reflected in your other comments as well). I have taught hundreds of students and I would think a handful of them could answer this at age 10.This type of question first appears on the Khan Academy in Grade 7, i.e. targeted at 12-13 year-olds.There is a significant body of prerequisite work in the earlier grades, some of which is limited by what is developmentally appropriate.Students will need dedicated practice to recall this and most won't remember it after seeing it or mastering it on one occasion. It needs to be supported in the rest of the curriculum. You might be able to intensively teach it earlier, but it is hardly worth it, because they will completely forget when you intensively teach the next topic.Many 15-year-olds will continue to struggle with this and, if they are well-supported, might be taught it as a step-by-step procedure in order to best score marks in the exam they need to. These students are unlikely to finish without a good concept of what they were doing - and might be more likely to pick it up as adults out of necessity.
 «Add 7.1% sales tax to the $19.95 ticket» (or whatever) is a 1-step (or generously 2-step) arithmetic problem, of the kind most students in many parts in the world learn to understand conceptually at age 6–7 with no problem. It additionally involves multi-digit multiplication, of the type people typically learn by about age 9–10 (?).If students have not practiced solving problems enough to handle combining these things until age 13, and many are still struggling with it at age 15 (with a calculator!), that’s a serious indictment of the entire education system.  I checked some well-respected national curriculums.Singapore was the only one I found where percentage increase is introduced earlier as a national standard.It's mentioned in the curriculum for Singapore Primary 6, i.e. 11–12 year olds, for students in the higher of two streams for mathematics.  acqq on Dec 3, 2020 [–] What I liked is the awareness of the inexactness which is inherent in everything but which slide rules made more obvious. The joke from these times was "ask an engineer what is 2 times 3 and he'll take out his slide rule and say between 5.9 and 6.1" Whoever thought that up maybe wanted to show how the engineers just use tools and don't think, but I've seen the opposite: it was some with just a theoretical mathematical training who blindly believed in every digit of the result they saw or produced, even when it was really meaningless or where it was obvious to me that the process resulted in an error.  The Art of Electronics warns the reader in the first chapter:> There is a tendency among beginners to want to compute resistor values and other circuit component values to many significant places, and the availability of inexpensive calculators has only made matters worse. There are two reasons you should try to avoid falling into this habit: (a) the components themselves are of finite precision (typical resistors are 5%; the parameters that characterize transistors, say, frequently are known only to a factor of two); (b) one mark of a good circuit design is insensitivity of the finished circuit to precise values of the components (there are exceptions, of course). You'll also learn circuit intuition more quickly if you get into the habit of doing approximate calculations in your head, rather than watching meaningless numbers pop up on a calculator display.  There's a small book called "Errors of Observation and Their Treatment", ISBN 978-94-011-6928-8, which seemed dull in class but it emphasized being able to express and defend a numerical result as x +/- y . I did that thereafter and it made a lot of difference in my understanding of the result. It isn't done by many engineers any more, and I always look with suspicion on results claiming absurd precision. There isn't so much understanding there and people who engage in it are much more likely to submit work with multiple order-of-magnitude errors. They do not -know- the answer, they accept the line on the screen un-critically.  Those interested in this thread should also consider the posts by the user "anonytrary" while commenting this article in this context.  willyt on Dec 3, 2020 [–] When I did my A-levels, we were taught to give answers as surds the exams usually asked for this when we were doing trig and it was generally accepted to give answers as fractions so I think I ended up using my expensive graphic calculator once or twice in 6 hours of maths exams.  This matches my recollection too. I had a calculator, I used it almost exclusively for "wasting" time programming in class, I don't believe I ever used it in an exam.While the graphing calculators were available we weren't told we needed them so, being on a tight family budget, I didn't have one. My sister, a few years later was told that she had to have a graphing calculator, which she claims she never used  As I mentioned in a comment upthread, I was trained in navigation as a Merchant Marine officer and we were not allowed to use electronic calculators during exams. The reason given was "what if you're in the middle of the ocean and your batteries die?" or something stupid like that. But the real reason was that our instructor wanted us to think about what we were doing. Celestial navigation involves a lot of steps and errors compound. Forcing you to think clearly about the intermediate results means that you're more likely to realize you pulled the wrong number out of a table, or your star sight was just plain wrong and you're not off the coast of Madagascar, but somewhere near the Azores instead.  Same here: haversines seemed normal to me since I was trained as a merchant marine officer and we used them in Great Circle calculations. I still have my old copy of American Practical Navigator ("Bowditch") with pages and pages of trig tables.  > log-tables, slide-ruleIs there a difference?I went to high school well after the rise of calculators. Indeed, only one of my maths teachers had even used a slide rule, so I had to figure the thing out myself. One of the first things was that the multiplication scale on a slide rule is a low precision log-table. The other is why most math and physics problems only asked for solutions to two or three significant figures. (While physics problems do deal with precision, the consistency of the precision is definitely suspect.)  Here's one I came across on Facebook the other day. I had no recollection of it from school, but it's pretty neat and it appeared in someone's cheat sheet of standard trig formulas with double angles and all that familiar stuff.  atan2() is incredibly useful in game development. You can use it to determine the angle between objects, calculate the angle of a 2d vector, and other useful things.  > atan2() is incredibly useful in game developmentWhy game development? It's useful everywhere! I have never found a genuine usage of atan(), it's always atan2() that is natural to use.  As on example, to find longitude and latitude on a sphere from stereographic projection (given as Cartesian coordinates) you need both:[ x, y ] ↦ [ atan2(y, x), π/2 − 2 atan(√(x² + y²)) ]But atan per se comes up all over the place if you start doing much work with angle measures.  shouldn't that be atan(1/sqrt(x^2+y^2))? In that case, I'd still use atan2 with y=1.  Yup, I felt incredibly stupid about six months ago finding out about atan2 for the first time, given the number of times I've made stupid errors using atan, and then correcting those errors by manually checking what quadrant I was in.  Same.My favorite "looks simple but is hard" task is "given object position and angle and target position return +1 if the object should turn clockwise and -1 if the object should turn counterclockwise to face the target".I've got it subtly wrong so many times and using atan2 only solves half the problems. Now I just copypaste it from my previous game :)  Isn’t that just the sign of the cross product of the direction vector and the vector from the object position to the target (or the orientation of the bivector in geometric algebra)? No need for trig there, I don’t think.  jacobolus on Dec 3, 2020 [–] This is a question of whether the target is to the right or left of the line where the object is pointing. As OskarS says, you don’t need trigonometry for this at all. Just take the wedge product of the two vectors, and check the sign.That is, if your direction is the vector (a, b), and the displacement to the target is the vector (c, d), you can compute ad – bc. If this quantity is positive turn left, else turn right.  there is also sincos(), which is useful when you need both, such as building matrices.https://man7.org/linux/man-pages/man3/sincos.3.html  Thats quite cute. I imagine it is (doing something equivalent to) using the complex exponential and taking the real an imaginary parts? exp(iz) = cos(z) + i sin(z), so by working out exp you can get cos and sin for free.  In almost every context (certainly in game development) it is typically most efficient and numerically pleasant to avoid angle measures altogether and work in terms of vectors directly. To represent an angle, use a pair of numbers representing a complex number (optionally normalized to lie on the unit circle). If you want to reduce it to a single number (e.g. you have a large number of them you need to serialize to disk or send over the wire) use the stereographic projection.  Nitpick: this blog post makes an incorrect statement, namely that the domain of the inverse tangent function is -pi/2 to pi/2.The domain of a function is the set of all possible inputs. In particular, the domain of the inverse tangent consists of all real numbers.The author means the range.  I wish we used different words for domain and range. Like "input range" and "output range" or something. It's an endless source of confusion, especially since range can legitimately be used for the domain if you phrase it like "the range of values we can use for the input of the inverse tangent function is -infinity to infinity."  If you like, you can call it the image.  In many places though it is clearer to to use vector dot product to calculate the angle than use atan2.  I strongly recommend looking at the geometric proof of the angle sums formulae for sine and cosine.  Interesting the article mentions using Log Tables and links to a video on their use. Log tables where printed booklets used as an alternative to slide rules .http://www.sliderules.info/a-to-z/log-tables.htmI did get taught them in a mech engineering class - this was just at the inflection point (late 70's) when everyone switched from slide rules to calculators  Vers- is just from versus "opposite/against". But versine isn't opposite of sine, if anything it's opposing cosine. I too am curious this how this naming convention arose.  It is opposite the sine, it is at a right angle. Look at the circle diagram: the "sinus rectus" goes vertically and the "sinus versus" goes horizontally.  Wikipedia explains this clearly, https://en.wikipedia.org/wiki/Versine#Versine_and_coversine  It always bugged me that secant is 1/cosine, cosecant is 1/sine, and cotangent is 1/tangent. Like what does co- mean?Trigonometry never really clicked for me. I can remember the formulas and such, but I never really understood what they meant. It was an exercise in remembering but never knowing.  The prefix 'co-' stands for complementary. Two complementary angles add up to 90°. The cosine of a angle is therefore the sine of its complementary angle, etc.For the secant and tangent, it originates from the geometry of the unit circle. The first image in the article explains it well.  phaemon on Dec 3, 2020 [–] If you like visual explanations, you might enjoy this from 3blue1brown: https://www.youtube.com/watch?v=yBw67Fb31Cs  haversine is incredibly useful when you're doing quick distance calculations between points on the Earth though...  I rely on haversine distance quite a bit and feel sort of disappointed in myself that I never really looked up the background on it before now  But first everyone must agree on the radius of the earth!And if the distances are known to be small it may be quicker to calculate the chord length.  Bada bing, bada boom. I used to work with GIS data quite frequently, and I probably used this at least once a week at the time.  Yes, I used the haversine formula just a few weeks ago.  An even greater secret: sinh, cosh, tanh. Don't tell anyone. This message will automatically self destruct in 5.. 4.. 3..  I came on here to say this too. If you need to hang something up with more than two wall hooks, cosh is your friend.  It's funny, this article only serves to remind me how much I've actually forgotten in practice. I don't think I've really done much consideration for trig since my sophomore year of HS. I didn't get into programming via a formal education, and the programming I do doesn't involve heavy graphics or physics so it's just not something I think about. Interesting article, and only serves to inspire me to add re-discovering trig/physics/calc to my todo list on reading.  For those interested in this topic, I wrote a similar blog post on the geometric interpretation of the various trig functions, which also includes some similar diagrams for the hyperbolic trig functions: sinh, cosh, tanh, sech, etc.  A few sentences in.> "Sanskirt for 'chord'Sanskrit, you mean?  LOL! tx.  "goobledegook = e + 5.6. Wow you didn't know about goobledegook? Let me teach you about this revolutionary concept."I majored in mathematics and can say I've never heard of versine and have probably used it many times without knowing. I don't think everything needs a name.  I think the point of these was for when they read low-precision values out of a printed table and then multiplied them using slide rules. Even though the article doesn't say it, I can't think of any other practical reason to multiply by adding logarithms.  The log tables let you work without slide rules, which were themselves horribly expensive not too terribly long ago in the grand scheme of things. But yes, this was all about practical calculation, not mathematics for its own sake, that needed to be carried out quickly by people who wouldn't have handy access to machines that keep the dirty arithmetic details (and potential for error) hidden from the operator, whether that's your ship's navigator or the machinist with nothing but a sine bar and gauge blocks setting up a precision operation, and if you needed precision using a four-figure table book, the only way you were going to get it was if the derived operations were in the tables.  The converse is true: slide rules let you do calculations quickly and easily (since they hang in the leather holster on your belt) without having to carry an expensive and heavy copy of the rubber bible or similar work and stop and look up numbers then scratch the values down on paper and work the problem.  Again, you're thinking of an era where slide rules were relatively affordable. That's mid-twentieth century stuff (although the key word is relatively; my first good slide rule cost more than a month's rent at the time).  todd8 on Dec 3, 2020 [–] Generally, slide rules were only good for rough calculations (3 significant digits if you were lucky), but they did contain multiple scales providing multiplication, division, exponential, log10, ln, roots, sin, cos, tan, and hyperbolic trig functions. Notably one couldn’t do addition or subtraction with a slide rule; we used pencils for that.When more precision was needed, I and my fellow engineers would break out our copies of CRC’s reference tables. The better log tables allowed calculations to 5 or 6 significant digits. Using these were not unusual and all of us learned to use them in high school (before 1970 at least).  Back in the 1970s I used a slide rule when 2-3 place accuracy was enough; or 5-place or 7-place log tables and a pocket mechanical adding machine (rather than by hand) when more accuracy was required.I found a 2-minute video of the sort of pocket adding machine I used, https://www.youtube.com/watch?v=ryST18JJ7VU (The device is actually easier to use than shown. Using the colors next to the digits: if silver, pull the stylus down; if red, pull up and over the curve at the top of the column to the next digit. No extra or wasted motions are needed.)Five places were usually enough, but seven places were needed for some astronomical calculations such as eclipses. The$7 I paid for the log tables in the late 1960s would purchase about \$50 today; and the adding machine was probably a couple of dollars back then.
 lmm on Dec 3, 2020 [–] > Notably one couldn’t do addition or subtraction with a slide rule; we used pencils for that.Huh? It's trivial to make a slide rule that you can add and subtract on, you just rule linear scales on it.
 Of course you are right, the slide rule works with logarithmic scales that are “added” together to do multiplication. Linear scales could be used to add, but the low number of significant digits (no more than three on standard slide rules) meant that it wasn’t worth it, and no engineering slide rule that I ever saw had scales for addition.
 gumby on Dec 3, 2020 [–] Slide rules are literally the physical embodiment of a log table (or several, if you had a multilog rule). You used them by physical addition.
 OK, now I understand that the logs of these values are for pencil+paper addition and subtraction, not slide rules.
 > I don't think everything needs a name.And you are wrong, at least historically: The article points that without the access to the computers and to achieve numerical precision having precalculated tables of such functions was of direct practical use.Even if you personally and more recently didn't need that, the said names were needed and used, and that's why they exist.Had you been you born, for example, more than 100 years ago, you could have been one of the persons assigned to spend maybe years just carefully calculating (or just verifying) the tables of one of those functions which today are seldom referenced by a name. Or at least with a job which involved using such tables (and the names too).Also, in current computing practice, one can still write programs which produce wrong results if one is not aware of the limits of the partial numerical calculations, including these named. One doesn't have to know the names, but in some specific cases it could be needed to have separate functions calculating exactly the values of the functions named. As we start to discover again that the custom processors could calculate more with less binary digits, knowing this becomes even more important compared to the times where "just use doubles" was enough.
 versine clearly needed a name once when it was in common usage. As in, "Hey Greg, can you help me? I can't find this computation in these tables. --- Oh, try the versine".
 It kind of helps a non Mathie like me doing trig. But I'll ask fof one better:I would love an application that lets me plug in what I have (coords and angles), what I want, and for it to show me how to get it.
 Does it? No one does this: var STRAWBERRY_PI = 1 + Math.PI;  For example, no one doing math will use τ (2𝛑) and 𝛑 simultaneously. Choose one or the other, otherwise you are increasing the number of symbols someone has to learn to understand your math. Naming everything is overwhelming. Mathematics is about similarities, not differences. If the transformation is trivial, then don't bother creating a new symbol. It will just confuse you more.
 I don't agree at all. This happens all the time. For example, electrical engineering has f, ω, and s, all only differing by basic factors of 2π or i.As far as I can tell, the main reason this gets done is to give commonly recurring quantities single symbols, to reduce errors in lengthy calculations. When those recurring quantities are meaningfully different, in ways that help prime one's intuition, that's all the more reason to do it.
 As an electrical engineer you'll typical use f, ω, and s, in different contexts and you'll learn each of those contexts separately.f: consumer electronics ω: circuits s: frequency responseHaving multiples of terms for each is definitely a hindrance to education. It makes switching between each use a mental headache.
 > As an electrical engineer you'll typical use f, ω, and s, in different contexts and you'll learn each of those contexts separately.Perhaps it's just my unconventional education (see username), but when I'm doing something like filter design, I really do end up using all of those at once. I'll do the on-paper design portions with s, the computational section of the design with ω, and then when I build the thing to test it, the scope or spectrum analyzer read out in f (if I'm lucky). So they're genuinely all there at once!
 unishark on Dec 3, 2020 [–] You also save clock cycles by avoiding the extra calculation each time you compute 2pi or whatever by defining TWO_PI once. So it was lot more common in Fortran and C programming days.
 synthc on Dec 3, 2020 [–] tons of libraries define both PI and TWO_PI
 Here you go: https://www.geogebra.org/geometry(Press the calculator icon for algebraic view)
 Oh this is so neat. Thanks!!
 The article explains pretty well why these named functions (or at least some of them) were once useful and thus had common names.
 I'm sure I have things disabled in some particular way that SA site devs haven't envisioned, but it's annoying to click through the "Cookie Settings" modal that obscures half the page every time I open a new SA page. Probably the cookie that stores this decision could be classified as "strictly necessary"...
 Anyone can explain the meaning behind this:> When the Onion imitates real life, it's usually tragic.linking to an article titled "Man Puts Glass Of Water On Bedside Table In Case He Needs To Make Huge Mess In Middle Of Night"?Is the word "tragic" in the OP article here used jokingly, or is it a reference to an actually tragic event I don't know about?
 It's a joke, not about an actual tragedy.A good reason to put a glass of water on bedside table is because you might be thirsty in the middle of the night. You might accidentally knock the glass over and cause a huge spill instead. So "in case he causes an accident" is silly.If in real life someone knocked over a glass of water that they put on their bedside table, it's just like the joke, and "tragic". (And an example of life imitating art).
 I have an old CRC math handbook with these tables ... once you have calculators there was no need for these tables and all these alternate trig functions...
 I used the haversine formula quite recently, I believe in a previous job, for accurately drawing a map given GPS coordinates, or something like that.
 These equations are very useful in circular hydraulics. It’s unfortunate I never learned this stuff.
 Fun book I read earlier this year, which steps you through the history of trigonometry applied to navigation: "Heavenly Mathematics; the forgotten art of spherical trigonometry."
 Funnily enough, haversines and the lot can be found in Dover's Trigonometry Refresher. Had.to do some revision myself for back-to-school.O.G. Artillery measurement and spherical navigation can be revised in that book, while spherical trig. can be practiced in the 1954 edition Schaum's Plane and Spherical Trigonometry. Good stuff.
 Screw you SA for blasting an ad at my sleeping family at 7 am
 Now is the time to improve your life:
 I used haversine to good effect in a commercial product a few years ago.I am not fond of calling this stuff 'secret'.
 bruh this is just adding constants to regular functions((((top secret))))
 Dunno if you know where the meme came from, but: https://en.m.wikipedia.org/wiki/Triple_parentheses
 ohno I didn't know I swear. I just picked this up from somewhere