28 ms·
Mandatory Physics "troll" comment: For small angles, sin(x) ~= x and cos(x) ~= 1 -- the ["small angle approximation"](https://en.wikipedia.org/wiki/Small-angle
by aaaronic 5y ago
Mandatory Physics "troll" comment:
For small angles, sin(x) ~= x and cos(x) ~= 1 -- the ["small angle approximation"](https://en.wikipedia.org/wiki/Small-angle_approximation https://en.wikipedia.org/wiki/Small-angle_approximation)
It's actually kind of ridiculous how many times it comes up and works well enough in undergraduate Mechanics.
- jhgb 5y agoThis a perfectly nice Programming 101 example of a recursive function -- if an angle is too large, calculate its sine using the sine of the half-angle, otherwise return the angle (or, if you're fancy, some simple polynomial approximation of the sine). I'm sure everyone did this in school (we did, in fact).
- gugagore 5y agoIt's not obvious when you should switch over to an approximation (base case), so I'd say it's not a good example to introduce recursion. I have never seen it, and I did not do it in school.
- aaaronic 5y agoWhen the difference between iterations is less than whatever threshold of accuracy you're looking for, I'd assume. "Relaxation" algorithms for calculating fields work that way.
- jhgb 5y agoIt's not obvious but that makes it a nice example in parameter optimization as well.
- scythe 5y agoIt's "obvious" if you remember how the Taylor series for sin(x) works. The error between x and sin(x) is bounded above by x^3/6. So there you go.
- SnowHill9902 5y agoFor a physicist sin(x) ~= x if x^3/6 << x
- eyelidlessness 5y agoI didn’t do this (or any programming, or any trigonometry) in school, but I’m appreciative of tidbits like this from people who did. I definitely feel comfortable with recursion, and have a stalled art project which could benefit from better understanding how to apply trig as I accumulate understanding in a much less structured way.
- dekhn 5y agoIIRC this comes up in the derivation of the boltzmann distribution. I also recall stirlings approximation for x!.
- Sharlin 5y agoUseful in astronomy and telephoto photography as well.
- andi999 5y agoDont forget optics, there tan x=sin x
- aaaronic 5y agoYep, it's all over Physics, really. Many non-mechanical concepts are often mapped to a mechanical analog model (so many tiny oscillators out there!).
- drBonkers 5y agoHow small is small enough to use this approximation?
- stdbrouw 5y agoAbout 10°, depending on what kind of accuracy you'd like. https://en.wikipedia.org/wiki/Small-angle_approximation#Error_of_the_approximations https://en.wikipedia.org/wiki/Small-angle_approximation#Erro...