Earlier quoted context omitted.
I'm 27, educated in the UK, all I remember about trigonometry is SOHCAHTOA.
The Dutch version was SOSCASTOA, with a picture of a ship called the Castoa sending out an SOS because it was sinking. That picture really helped. And I even remember what it means: SOS: sine = opposing side divided by diagonal (schuine) side CAS: cosine = adjacent divided by diagonal TOA: tan = opposing divided by adjacent. I don't think I've ever used it for anything practical, but I can still reproduce it after al…
Turns are better than radians
301–310 of 494 posts
Re: Turns are better than radians
#302Earlier quoted context omitted.
Only in school exercises you can solve a differential equation by expanding a sine function into a Taylor series. In practical physics computations, the solution of differential equations requires numerical methods that do not use the Taylor series of specific functions, even if the theory used for developing the algorithms may use the Taylor series development of arbitrary functions. For accurate prediction, the sim…
> Only in school exercises you can solve a differential equation by expanding a sine function into a Taylor series. > In practical physics computations, the solution of differential equations requires numerical methods that do not use the Taylor series of specific functions, even if the theory used for developing the algorithms may use the Taylor series development of arbitrary functions. I'm sorry, but you have no i…
I have said that the Taylor series of arbitrary functions have various uses, but there is no benefit in knowing which are the specific Taylor expansions of the trigonometric functions, with the exception of knowing that the first term of the sine and tangent expansions when the argument is in radians is just X.
Solving physics problems using the expansion of an unknown function in the Taylor series has nothing to do with knowing which is the Taylor series of the sine function.
Re: Turns are better than radians
#303Re: Turns are better than radians
#304Earlier quoted context omitted.
I'm a 50 yo programmer. I have a CS degree. I don't even remember my college calculus much less my high school trig. I just haven't had cause to use it in my career, not as a sysadmin, not as a programmer. My son is taking calc 3 and I knew I happened to have my calc 3 notes from the mid-90s, so I pulled them out of the filing cabinet and my very carefully taken notes, my proofs, my hand drawn graphs, it was all gibb…
I'm 27, educated in the UK, all I remember about trigonometry is SOHCAHTOA.
What I remember from trig is to draw a unit circle. Most of the rest falls out of that.
Re: Turns are better than radians
#305>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 dimens…
The 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 explai…
First, I would be cautious about suspecting someone of Casey Muratori's calibre didn't consider something just because he didn't directly addressed it.
Second, the choice of unit is kind of arbitrary, even if the unit itself is not. Radiants are nice because the length of a 1 radiant arc is the same as the length of the radius. But turns are also nice because angles expressed in turns are congruent modulo 1 instead of modulo 2π.
Third, he talks in the context of video games. Such games use code, that have to be read by humans and executed by the CPU. And that's the main point of his article: in this context, expressing stuff in terms of (half) turns reduces the amount of code you have to write & read, reduces the number of multiplications & divisions the CPU has to make, and makes some common operations exact where they were previously approximated.
Do we even care at this point whether the definition of radians is arbitrary or not? I love the elegance of radiants, but for game engine code I'm willing to accept they're just the wrong unit for the job.
Re: Turns are better than radians
#306Earlier quoted context omitted.
Yes and no. The Taylor expansion works out like sin θ = θ - θ³/₆ + θ⁵/₁₂₀ - θ⁷/₅₀₄₀ + ⋯ if θ is in radians. This is ideal for small θ but if you want to cover, say, 0 https://en.wikipedia.org/wiki/Chebyshev_polynomials which are optimized across the range. You could rewrite these just as easily to work in degrees as radians. One of the best ways to calculate sin and cos is CORDIC, https://en.wikipedia.org/wiki/CORDIC…
"One of the best ways to calculate sin and cos is CORDIC" This is extremely false. Cordic is 1 bit per iteration, while polynomials (Chebyshev or minmax) converge exponentially faster.
On the other hand with CORDIC it is extremely easy to reach any desired precision, and in cheap hardware it does not require multipliers.
So CORDIC may be considered as "one of the best ways" depending on how "best" is defined.
Even when developing a polynomial approximation for the fast evaluation of a trigonometric function, it may be useful to use an alternative evaluation method by CORDIC, in order to check that the accuracy of the polynomial approximation is indeed that expected, because for CORDIC it is easier to be certain that it computes what it is intended.
Re: Turns are better than radians
#307Earlier quoted context omitted.
> Am I wrong? Yes. Trigonometry is extensively taught in the US. People forget this stuff if they don’t use it. Ask some 30 year old chef in whatever country you fantasize teaches properly to compare and contrast turns vs radians and you’ll get similar responses.
I'm a 50 yo programmer. I have a CS degree. I don't even remember my college calculus much less my high school trig. I just haven't had cause to use it in my career, not as a sysadmin, not as a programmer. My son is taking calc 3 and I knew I happened to have my calc 3 notes from the mid-90s, so I pulled them out of the filing cabinet and my very carefully taken notes, my proofs, my hand drawn graphs, it was all gibb…
There are even other bits that I was shown, never incorporated into my brain at all, but later recognized as truly important (Taylor series expansions, the central limit theorem, the prime number theorem, etc).
Re: Turns are better than radians
#308Earlier quoted context omitted.
> When you approximate functions by polynomials, including the trigonometric functions, the Taylor series are never used, because they are inefficient (too much computation for a given error). Other kinds of polynomials are used for function approximations. Can you point me to some implementation of sin that’s not actually using Taylor expansion in some form? Because most that I am aware of do in fact use Taylor seri…
If any of those libraries uses the Taylor expansion for approximation, that is a big mistake, because the approximation error becomes large at the upper end of the argument interval, even if it is small close to zero. What is much more likely is that if you will carefully compare the polynomial coefficients with those of the Taylor series, you will see that the last decimals are different and the difference from the…
>>> print("{:.30f}".format(sin(pi/4, 0, 0, *standard_coeff)))
0.707106781186567889818661569734
>>> print("{:.30f}".format(sin(pi/4, 0, 0, *musl_coeff)))
0.707106781186547461715008466854
The difference at the very edge of the interval occurs at the 14th digit of decimal expansion, and it's at the edge of accuracy of double, at 16th digit: after ...6547, the exact value starts with ...6547_5244, instead of 4617. I wouldn't exactly call it a big mistake, as the difference would not be relevant in almost all practical uses, but that would be a mistake nevertheless, and I'm sure someone would be bitten by this. Thanks, I learned something new today!Re: Turns are better than radians
#309Earlier quoted context omitted.
The 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 explai…
>> The 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. It's been a while, but I used to have an argument that rad should be a unit. This even plays well in physics where it allows torque to not have the same units as a joule.
That discussion has to do with the failure of SI to notate the directions of vectors. When it's torque, the N and the m are at a right angle. When it's work, they are both in the same direction.
Re: Turns are better than radians
#310>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 dimens…
The 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. I…
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.