# Using a power series to approximate a definite integral

1. Mar 7, 2009

### wilcofan3

How do I go about finishing/calculating this?

1. The problem statement, all variables and given/known data
Use a power series to approximate $$\int\cos 4x\log x dx$$ to six decimal places. (bounds are from pi to 2pi)

2. Relevant equations
3. The attempt at a solution
So I broke down the equation first:

$$\int\cos 4x\log x dx = \frac{1}{4}\sin 4x\log x - \frac{1}{4}\int \frac{\sin 4x}{x}dx$$

Now I am using the fact that $$\sin x = \sum_{n=0}^\infty(-1)^n\frac{(4x)^{2n+1}}{(2n+1)!}\Rightarrow \frac{\sin x}{x} = \sum_{n=0}^\infty(-1)^n\frac{4^{2n+1}x^{2n}}{(2n+1)!}$$.

This is a really stupid question probably, but I don't understand how to go about finishing the problem even though I think I have the right idea.

What I don't understand is how the bounds play a part in this. Am I just calculating that last series to six decimal places?

2. Mar 7, 2009

### Dick

Now you want to integrate the last series dx and approximate it's value at pi and 2*pi to six decimal places. It's an alternating series, so there's a pretty easy error estimate you can use to figure out how many terms to keep.

3. Mar 7, 2009

### Count Iblis

It looks like you will need many terms in this approach. Expanding sin(4x) around zero while you need to integrate it from pi to 2 pi is asking for problems. At x = 2 pi the argument of the Sin is 8 pi = approximately 24. Insert x = 24 in the series expansion for sin(x) to see when the terms get small.... I think you need to go as far as n = 40 or so....

Expanding sin(4x) around x = 3/2 pi is better, but it is still not the best way to go about. The interval over which you have to integrate is quite long, you have to integrate over twice the period of the cos function. So, this suggests that you should break up the integral from pi to 2 pi into smaller intervals an then do a power series expansion around the mid point of each interval. You can also try to expand the log instead of the sin or cos.

Another option is to iterate the partial integrations a few times more. I.e. you integrate the sin(4x)/x again by integrating the sin(4x) factor and then you end up with the integral of cos(4x)/x^2. Do this again and you see that you end up with sin(4x)/x^3. Because the power of x in the denominator grows at each step, the integral becomes smaller, at least at first. What you get is a divergent asymptotic expansion. I'm not sure you can get to 6 decimal places before the series starts to diverge, though.

4. Mar 7, 2009

### Dick

There aren't any convergence problems here. sin(4x)/x has an infinite radius of convergence around x=0. Look at the terms in the series and apply the ratio test. And you won't need that many terms. (2n+1)! grows pretty fast.

Last edited: Mar 7, 2009
5. Mar 8, 2009

### Count Iblis

Try to compute sin(8 pi) using the power series. Sure, it converges (to zero of course). How many terms do you need? Well, let's simply see for what n we get the largest term in the series. It is easy to see that the function f(n) = lambda^n/n! has a maximum at approximately
n = lambda, if lambda is not too small. Now, 8 pi = approximately 25, so the maximum should occur for n = 12, the term being

(8 pi)^25/25! = approximately 6.5*10^9

So, you clearly do need many terms. That's not the only problem. You also need a result that is quite accurate. This means that you need to evaluate all the terms, including the very large terms, to a sufficient acccuracy. To see that
sin(8pi) is zero to 6 decimal places, you need to keep more than 16 significant figures in the n = 12 term.

6. Mar 8, 2009

### Count Iblis

I would solve the problem as follows. We have

$$\int_{\pi}^{2\pi}\cos(4x)\log(x)dx=\frac{1}{4}\int_{4\pi}^{8\pi}\cos(t)\log\left(\frac{t}{4}\right)dt=\int_{4\pi}^{8\pi}\cos(t)\log(t)dt$$

Shift the integration variable to rewrite the integral as:

$$\frac{1}{4}\int_{-2\pi}^{2\pi}\cos(6\pi+v)\log(6\pi+v)dv=\frac{1}{4}\int_{-2\pi}^{2\pi}\cos(v)\log(6\pi+v)dv=$$
$$\frac{1}{4}\int_{-2\pi}^{2\pi}\cos(v)\log\left(1+\frac{v}{6\pi}\right)dv$$

Expand Log(1+v/(6 pi)) in series and integrate term by term. You need 13 terms to obtain the result:

$$\int_{\pi}^{2\pi}\cos(4x)\log(x)dx\approx -9.74251485155\times 10^{-3}$$

Last edited: Mar 8, 2009
7. Mar 8, 2009

### Dick

You are right. 8pi is too large to make the series manageable. Looks like you do need to break the expansion into smaller intervals.