Thanks, glad you find it interesting!
Here's my main reference for it. I got most of the math from there. In events the formulas are a bit stretched out.
That series of articles gets a tad vague at the end, but still it does a good job explaining why certain math is used.
This site is also a good reference for math in general. Much more readable than the equations on wikipedia.