Programming Tip

Remember: unit tests only help when the test cases are checking for a correct result. The only thing less fun than debugging a function that does a bunch of complicated trigonometry is discovering that you didn’t solve the triangles correctly by hand when writing the test case.

Man, Ptolemy’s equant model of planetary motion is fun. You have a unit circle, let’s call it the “deferent”, with center Z. Pick some arbitrary direction to be the planet’s apogee. Pick an eccentricity e less than 1. Point E is e units from Z in the direction away from the apogee. Point D is e units from Z in the direction towards the apogee. Point B moves along the deferent with a constant angular speed, but the angle is measured not from Z but from D. B also happens to be the center of another circle, let’s call it the “epicycle”, with radius r. Point P moves along the epicycle with a constant angular speed measured relative to the line from D to B. P is the planet and E is the earth, and you want to find the angle from E to P relative to the direction of the apogee.

Best part is, this isn’t even the most complicated model I need to implement.

Comments are closed.