Solving trigonometric equations