Improved trigonometric integral evaluation with pattern matching