Who was the ancient Greek mathematician known for his work in mechanics and optics?