Find the Fourier Series of the function

Click For Summary

Homework Help Overview

The problem involves finding the Fourier series of a piecewise function defined as ##f(x) = 1## for ##|x| \geq \frac{\pi}{2}## and ##f(x) = 0## for ##|x| \leq \frac{\pi}{2}## over the interval ##[-\pi, \pi]##. Participants are exploring the implications of the function's definition and the calculation of Fourier coefficients.

Discussion Character

  • Exploratory, Assumption checking, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the interpretation of the function's definition and whether it requires separate calculations for different intervals or a unified approach. There is also confusion regarding the integration limits based on the piecewise definition.

Discussion Status

Some participants have provided clarifications regarding the integration intervals needed for the Fourier coefficients, noting that the function is even, which simplifies the calculations. Others are working through their computations and identifying errors in their previous attempts.

Contextual Notes

Participants mention constraints related to the context of the problem, such as the relevance of the human ear's frequency limit in the Fourier series context, which has not been fully explained in the course materials.

lesdes
Messages
12
Reaction score
0

Homework Statement


Find the Fourier series of the function ##f## given by ##f(x) = 1##, ##|x| \geq \frac{\pi}{2}## and ##f(x) = 0##, ##|x| \leq \frac{\pi}{2}## over the interval ##[-\pi, \pi]##.

Homework Equations


From my lecture notes, the Fourier series is
##f(t) = \frac{a_0}{2}*1 + \sum_{n=1}^\infty a_n cos(nt) + \sum_{n=1}^\infty b_n sin(nt) ##. Instead of ##\infty## we use ##N\leq20 000## because that is the limit of the human ear in Hz. (No clue why this is relevant because it is never mentioned or used again throughout the course; it is only mentioned in the lecture notes next to the definition)

The Fourier coefficients are given by
##a_k = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t)cos(kt) \, dt##, and
##b_k = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t)sin(kt) \, dt##.

Also there is this neat result that if ##f## is odd, then
##a_k = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t)cos(kt) \, dt = 0##, and
##b_k = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t)sin(kt) \, dt = \frac{2}{\pi} \int_{0}^{\pi} f(t)sin(kt) \, dt##.

If ##f## is even, then
##a_k = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t)cos(kt) \, dt = \frac{2}{\pi} \int_{0}^{\pi} f(t)cos(kt)##, and
##b_k = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t)sin(kt)\, dt = 0##.

The Attempt at a Solution


The computations of the Fourier coefficients seem simple enough. I am however confused as to what precisely the problem states.

Do I have to calculate the Fourier series for the function ##f(x) = 1## over the interval ##[-\pi, \pi]## with ##|x| \geq \frac{\pi}{2}## and then for a second function ##g(x) = 0## over the interval ##[-\pi, \pi]## with ##|x| \leq \frac{\pi}{2}##?
Or does this mean ##f(x) =
\begin{cases}
1 & \text{if } |x| \geq \frac{\pi}{2}\\
0 & \text{if } |x | \leq \frac{\pi}{2}
\end{cases}##.

If the former, then what do the conditions ##|x| \geq \frac{\pi}{2}## and ##|x| \leq \frac{\pi}{2}## mean? Do I still use the integrals from ##a = -\pi## and ##b = \pi## or does for example ##|x| \geq \frac{\pi}{2}## mean that the integral bounds are ##a = -\frac{\pi}{2}## and ##b = \frac{\pi}{2}##?

If the latter, then I have not really an idea on how to proceed.
 
Physics news on Phys.org
lesdes said:
Or does this mean
##f(x) =
\begin{cases}
1 & \text{if } |x| \geq \frac{\pi}{2}\\
0 & \text{if } |x | \leq \frac{\pi}{2}
\end{cases}##.
It means this. Your integrals will need to take into account the three different subintervals: ##[-\pi, -\pi/2], [-\pi/2, \pi/2], [\pi/2, \pi]##. There is some simplification, though, because this is an even function, which means there won't be any sine terms.
 
  • Like
Likes   Reactions: lesdes
lesdes said:
because that is the limit of the human ear
Apparently, this problem has to do with acoustics, and you don't need to be adding waves that are above the ability of the human ear to hear.
 
  • Like
Likes   Reactions: lesdes
Mark44 said:
It means this. Your integrals will need to take into account the three different subintervals: ##[-\pi, -\pi/2], [-\pi/2, \pi/2], [\pi/2, \pi]##. There is some simplification, though, because this is an even function, which means there won't be any sine terms.

Thank you. I will try and solve it and if I run into any more problems I will come back here or if I arrive at a solution.
Mark44 said:
Apparently, this problem has to do with acoustics, and you don't need to be adding waves that are above the ability of the human ear to hear.

Well, the course is Linear Algebra and Fourier Series. The prof just said when he explained the topic of Fourier series "We will make a cut here (he referred to ##\infty##) and use ##N \leq 20000## (Hz) because that is the limit of the human ear". And the problems are all of the sort "Find the Fourier series of the function...". That is why I find it odd that he mentioned that.
 
This is what I have done.

##a_0 = \frac{1}{2\pi}(\int_{-\pi}^{-\frac{\pi}{2}} 1 \, dx + \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} 0 \, dx + \int_{\frac{\pi}{2}}^{\pi} 1 \, dx = \frac{1}{2\pi}(x\left. \right|_{-\pi}^{-\frac{\pi}{2}} + 0 + x\left. \right|_{\frac{\pi}{2}}^{\pi}) = \frac{1}{2\pi}(\frac{\pi}{2} + \frac{\pi}{2}) = 2##.

Since ##f## is even, we have ##b_n = 0## for every ##n##.
Since ##f## is even, we have ##a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x)cosnx \, dx = \frac{2}{\pi} \int_{0}^{\pi} f(x)cosnx \, dx ##.

Thus,
##a_n = \frac{2}{\pi}(\int_{0}^{\frac{\pi}{2}} 0*cosnx \, dx + \int_{\frac{\pi}{2}}^{\pi} 1*cosnx \, dx) = \frac{2}{\pi}*\frac{1}{n}sinnx\left. \right|_{\frac{\pi}{2}}^{\pi} = \frac{2}{\pi n}(sinn\pi -sinn\frac{\pi}{2}) = -\frac{2}{n\pi}sinn\frac{\pi}{2}##.

For ##n## even, we have ##sinn\frac{\pi}{2} = 0## and for ##n## odd, we have ##sinn\frac{\pi}{2} = \pm1##.
The Fourier series of ##f## is
$$S_n(x) = 2 - \frac{2}{\pi}sinx - \frac{2}{3\pi}sin3x - \frac{2}{5\pi}sin5x - ... = 2 + \sum_{n=0}^\infty -\frac{2}{\pi(2n - 1)} sin(x(2n - 1)).$$
 
lesdes said:
This is what I have done.

##a_0 = \frac{1}{2\pi}(\int_{-\pi}^{-\frac{\pi}{2}} 1 \, dx + \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} 0 \, dx + \int_{\frac{\pi}{2}}^{\pi} 1 \, dx = \frac{1}{2\pi}(x\left. \right|_{-\pi}^{-\frac{\pi}{2}} + 0 + x\left. \right|_{\frac{\pi}{2}}^{\pi}) = \frac{1}{2\pi}(\frac{\pi}{2} + \frac{\pi}{2}) = 2##.

Since ##f## is even, we have ##b_n = 0## for every ##n##.
Since ##f## is even, we have ##a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x)cosnx \, dx = \frac{2}{\pi} \int_{0}^{\pi} f(x)cosnx \, dx ##.

Thus,
##a_n = \frac{2}{\pi}(\int_{0}^{\frac{\pi}{2}} 0*cosnx \, dx + \int_{\frac{\pi}{2}}^{\pi} 1*cosnx \, dx) = \frac{2}{\pi}*\frac{1}{n}sinnx\left. \right|_{\frac{\pi}{2}}^{\pi} = \frac{2}{\pi n}(sinn\pi -sinn\frac{\pi}{2}) = -\frac{2}{n\pi}sinn\frac{\pi}{2}##.

For ##n## even, we have ##sinn\frac{\pi}{2} = 0## and for ##n## odd, we have ##sinn\frac{\pi}{2} = \pm1##.
The Fourier series of ##f## is
$$S_n(x) = 2 - \frac{2}{\pi}sinx - \frac{2}{3\pi}sin3x - \frac{2}{5\pi}sin5x - ... = 2 + \sum_{n=0}^\infty -\frac{2}{\pi(2n - 1)} sin(x(2n - 1)).$$

How can an even function have sines in its expansion?
 
  • Like
Likes   Reactions: lesdes
Ray Vickson said:
How can an even function have sines in its expansion?

Ah yes. I accidentally used the ##a_n## in the definition for the Fourier expression from post 1 as ##b_n##. I think I mixed them up. I will look at it tomorrow. It's 4 am now. Probably that is also the reason for such silly mistakes.
 
So I went over it again and I noticed the following error in ##a_0##. It should be ##a_0=\frac{1}{2}## and not ##a_0=2##.
lesdes said:
This is what I have done.

##a_0 = \frac{1}{2\pi}(\int_{-\pi}^{-\frac{\pi}{2}} 1 \, dx + \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} 0 \, dx + \int_{\frac{\pi}{2}}^{\pi} 1 \, dx = \frac{1}{2\pi}(x\left. \right|_{-\pi}^{-\frac{\pi}{2}} + 0 + x\left. \right|_{\frac{\pi}{2}}^{\pi}) = \frac{1}{2\pi}(\frac{\pi}{2} + \frac{\pi}{2}) = 2##.

Also now I have the Fourier series for ##f## given by

$$S_n(x) = \frac{1}{2} - \frac{2}{\pi}cosx + \frac{2}{3\pi}cos3x - \frac{2}{5\pi}cos5x + ... = \frac{1}{2} + \sum_{n=1}^\infty (-1)^n\frac{2}{\pi(2n - 1)} cos(x(2n - 1)).$$
Is this correct now?

As a side question. How do I graph the function ##f## and the Fourier series in Mathematica? I have tried the following but the Fourier series does not show up.
1.png
 

Attachments

  • 1.png
    1.png
    11.1 KB · Views: 506
In your second plot, your Mathematica notation might be wrong. I'm not very knowledgeable about Mathematica, so I might be mistaken.
In the factor right after (-1)^i, you have 2/Pi (2i - 1). I think that you believe that this is ##\frac 2 {\pi(2i - 1)}##. It's not.

This would actually be evaluated as ##\frac 2 \pi (2i - 1)##
I believe this factor should be 2/(Pi * (2i - 1)).

Also for the cosine factor, you are missing an operator for multiplication. This might not be a problem in Mathematica, but it is a problem in virtually every other programming language. I believe this should be Cos(x * (2i - 1)) or Cos((2i - 1) * x).
 
  • Like
Likes   Reactions: lesdes
  • #10
Mark44 said:
In your second plot, your Mathematica notation might be wrong. I'm not very knowledgeable about Mathematica, so I might be mistaken.
In the factor right after (-1)^i, you have 2/Pi (2i - 1). I think that you believe that this is ##\frac 2 {\pi(2i - 1)}##. It's not.

This would actually be evaluated as ##\frac 2 \pi (2i - 1)##
I believe this factor should be 2/(Pi * (2i - 1)).

Also for the cosine factor, you are missing an operator for multiplication. This might not be a problem in Mathematica, but it is a problem in virtually every other programming language. I believe this should be Cos(x * (2i - 1)) or Cos((2i - 1) * x).

Yes thank you! I totally missed the parentheses there and I also noticed that I butchered the syntax of Mathematica. It should be Cos[] and not Cos(). Now I have
the following plot for ##n=10## and ##n=100## for the Fourier series
2.png


So my Fourier series is correct then, I suppose?
 

Attachments

  • 2.png
    2.png
    18.8 KB · Views: 534
  • #11
Those look right on the money! Well done!
 
  • Like
Likes   Reactions: lesdes
  • #12
Mark44 said:
Those look right on the money! Well done!

Great!
There is a follow up problem in my assignment to the one here (like check for uniform convergence, ##L^2##-convergence). I will first go and read my notes and book about that, especially ##L^2##-convergence since I have never done that. Then attempt so solve that problem. If I will have questions regarding that should I ask them here or open a new thread?
 
  • #13
Please start a new thread. That way you'll have the problem statement, relevant definitions/equations (e.g., uniform convergence), and your efforts all together in a thread with a relevant title.
 
  • Like
Likes   Reactions: lesdes

Similar threads

  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K