## UnkleRhaukus 2 years ago \begin{align*} % S(x) S(x) &=\frac{2}\pi\left(1+2\sum\limits_{r=1}^\infty\frac{\cos((2r-1)x)}{1-(2r-1)^2}\right)\\ \\ S(\tfrac\pi2)&=\frac{2}\pi\left(1+2\sum\limits_{r=1}^\infty\frac{\cos((\pi r-\tfrac\pi2)}{1-(2r-1)^2}\right)\\ 1&=\frac{2}\pi\left(1+2\sum\limits_{r=1}^\infty\frac{\sin(\pi r)}{1-(2r-1)^2}\right)\\ \frac\pi2-1&=2\sum\limits_{r=1}^\infty\frac{\sin(\pi r)}{1-(2r-1)^2}\\ \frac\pi4-\frac12&=\sum\limits_{r=1}^\infty\frac{\sin(\pi r)}{1-(2r-1)^2}\\ \end{align*}

1. UnkleRhaukus

um , i think i made a mistake somewhere

2. experimentX

sin r pi = 0

3. UnkleRhaukus

well sine of πr is going to be zero, so

4. UnkleRhaukus

so the last two lines are not true

5. UnkleRhaukus

and the third line isnt right either

6. experimentX

the second line is not true .. check again.

7. UnkleRhaukus

is the first line right?

8. experimentX

sorry ... it seems i made mistake I didn't see 2r there. I wouldn't now about the first line since it is your question. What is your function??

9. experimentX

why did you put $$S(\pi/2) = 1$$

10. UnkleRhaukus

the function is f(x)=|sin(x)|

11. phi

I think the summation is mostly zeros, except for r=1 where it is 0/0 it's pi at r=1 ?

12. UnkleRhaukus

hmm i forgot it could do that

13. UnkleRhaukus

so have i made any mistake then?

14. phi

as far as I can see, your very first line, evaluated at x=pi/2 gives 2/pi *(1 + 2*pi/4) = 2/pi +1

15. phi

maybe you don't want that leading 1?

16. UnkleRhaukus

\begin{align*} % a_0 a_0&=\frac1\pi\int\limits_{-\pi}^\pi |\sin(x)| \,\text dx\\ &=\frac2\pi\int\limits_{0}^\pi \sin(x) \,\text dx\qquad\text{(even integrand)}\\ &=\frac{2}\pi\left(-\cos(x)\Big|_0^\pi\right)\\ &=\frac{2(-(-1-1))}\pi \\ &=\frac{4}\pi \end{align*} \begin{align*} % a_n a_n&=\frac1\pi\int\limits_{-\pi}^\pi|\sin(x)|\cos(nx)\,\text dx\\ &=\frac2\pi\int\limits_{0}^\pi\sin(x)\cos(nx)\,\text dx\qquad\text{(even integrand)}\\ &=\frac2\pi\int\limits_{0}^\pi\frac{\sin(x+nx)-\sin(x-nx)}2\,\text dx\\ &=\frac1\pi\int\limits_{0}^\pi{\sin\left((1+n)x\right)-\sin\left((1-n)x\right)}\,\text dx\\ &=\frac1\pi\left(\frac{-\cos((1+n)x)}{1+n}-\frac{\cos((1-n)x))}{1-n}\Big|_0^\pi\right)\\ &=\frac1\pi\left(\frac{1-\cos((1+n)\pi)}{1+n}+\frac{1-\cos((1-n)\pi))}{1-n}\right)\\ &=\frac1\pi\left(\frac{1-(-1)^{n+1}}{1+n}+\frac{1-(-1)^{n-1})}{1-n}\right)\\ \\&=\frac1\pi\left(\frac{1+(-1)^{n}}{1+n}+\frac{1+(-1)^{n})}{1-n}\right)\\ \end{align*} \begin{align*} % b_n b_n&=\frac1\pi\int_{-\pi}^\pi|\sin(x)|\sin(nx)\,\text dx\\ &=0\qquad\text{(odd integrand)} \end{align*} \begin{align*} % S(x) S(x)&=\frac{2}\pi+\frac1\pi\sum\limits_{n=1}^\infty\left(\frac{1+(-1)^{n}}{1+n}+\frac{1+(-1)^{n})}{1-n}\right)\cos(nx)\\ &=\frac{2}\pi+\frac2\pi\sum\limits_{n=2,4,6\dots}^\infty\left(\frac{1}{1+n}+\frac{1}{1-n}\right)\cos(nx)\\ &=\frac{2}\pi\left(1+2\sum\limits_{n=2,4,6\dots}^\infty\frac{\cos(nx)}{1-n^2}\right)\\ &=\frac{2}\pi\left(1+2\sum\limits_{r=1}^\infty\frac{\cos((2r-1)x)}{1-(2r-1)^2}\right)\\ \\&=\frac4\pi\left(\frac12-\frac{\cos(2x)}{3}+\frac{\cos(4x)}{15}+\frac{\cos(6x)}{35}+\dots\right) \end{align*} \]

17. experimentX

a_0 = 2/pi http://www.wolframalpha.com/input/?i=integrate+ |sin%28x%29|%2Fpi+from+0+to+pi

18. UnkleRhaukus
19. experimentX

it seems that you are taking 2pi as period, although it works, pi should also work fine.

20. experimentX

Plot[2/Pi - Sum[2/Pi * 1/(4 n^2 - 1) Cos[n x], {n, 1, 20}], {x, 0, 4 Pi}] however the period seems to be 2pi

21. experimentX

sorry the result was correct .. i forgot it was for even case. On Mathematica Plot[2/Pi - Sum[2/Pi * 1/(4 n^2 - 1) Cos[2 n x], {n, 1, 20}], {x, 0, 2 Pi}]

22. experimentX

so the final series is $|\sin x| = {2 \over \pi} +{2 \over \pi} \sum_{n=1}^\infty \frac 1{1 - 4 n^2} \cos (2nx)$

23. phi

In case you didn't find your mistake, it happens when you change the index from n=2,4,6... to r=1,2,3... you should substitute n=2r (so that r= n/2 giving 1,2,3...) you then get exper's result

24. UnkleRhaukus

ah yes \begin{align*} % S(x) S(x)&=\frac{2}\pi+\frac2\pi\sum\limits_{n=1}^\infty\left(\frac{1+(-1)^{n}}{1-n^2}\right)\cos(nx)\\ &=\frac{2}\pi\left(1+2\sum\limits_{n=2,4,6\dots}^\infty\frac{\cos(nx)}{1-n^2}\right)\\ &=\frac{4}\pi\left(\frac12+\sum\limits_{r=1}^\infty\frac{\cos(2rx)}{1-(2r)^2}\right)\\ \\&=\frac4\pi\left(\frac12-\frac{\cos(2x)}{3}-\frac{\cos(4x)}{15}-\frac{\cos(6x)}{35}-\dots\right) \end{align*}

25. UnkleRhaukus

\begin{align*} % S(x) S(x) &=\frac{4}\pi\left(\frac12+\sum\limits_{r=1}^\infty\frac{\cos(2rx)}{1-(2r)^2}\right)\\ \\ S(\tfrac\pi2)&=\frac{4}\pi\left(\frac12+\sum\limits_{r=1}^\infty\frac{\cos(\pi r)}{1-4r^2}\right)\\ 1&=\frac{4}\pi\left(\frac12+\sum\limits_{r=1}^\infty\frac{(-1)^{r}}{1-4r^2}\right)\\ \frac\pi4&=\frac12+\sum\limits_{r=1}^\infty\frac{(-1)^{r}}{1-4r^2}\\ \end{align*} thats better thanks to both of you

26. UnkleRhaukus