Troubleshooting Fourier Series Expansion for Piecewise Function

Click For Summary
The discussion revolves around finding the Fourier series expansion for a piecewise function defined as f(t)=0 for -pi<t<0 and f(t)=t^2 for 0<t<pi. The user initially calculates the Fourier coefficients but encounters issues when plotting the series in Mathematica, as the graph does not align with the expected behavior of the function. After identifying mistakes in the integrals, corrections are made, leading to improved results, yet discrepancies remain. The user seeks clarification on the impact of separating odd and even terms in the series and expresses relief that the Fourier method remains valid. Ultimately, the conversation highlights the importance of careful calculation and verification in Fourier analysis.
Telemachus
Messages
820
Reaction score
30
Hi there. I have some trouble with this problem, it asks me to find the Fourier expansion series for the function
f(t)=0 if -pi<t<0, f(t)=t^2 if 0<t<pi

So I've found the coefficients a_0=\displaystyle\frac{1}{\pi}\displaystyle\int_{0}^{\pi}t^2dt=\displaystyle\frac{\pi^2}{3}

a_n=\displaystyle\frac{1}{n^2}\cos(n\pi)

b_n=-\displaystyle\frac{\pi\cos(n\pi)}{n}-\displaystyle\frac{4}{n^3\pi}

Then the Fourier series expansion:

f(t)\sim{\displaystyle\frac{\pi^2}{6}+\sum_{n=1}^{\infty}\displaystyle\frac{1}{n^2}\cos(n\pi)\cos(nt)- \left( \displaystyle\frac{\pi}{n}+ \displaystyle\frac{4}{n^3\pi}\right)\sin(nt)}

When I plot this on mathematica I get something that doesn't look like what I'm looking for. I've tried many ways, I've done the integrals first by hand, then I did it with mathematica, the graph always seems the same, it doesn't get to zero in the interval zero to -pi as it should, and it isn't close to the plot of t^2, it doesn't even get to zero on the origin. I don't know what I'm doing wrong. I've looked at the equations carefully, I'm pretty much sure I've done things right. Whats happening?

attachment.php?attachmentid=35997&stc=1&d=1306620049.png


I've also tried to make a distinction between the odd and even cases, but as I supposed it didn't affect at all, the equation as I wrote it includes both cases.
 

Attachments

  • four.PNG
    four.PNG
    1.9 KB · Views: 759
Last edited:
Physics news on Phys.org
I don't obtain the same integrals as you do. At least, wolfram alpha doesn't. Can you show how you found them?
 
Alright.

a_n=\displaystyle\frac{1}{\pi}\displaystyle\int_{0}^{\pi}t^2\cos(nt)dt=\displaystyle\frac{1}{n^2} \cos(n\pi)

b_n=\displaystyle\frac{1}{\pi}\displaystyle\int_{0}^{\pi}t^2\sin(nt)dt=\displaystyle\frac{-\pi}{n}\cos(n\pi)-\displaystyle\frac{4}{n^3\pi}

Thats how I did it. Do you need the mid steps? its quiet a bit tricky. For the first integral mathematica give just the same, but with a sine with an npi inside, which is obviously zero. For the second integral it gives something quiet similar to the result I've found. Anyway, I've tried using mathematica results, and gives the same graph.

Ow. I've found a mistake in my integrals now, but I think it doesn't change much.

Ok, I've corrected the mistake, now this is what I get:
attachment.php?attachmentid=36001&stc=1&d=1306626781.png

Its closer now, but stills wrong.
 

Attachments

  • four2.PNG
    four2.PNG
    6.9 KB · Views: 561
Last edited:
Those results aren't correct.
 
You were right, I had another silly mistake :) I think its okey now:

https://www.physicsforums.com/attachment.php?attachmentid=36003&stc=1&d=1306628272

It doesn't make any difference in separating the summations on odd and even numbers, right? or does it have something to do with the speed of convergence?
 

Attachments

  • four3.PNG
    four3.PNG
    5.5 KB · Views: 510
Ah, it's good to hear that Fourier hasn't been disproved :biggrin:
 
Thank you both :D
 

Similar threads

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