Foundations of mechanics : a mathematical exposition of classical mechanics with an introduction to the qualitative theory of dynamical systems and applications to the three-body problem