Solving trigonometric equations with multiple angles