Modular forms and optimization in the Euclidean space