Evaluating expressions involving sine and cosine