1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Solving a Differential Equation with a Fourier Series

  1. Jun 7, 2005 #1
    I am not sure I am doing this correctly, so here it is.

    Problem:

    Find the Fourier Series

    [tex]f(s)\,=\,\left\{\begin{array}{ccc}x^2&-\pi\,<\,x\,<\,0\\0 &0\,<x\,<\,\pi \\}\end{array}\right[/tex]

    Answer(supposedly):

    [tex]a_0\,=\,\frac{\pi^3}{3}[/tex]

    [tex]a_n\,=\,-\frac{2}{n^2}[/tex]

    [tex]b_n\,=\,\frac{4\,-\,n^2\,\pi^2}{n^3\,\pi}[/tex]

    Does that look right? If so, where do I gofrom here?

    [tex]f(s)\,\approx\,\frac{\pi^3}{3}\,+\,\sum_{n\,=\,1}^{\infty}\,\left[-\frac{2}{n^2}\,cos(n\,x)\,+\,\frac{4\,-\,n^2\,\pi^2}{n^3\,\pi}\,sin(n\,x)\right][/tex]

    Is this the final answer?
     
  2. jcsd
  3. Jun 7, 2005 #2
    Can anyone type this into mathematica?

    Please double check :biggrin:
     
  4. Jun 7, 2005 #3
    Here is how I got the a0, an and bn factors

    [tex]a_0\,=\,\frac{1}{\pi}\,\int_{-\pi}^{0}\,x^2\,dx\,=\,\frac{\pi^2}{3}[/tex]

    [tex]a_n\,=\,\frac{1}{\pi}\,\int_{-\pi}^{0}\,x^2\,cos\,(n\,x)\,dx[/tex]

    [tex]a_n\,=\,\frac{1}{\pi}\,\left[\frac{x^2\,sin\,(n\,x)}{n}\,+\,\frac{2\,x\,cos\,(n\,x)}{n^2}\,-\,\frac{2\,sin\,(n\,x)}{n^3}\right]_{-\pi}^{0}[/tex]

    Right? Then:

    [tex]a_n\,=\,-\frac{2}{n^2}[/tex]

    Am I on the right track here? or am i completely missing something?
     
    Last edited: Jun 7, 2005
  5. Jun 7, 2005 #4
    Or is this how to solve a_n?

    [tex]a_n\,=\,\frac{1}{\pi}\,\int_{-\pi}^{0}\,x^2\,cos\,(n\,x)\,dx\,=\,\frac{1}{\pi}\,\left[\frac{n^2\,x^2\,sin\,(n\,x)\,-\,2\,sin\,(n\,x)\,+\,2\,n\,x\,cos\,(n\,x)}{n^3}\right]_{-\pi}^{0}[/tex]

    [tex]a_n\,=\,\frac{1}{\pi}\,\left[\frac{(-\pi)^2\,n^2\,sin\,(-\pi\,n)\,-\,2\,sin\,(-\pi\,n)\,-\,2\,\pi\,n\,cos\,(-\pi\,n)}{n^3}\right]\,=\,\frac{1}{\pi}\,\left[\frac{2\,\pi\,n\,cos\,(-\pi\,n)}{n^3}\right][/tex]

    [tex]a_n\,=\,\frac{1}{\pi}\,\left[\frac{-2\,\pi\,n\,(-1)^n}{n^3}\right]\,=\,\frac{-2\,n\,(-1)^n}{n^3}[/tex]

    Which one is correct?
     
  6. Jun 8, 2005 #5

    OlderDan

    User Avatar
    Science Advisor
    Homework Helper

    I think I see several sign mistakes, with the last sign being wrong. Why not reduce the last expression n/n^3??
     
  7. Jun 8, 2005 #6
    You need to revisit your bn with your newly refound knowledge of the behavior of sine and cosine.

    The sign of your an term is indeed incorrect.

    Why do I let myself get dragged into other people's problems? *sighs* Back to finals! Work, damn me!

    --J
     
  8. Jun 8, 2005 #7
    Is this the correct an then?

    Is the term below right for an?

    [tex]a_n\,=\,\frac{1}{\pi}\,\left[\frac{-2\,\pi\,n\,(-1)^n}{n^3}\right]\,=\,\frac{-2\,n\,(-1)^n}{n^3}\,=\,-\frac{2\,(-1)^n}{n^2}[/tex]

    Thanks again!
     
  9. Jun 8, 2005 #8
    You got an extra negative. [itex]\cos{n\pi} = (-1)^n[/itex], which we can verify by noting that when n = 0, [itex]n\pi = 0[/itex], so [itex]\cos{n\pi} = 1[/itex]. Additionally, when n = 1, we just have cosine of pi, which is -1. So we must have (-1)n instead of (-1)n-1.

    --J
     
  10. Jun 8, 2005 #9
    So, the an is:

    [tex]a_n\,=\,\frac{2\,(-1)^n}{n^2}[/tex]

    Right?
     
  11. Jun 8, 2005 #10
    Looks good. Now go have another look at those b coefficients.

    --J

    Just one final left... Yay me!
     
  12. Jun 8, 2005 #11
    Now for the bn!

    [tex]b_n\,=\,\frac{1}{\pi}\,\int_{-\pi}^{0}\,x^2\,sin\,(n\,x)\,dx\,=\,\frac{1}{\pi}\,\left[\frac{-n^2\,x^2\,cos\,(n\,x)\,+\,2\,cos\,(n\,x)\,2\,n\,x\,sin\,(n\,x)}{n^3}\right]_{-\pi}^{0}[/tex]

    [tex]b_n\,=\,\frac{1}{\pi}\,\left[\frac{2}{n^3}\,+\,\frac{\pi^2\,(-1)^n}{n}\,-\,\frac{2\,(-1)^n}{n^3}\right][/tex]

    [tex]b_n\,=\,\frac{2}{\pi\,n^3}\,+\,\frac{\pi\,(-1)^n}{n}\,-\,\frac{2\,(-1)^n}{\pi\,n^3}[/tex]

    Does that look right also?

    Good luck on the final! I feel for you man.
     
  13. Jun 8, 2005 #12
    Looks like you got it.

    And just in case you were interested, here's some plots of the fourier series truncated to 5, 15, 50, and 500 terms. Can't even tell it's not the function itself in the 500 one, can ya'?

    Good job.

    --J
     

    Attached Files:

  14. Jun 8, 2005 #13
    Awesome plots.

    Thanks alot for the help.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?