To evaluate the integral \( I = \int \left( 3x^2 \tan\left(\frac{1}{x}\right) - x \sec^2\left(\frac{1}{x}\right) \right) dx \), we can follow these steps:
### Step 1: Split the Integral
We can separate the integral into two parts:
\[
I = \int 3x^2 \tan\left(\frac{1}{x}\right) dx - \int x \sec^2\left(\frac{1}{x}\right) dx
\]
...