Help solving fourier cosine series related problem

RJLiberator
Gold Member
Messages
1,094
Reaction score
63

Homework Statement


3.jpg


I am doing #9.

Homework Equations

The Attempt at a Solution


I've been looking at a lot of similar problems on the internet. The main difference between this one and them is that this one has an interval of [0,4] while they often have intervals of [0,pi] or [-pi,pi]

In my class, we discussed using change of variables to make it into some form.

I thought maybe I could work with [-2,2] and call it an even function letting [-2,2] f(x) = 1.

But I didn't get anywhere with this.

It's, once again, one of these problems where once I get the first step, I feel like I will be off to the races. The answer to this problem is:
(4/pi)∑[(-1)^(n+1)/(2n-1)]*[cos[(2n-1)*pi*x/4]]
 
Physics news on Phys.org
Here's some of my further work.

We wish to represent this as a cosine series.

f(x) = 1 = ∑a_n*cos(n*pi*x/L)

a_n = 2/L integral from 0 to L of f(x) * cos(n*pi*x/L)dx
= 2/L integral from 0 to L cos(n*pi*x/L) dx
= (2/L)*(L/(n*pi))*[sin(n*pi*x/L)] from 0 to L

= 2/L *L/(n*pi) * sin((n*pi)-0)

The problem here is, is that sin(n*pi) is always equal to 0.

:/
 
I think I am on to something.

So, in my post above, I solved only half of the problem (I think) from 0 to 2.

But, f(x) = -1 from 2 < x < 4
so we solve the other half, similarly

2/L *L/(n*pi) * sin((n*pi)-sin(n*pi/2))
= 2/(n*pi)*(-sin(n*pi/2))

Here, sin(n*pi/2) is either 1 or -1 (when odds) or 0 (when even)

So if we add the two (or subtract, not sure which one yet) solutions together we get
0 +/- (-2/(n*pi))(-1)^n
where n is odd

the sum starts to look like the answer from the book when we make the switch from n to 2n+1 for the summation so that all n values become odd.

2/pi ∑[(-1)^(n+1)/(2n+1)]*[cos[(2n+1)*pi*x/4]]

Answer from book:
4/pi∑[(-1)^(n+1)/(2n-1)]*[cos[(2n-1)*pi*x/4]]

Not sure if this is at all correct, but it's looking closer and closer like the solution. Not sure how I got 2/pi instead of 4/pi and the - and + signs are killing me.
 
RJLiberator said:
Here's some of my further work.

We wish to represent this as a cosine series.
Doesn't the problem ask you for a sine series? You want to extend the function for x<0 so that f(-x) = f(x).

f(x) = 1 = ∑a_n*cos(n*pi*x/L)

a_n = 2/L integral from 0 to L of f(x) * cos(n*pi*x/L)dx
= 2/L integral from 0 to L cos(n*pi*x/L) dx
= (2/L)*(L/(n*pi))*[sin(n*pi*x/L)] from 0 to L

= 2/L *L/(n*pi) * sin((n*pi)-0)

The problem here is, is that sin(n*pi) is always equal to 0.

:/
This is right for the cosine series, but you're assuming here that ##n\ne 0##. You need to consider that case separately.
 
  • Like
Likes RJLiberator
Oh, you're doing #9. Never mind. ;)
 
  • Like
Likes RJLiberator
If n equals 0 we have sin(n*pi) = 0 and an n in the denominator. That's no good!

a_0 = 2/pi based on
1/pi* integral from 0 to 2 of 1

(from the definition of cosine a_0)Was I correct in my latest post suggesting that I should also look at the 2 <x < 4 part and add/subtract that to the 0 part ?
 
Remember ##a_0## is the average value of the function, so in this case, you expect ##a_0=0##. For a constant function f(x)=1, you would have gotten ##a_0=1##.

To answer your question, yes, you have to integrate over the entire cycle.
$$a_n = \frac 2L \int_0^4 f(x)\cos\left(\frac{2\pi n}{L} x\right)\,dx = \frac 2L \int_0^2 f(x)\cos\left(\frac{2\pi n}{L} x\right)\,dx + \frac 2L \int_2^4 f(x)\cos\left(\frac{2\pi n}{L} x\right)\,dx$$ You just need to evaluate the integral piecewise since f(x) is defined piecewise.
 
  • Like
Likes RJLiberator
Are you sure that the cosine function takes on the argument of (2*pi*n*x / L) instead of just pi*n*x/L ?

I have not seen that on other websites :o.
 
In the second term, I would think L aka the length, would be equal to 2 and not 4.
If this is true, then we have 0 + 0 and this doesn't make any sense to me.
However, If L = 4 then I am on my way to the solution, but I don't understand why it would equal 4.
 
  • #10
RJLiberator said:
Are you sure that the cosine function takes on the argument of (2*pi*n*x / L) instead of just pi*n*x/L ?

I have not seen that on other websites :eek:.
I made a mistake. You're right. For the general Fourier series, you're expanding in multiples of the fundamental frequency ##\frac{2\pi}{T}##, where ##T## is the period.

Here, the function is defined from 0 to ##L##, but you're extending it to an even function defined on ##[-L,L]## so ##T=2L##.
 
  • Like
Likes RJLiberator
  • #11
Ah, so L does equal 2 but since we are extending it, 2*2 = 4 and now I can solve it.

:).
 
  • #12
No, ##L=4## and ##T=8##. Look at the interval the original function is defined on.
 
  • Like
Likes RJLiberator

Similar threads

Back
Top