Geometry and Algebra in Ancient Civilizations