Traditionally, the term “philosophy” referred to any body of knowledge. In this sense, philosophy is closely related to religion, mathematics, natural science, education and politics. Newton’s 1687 “Mathematical Principles of Natural Philosophy” is classified in the 2000s as a book of physics; he used the term “natural philosophy” because it used to encompass disciplines that later became associated with sciences such as astronomy, medicine and physics.
In Classical antiquity, Philosophy was traditionally divided into three major branches:
Natural philosophy (“physics”) was the study of the physical world (physis, lit: nature);
Moral philosophy (“ethics”) was the study of goodness, right and wrong, beauty, justice and virtue (ethos, lit: custom);
Metaphysical philosophy (“logos”) was the study of existence, causation, God, logic, forms and other abstract objects (“meta-physika” lit: “what comes after physics”).
This division is not obsolete but has changed. Natural philosophy has split into the various natural sciences, especially astronomy, physics, chemistry, biology and cosmology. Moral philosophy has birthed the social sciences, but still includes value theory (including aesthetics, ethics, political philosophy, etc.).
Metaphysical philosophy has birthed formal sciences such as logic, mathematics and philosophy of science, but still includes epistemology, cosmology and others.