Integration: $\frac{2}{\pi} \int_0^\pi \frac{\sin(nx)}{10}x(\pi-x) \mathrm{d}x$ Can someone matlab/mathematica/maple it for me?

135 Views Asked by At

I want to compute $\frac{2}{\pi} \int_0^\pi \frac{\sin(nx)}{10}x(\pi-x) \mathrm{d}x$, where $n=1,2,3,4,\dots$

I worked this by hand and got the result: $-\frac{4\cos(nx)}{10n^3\pi}$

To check my answer I put it into wolfram alpha: here, and got the result $-\frac{2\cos(\pi n) - 2}{5\pi n^3}$(plus the $\sin$ bit that it doesn't understand is $0$ since it doesn't know $n=1,2,3,4\dots$

Where did $\frac{2}{5\pi n^3}$ come from? This can't happen with integration by parts for $\cos \sin$ terms? Is my hand calculation correct?

Maybe it was when I had $(-1)^{n+1} \frac{\pi^2}{n} + (-1)^n \frac{\pi^2}{n}$ and canceled?

1

There are 1 best solutions below

0
On BEST ANSWER

Let's just do the integral. I will throw away some of the constants. We have

$$ \int_0^\pi \sin(nx)x(\pi - x) \mathrm dx = \pi\int_0^\pi \sin(nx)x\mathrm dx - \int_0^\pi \sin(nx)x^2\mathrm dx.$$

Each term here is a classic integration by parts, and doing this out yields the general antiderivative

$$ \frac{n^2x(x-\pi) - 2)\cos(nx) + n(\pi - 2x)\sin(nx)}{5\pi n^3} + C.$$

(I am not assuming that $n$ is an integer, as it's not necessary here). This looks like the term you say you have. When you stick in $\pi$ and subtract the value from $0$, you get exactly what Wolfram|Alpha told you.

It seems likely that you forgot that $\cos(0\cdot n) = 1$ regardless of what $n$ is, and so it might "look" like a constant unattached to any trig, but in fact its the coefficient of the term $\dfrac{2n^2\cos(n\cdot0)}{5\pi n^3}$.