Results 1 to 9 of 9

Math Help - Fourier series of a box function.

  1. #1
    Junior Member
    Joined
    Oct 2009
    Posts
    54

    Fourier series of a box function.

    Hey all,
    I've been working on a question, and I was whether someone could go through my work and see where I went wrong.

    The problem is:
    Find the fourier series of the box function on the domain [-\pi,\pi]:
    f(x)=\left\{\begin{array}{cc}1,& |x|\leq \frac{\pi}{2}<br />
\\0, & \frac{\pi}{2}\leq |x| \leq \pi \end{array}\right.

    I need to find the coefficients A_m & B_m for the fourier series on the domain [-L,L] \phi (x)=\frac{1}{2} A_0 + \displaystyle \sum _{m=1} ^{\infty}( A_m cos(\frac{m\pi x}{L})+B_m sin(\frac{m\pi x}{L})).
    I can find the coefficients by using the following equations:
    A_m=\frac{1}{L}\int_{-L} ^L \phi (x) cos(\frac{m \pi x}{L})dx,   m=0,1,2,... and
    B_m=\frac{1}{L}\int_{-L} ^L \phi (x) sin(\frac{m \pi x}{L})dx,   m=1,2,...

    I decided, because the function is piecewise continuous, to complete the following integrals
    A_m=\frac{1}{\pi}\int_{-\frac{\pi}{2}} ^{\frac{\pi}{2}} \phi (x) cos(\frac{m \pi x}{\pi})dx and
    B_m=\frac{1}{\pi}\int_{-\frac{\pi}{2}} ^{\frac{\pi}{2}} \phi (x) sin(\frac{m \pi x}{\pi})dx

    Not from -\pi to \frac{-\pi}{2} and not from \frac{\pi}{2} to \pi as \phi (x) = 0 in these domains.

    I find that B_m=0, and A_m = \frac{2sin(m\pi )}{m \pi}. I can find A_0 =\frac{1}{\pi} \int_{-\frac{\pi}{2}} ^{\frac{\pi}{2}} dx= 1.

    Thus, my fourier series is the following:
    \phi (x) = \frac{1}{2} + \displaystyle \sum _{m=1} ^{\infty}(  \frac{2sin(m\pi )}{m \pi} cos(m x)).

    The answer supplied is the following series.
    \phi (x)=\frac{1}{2}+\frac{2}{\pi} \displaystyle \sum _{m=1} ^{\infty}(  \frac{(-1)^m}{2M+1} cos((2m+1) x))

    I feel my solution can not be transformed into that solution. Is there something wrong with my working?

    Thanks for your time.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Banned
    Joined
    Oct 2009
    Posts
    4,261
    Quote Originally Posted by Silverflow View Post
    Hey all,
    I've been working on a question, and I was whether someone could go through my work and see where I went wrong.

    The problem is:
    Find the fourier series of the box function on the domain [-\pi,\pi]:
    f(x)=\left\{\begin{array}{cc}1,& |x|\leq \frac{\pi}{2}<br />
\\0, & \frac{\pi}{2}\leq |x| \leq \pi \end{array}\right.

    I need to find the coefficients A_m & B_m for the fourier series on the domain [-L,L] \phi (x)=\frac{1}{2} A_0 + \displaystyle \sum _{m=1} ^{\infty}( A_m cos(\frac{m\pi x}{L})+B_m sin(\frac{m\pi x}{L})).
    I can find the coefficients by using the following equations:
    A_m=\frac{1}{L}\int_{-L} ^L \phi (x) cos(\frac{m \pi x}{L})dx,   m=0,1,2,... and
    B_m=\frac{1}{L}\int_{-L} ^L \phi (x) sin(\frac{m \pi x}{L})dx,   m=1,2,...

    I decided, because the function is piecewise continuous, to complete the following integrals
    A_m=\frac{1}{\pi}\int_{-\frac{\pi}{2}} ^{\frac{\pi}{2}} \phi (x) cos(\frac{m \pi x}{\pi})dx and
    B_m=\frac{1}{\pi}\int_{-\frac{\pi}{2}} ^{\frac{\pi}{2}} \phi (x) sin(\frac{m \pi x}{\pi})dx

    Not from -\pi to \frac{-\pi}{2} and not from \frac{\pi}{2} to \pi as \phi (x) = 0 in these domains.

    I find that B_m=0, and A_m = \frac{2sin(m\pi )}{m \pi}. I can find A_0 =\frac{1}{\pi} \int_{-\frac{\pi}{2}} ^{\frac{\pi}{2}} dx= 1.

    Thus, my fourier series is the following:
    \phi (x) = \frac{1}{2} + \displaystyle \sum _{m=1} ^{\infty}(  \frac{2sin(m\pi )}{m \pi} cos(m x)).

    The answer supplied is the following series.
    \phi (x)=\frac{1}{2}+\frac{2}{\pi} \displaystyle \sum _{m=1} ^{\infty}(  \frac{(-1)^m}{2M+1} cos((2m+1) x))

    I feel my solution can not be transformed into that solution. Is there something wrong with my working?

    Thanks for your time.


    Being \Phi(x) an even function it is immediate that  B_m=0\,\,\forall m . Now, for A_m you get:

    A_m=\frac{1}{\pi}\int\limits^{\pi/2}_{-\pi/2}\cos mxdx=\frac{1}{m\pi}\sin mx\left|^{\pi/2}_{-\pi/2}\right.=\frac{2}{m\pi}\sin\frac{m\pi}{2} , but we know that \sin\frac{m\pi}{2}=\left\{\begin{array}{rl}0&if\,m  =0,2\!\!\pmod 4\\-1&if\,m=3\!\!\pmod 4\\1&if\,m=1\!\!\pmod 4\end{array}\right. ,

    so the only non-zero values are obtained from the odd indexes (which is what you have in your answer!). Try to continue from here

    Tonio
    Follow Math Help Forum on Facebook and Google+

  3. #3
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    You went wrong in calculating the integral for A_m. It should be

    A_m = \frac{1}{\pi}{\displaystyle\int_{-\pi/2} ^{\pi/2}}\!\! f (x) \cos\bigl(\frac{m \pi x}{\pi}\bigr)\,dx = \frac{1}{\pi}{\displaystyle\int_{-\pi/2} ^{\pi/2}}\!\!\! \cos(mx)\,dx = \Bigl[\frac1m\sin(mx)\Bigr]_{-\pi/2} ^{\pi/2} = \frac1m\bigl(\sin\frac{m\pi}2 - \sin\frac{-m\pi}2\bigr).

    But \sin(-\theta) = -\sin\theta. So A_m = \frac2m\sin\frac{m\pi}2. Next, \sin\frac{m\pi}2 is 0 if m is even, and it is alternately +1 and –1 if m is odd. That should get you to the required form of the answer.

    Edit. Beaten to it by tonio!
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Oct 2009
    Posts
    54
    Thanks for that, both of you. So, M becomes 2M+1 because sine is only +/- 1 at odd indexes? Was it really necessary to change M to 2M + 1? Is there a real significant change to having 1 or -1 divided by an odd integer than a even integer in this case?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Banned
    Joined
    Oct 2009
    Posts
    4,261
    Quote Originally Posted by Silverflow View Post
    Thanks for that, both of you. So, M becomes 2M+1 because sine is only +/- 1 at odd indexes? Was it really necessary to change M to 2M + 1?


    Well, that way you have a closed, nice and simple formula for A_n...

    Tonio



    Is there a real significant change to having 1 or -1 divided by an odd integer than a even integer in this case?
    .
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Junior Member
    Joined
    Oct 2009
    Posts
    54
    Rightio, cheers.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Junior Member
    Joined
    Oct 2009
    Posts
    54
    Sorry, just one more question that I have. What if the function is now f(x)=\left\{\begin{array}{cc}1,& |x|< \frac{\pi}{2}<br />
\\0, & \frac{\pi}{2} < |x| < \pi \end{array}\right on the domain (-\pi,\pi)? Does the Fourier series change as the function is no longer piecewise continuous?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Banned
    Joined
    Oct 2009
    Posts
    4,261
    Quote Originally Posted by Silverflow View Post
    Sorry, just one more question that I have. What if the function is now f(x)=\left\{\begin{array}{cc}1,& |x|< \frac{\pi}{2}<br />
\\0, & \frac{\pi}{2} < |x| < \pi \end{array}\right on the domain (-\pi,\pi)? Does the Fourier series change as the function is no longer piecewise continuous?

    Says who? As you're going to continue the definition of f(x) periodically, the function (in all the reals) is

    too piecewise continuous!

    Tonio
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Junior Member
    Joined
    Oct 2009
    Posts
    54
    Ok, that makes sense. Thank you soo much for your time.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. [SOLVED] Show the Fourier series of a function
    Posted in the Differential Geometry Forum
    Replies: 5
    Last Post: August 20th 2010, 03:34 AM
  2. Fourier series of a function
    Posted in the Differential Geometry Forum
    Replies: 0
    Last Post: July 27th 2010, 09:33 AM
  3. Fourier series of step function
    Posted in the Calculus Forum
    Replies: 3
    Last Post: January 17th 2010, 01:57 PM
  4. Fourier series of a function defined by parts
    Posted in the Calculus Forum
    Replies: 1
    Last Post: October 30th 2009, 04:28 AM
  5. Fourier Series of odd function
    Posted in the Differential Geometry Forum
    Replies: 4
    Last Post: August 15th 2009, 11:39 AM

Search Tags


/mathhelpforum @mathhelpforum