Finding The Minimum And Maximum Of A Function