Evaluating cosine function with given angle expression