Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)

It's actually kind of ridiculous how many times it comes up and works well enough in undergraduate Mechanics.



This 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).


I 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.


It'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.


It'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.


It's not obvious but that makes it a nice example in parameter optimization as well.


When 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.


For a physicist sin(x) ~= x if x^3/6 << x


IIRC this comes up in the derivation of the boltzmann distribution. I also recall stirlings approximation for x!.


Dont forget optics, there tan x=sin x


Yep, it's all over Physics, really. Many non-mechanical concepts are often mapped to a mechanical analog model (so many tiny oscillators out there!).


Useful in astronomy and telephoto photography as well.


How small is small enough to use this approximation?


About 10°, depending on what kind of accuracy you'd like.

https://en.wikipedia.org/wiki/Small-angle_approximation#Erro...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: