Ramba"m lists love of God as the third positive commandment in his Book of Commandments. It includes the following line, which somehow relates the comprehension of God with joy and the ultimate purpose of loving Him. I am not confident that the punctuation here (from the very reliable he.wikisource.org) is accurate. What does this line correctly mean?
היא הציווי שנצטווינו על אהבתו יתעלה, והוא: שנתבונן ונסתכל במצוותיו וציווייו ופעולתיו, כדי שנשיגהו ונתענג בהשגתו תכלית התענוג - וזוהי האהבה המצווה [עלינו]