I'm confused about using dimensional analysis, as in Street-Fighting Mathematics, of integrals like $$ \int \! x \cos x \, \textrm{d}x = \textrm{something} $$
I start by expressing the right side as a function of one or more variables. It seems this should be a function of $x$ but it might additionally be a function of $\cos x$, so let's just say $x$ for now $$ \int \! x \cos x \, \textrm{d}x = f(x) $$
I then assign dimensions to $x$ but this is confusing because the first $x$ is used as a scaling factor and the second $x$ is used as an angle (in radians or in degrees, I don't think it matters at this point). Let's just say $x$ is a length in both cases $$ [x] = L $$
I then find the dimensions of the integral but this is also confusing because I'm multiplying a dimension with the cosine of the same dimension. Let's just assume $[\cos x] = L$ $$ \left[\int \! x \cos x \, \textrm{d}x \right] = [x][\cos x][\textrm{d}x] = L^3 $$
I finally make $f(x)$ with the same dimensions as the integral. Because the dimensions of $x$ are $L$, I have $$ f(x) \sim L^3 $$
If I compare this result with the actual antiderivative, I'm really confused because I'm adding different dimensions irrespective of the constant of integration $$ [x\sin x + \cos x + C] = L^2 + L + ? $$
If I compare with the series expansion, then it seems to make sense when $n=1$ $$ [x \sum_{n=0}^{\infty} \frac{(-1)^nx^{2n}}{(2n)!}] = L \times L^2 = L^3 $$
This is all very confusing though so any clarifications would be much appreciated.