4 ms·
If you want a single number (e.g. you are trying to serialize a lot of data), in many contexts you can replace the coordinates (cos θ, sin θ) with the stereogra
by jacobolus 1mo ago
If you want a single number (e.g. you are trying to serialize a lot of data), in many contexts you can replace the coordinates (cos θ, sin θ) with the stereographic projection h = tan ½θ = sin θ / (1 + cos θ). Converting back and forth between these representations is cheap and easy: cos θ = (1 − h²) / (1 + h²) and sin θ = 2h / (1 + h²).
- srean 1mo agoDamn :) why did I not think of that. This would be useful for serialization deserialization. I have used half angles ½θ because there is no ambiguity about the full angle θ if I know it's sin value (and of course this holds for tan ½θ). Tan works better because one does not have to remember to take the correct branch of sqrt(1 - sin^2 θ). I learned two clever tricks in this discussion: (i) your tan ½θ and (ii) free modular arithmetic by embedding turns in signed integers.
- jacobolus 1mo agoFor more: https://en.wikipedia.org/wiki/User:Jacobolus/HalfTan https://en.wikipedia.org/wiki/User:Jacobolus/HalfTan
- srean 1mo agoOh! I did not know you were a contributing author to wikipedia. That is one fantastic page. It's a pity if it's sitting there as a draft. At the least have it on your blog. Half angles substitution is of course a common exercise trying out symbolic integration of many trigonometric integrands. That will s where I encountered it most frequently. The similarity between hyperbolic and trigonometric angle is also one of my favorite things. What I found interesting is that we think in terms of slightly different but equivalent pictures. Mine is https://upload.wikimedia.org/wikipedia/commons/1/18/Versin.png https://upload.wikimedia.org/wikipedia/commons/1/18/Versin.p... I think in terms of angle CAD and the angle subtended on the circumference on the opposite side of the center by the arc AB. Rotations tickle me just right. One thing I had thought of is turtle graphics motion on the sphere over great circles. Turns out it is not an original thought at all. https://news.ycombinator.com/item?id=48732233 https://news.ycombinator.com/item?id=48732233