Fourier series (cosine series expansion?)

wahoo2000
Messages
37
Reaction score
0
Find the Fourier series of the 2Pi-periodic function

f(x)=
{0 , Abs(x) <= Pi/2
{Abs(x)-Pi/2, Pi/2 < Abs(x) <= Pi


My attempt at a solution

I have sketched the function... It equals zero between -Pi/2 and Pi/2 and it equals Pi/2 at -Pi and Pi. Then the pattern is repeated with peaks at +/- Pi, 3Pi, 5Pi...

To find the Fourier series I have to identify a_0, a_n and b_n.
Here, b_n = 0 because the function is even, right?

a_0= (1/(2Pi))*AUC = Pi/8 (AUC=area under curve from -Pi to Pi (i.e. one period))

then a_n = (1/Pi)*integral_-Pi_Pi f(x)*cos(nx) dx= (2/Pi)*integral_0_Pi f(x)*cos(nx) dx (because even function)
= (2/Pi)integral_0_Pi (Abs(x)-Pi/2))*cos(nx) dx = (integration by parts) = (2/(nPi))[(Abs(x)-Pi/2)*sin(nx)] (evaluate for x=Pi minus for x=Pi/2, because the function is zero anyway between 0 and Pi/2 --> integral is zero) - (2/(nPi))*integral_Pi/2_Pi 1*sin(nx) dx

[(Abs(x)-Pi/2)*sin(nx)] (evaluate for x=Pi minus for x=Pi/2) I think is zero so just the last expression left, but I just can't figure it out.

Sorry for the format of this post, I can hardly figure out what I wrote myself so it's a miracle if somebody can help me out of this :) I now saw the "insert image" feature, which will be my choice for the maths next time I post :)
 
Physics news on Phys.org
You do need to write it out more neatly, I can't wrap my head around it. At the very least insert some newlines now and then. I worked through the problem and it seemed to just involve some integration by parts and trigonometric integrations. Here are some of my steps:

f(x)=\frac{a_0}{2}+\Sigma^{\infty}_{n=1}a_{n}cos(nx)

a_n = \frac{1}{\pi}\int^{\pi}_{-\pi}f(x)cos(nx)dx

For n>0:

a_n = \frac{2}{\pi}\int^{\pi}_{\pi/2}(x-\frac{\pi}{2})cos(nx)dx

Some terms canceled each other out, and to present the final answer concisely I considered the cases of values of n modulo 4.
 
Hope it is easier to follow now with the attached image.
Did you get the same expression for a_n?

Indeed I have to express the a_n consisely...
I know cos(n*Pi) = (-1)^n
but what about the other, cos(n*Pi/2)? Let's call this "?" for now. I have figured out that
n=1 --> 0
n=2 --> -1
n=3 --> 0
n=4 --> 1
n=5--> 0
and so on...

Does this mean that the a_n are different depening on whether n is odd or even?

For odd n: a_n = (2/(Pi*n^2)) * (-1)^n

And for even n: a_n = (2/(Pi*n^2)) * ((-1)^n - "?"))

Then I could of course evaluate a_1, a_2, a_3, ... etc. one by one, but it feels like there is some trick to get the a_n general and good looking...

Edit: Evaluated and plotted the first few terms, it looks "ok" I think? So maybe the calculations are correct so far.
I attach an picture of the Fourier series with those evaluated terms.
I noted that a_4, a_8, a_12 etc == 0
 

Attachments

  • fourier.JPG
    fourier.JPG
    20.3 KB · Views: 1,893
  • series.JPG
    series.JPG
    7.5 KB · Views: 749
Last edited:
I can't see your attachments yet because they're awaiting approval, but it looks like you're nearly there. The values of a_n are periodic in n with a period of 4, so essentially you need to find a_0, a_1, a_2 and a_3, and then they repeat. I'll post up my answer shortly.
 
I got:

a_n =

0 when n=0 (mod 4)

-\frac{2}{\pi n^2} when n=1,3 (mod 4)

\frac{4}{\pi n^2} when n=2 (mod 4)
 
Sweet :) Then I was right! But still, is there some tricky trick so that you can write it more beautiful as
<br /> f(x)=\frac{a_0}{2}+\Sigma^{\infty}_{n=1}a_{n}cos(n x)<br />
in one expression? Not "a_n ==, if n=1,3,5,7,9,11,13,15... if n=2,6,10,14,18...if n=0,4,8,12,16..."

Maybe the follow up question gives a clue?
It looks like this:

Use the result (from problem above) to calculate the sum
<br /> \Sigma^{\infty}_{k=0}\frac{1}{(2k+1)^{2}}<br />
 
Yes, you could split it into two series for each case where the coefficients are non-zero:

f(x) = \frac{\pi}{4} + \Sigma^{\infty}_{k=0}(-\frac{2}{\pi(2k+1)^2})cos([2k+1]x) + \Sigma^{\infty}_{k=0}(\frac{4}{\pi(4k+2)^2})cos([4k+2]x)

From this form, it should be evident how to solve the next question.
 
Thanks a lot! I have kept struggling for a while now, it looks easy but I feel stupid :(

First, a_0/2 in your last answer is Pi/4, but I have Pi/8 in my calculations..

Then the sum... That way of expressing it made it much more clear; I think that the approach is to eliminate the "last" sum

<br /> \Sigma^{\infty}_{k=0}(\frac{4}{\pi(4k+2)^2})cos([4k+2]x)<br />
which means that cos([4k+2]x)=0, which corresponds to [4k+2]x=Pi/2 ==> x = Pi/4

So I take x = Pi/4
<br /> f(\frac{\pi}{4})= 0

but then I am just getting confused by the <br /> cos([2k+1]*\frac{\pi}{4})}<br /> which is sqrt(1/2) or -sqrt(1/2) for different k's...
 
You're making it more complicated than it has to be... notice that the coefficients of the second series are 1/(4k+2)^2 = 1 / 4(2k+1)^2. So you don't have to eliminate the second series. The coefficients inside the cosines are respectively odd multipliers of x and even multipliers of x. What value of x would give a constant value for each cosine, so that you could take the cosines outside the series?

Regarding a_0, you used the formula a_0= (1/(2Pi))*AUC. I believe that should be a_0= (1/(Pi))*AUC, which gives my answer.
 
  • #10
Thanks a lot! I thought of x=0 before, but I could not find that way of rewriting the second sum!
Back to a_0... I think that the "sum" should be pi^2/8 which goes together with "my" a_0...

Here is how I did it

<br /> a_0 = \frac{1}{\pi}\int^{-\pi}_{\pi}f(x)dx =\frac{2}{\pi}\int^{\pi/2}_{\pi}(x-\frac{\pi}{2})dx =\frac{\pi}{4}<br />
 
  • #11
You're right, the answer is \frac{\pi^2}{8}. I forgot to divide a_0 by two :P
 
Back
Top