Why Are My Fourier Series Calculations Giving Me Nonsense Results?

Click For Summary

Homework Help Overview

The discussion revolves around the calculation of Fourier series for a piecewise function defined on the interval \([-π, π]\). Participants are examining the integrals involved in determining the coefficients \(a_n\) and \(b_n\) of the series.

Discussion Character

  • Mathematical reasoning, Assumption checking

Approaches and Questions Raised

  • The original poster attempts to calculate the Fourier coefficients using integration by parts but encounters discrepancies in their results. Some participants question the correctness of the integration steps and the application of the theorem used.

Discussion Status

Participants are actively engaging with the original poster's calculations, pointing out potential errors and discussing the implications of those errors. There is a focus on clarifying the integration process and the application of the theorem, with some guidance offered regarding the signs in the equations.

Contextual Notes

There is mention of a reference to external video resources for further clarification, indicating that participants are seeking additional support materials. The original poster expresses confusion about the feedback received, highlighting the complexity of the topic.

estro
Messages
239
Reaction score
0
I'm trying to get Fourier series for some function however I get the same nonsense series each time:

[tex] f(x)=\begin{cases}<br /> 0, & \mbox{if x $\in [-\pi,0]$}\\<br /> x, & \mbox{if x $\in (0,\pi)$} \end{cases}[/tex]

[tex] \pi a_n=\int_{-\pi}^\pi f(x)cos(nx)dx=\int_{-\pi}^0 0 \cdot cos(nx)dx+\int_0^\pi xcos(nx)dx=\left.\left[\frac{xsin(nx)}{n}-\frac{cos(nx)} {n^2}\right]\right|_0^\pi[/tex]

[tex] =\frac{\pi sin(n\pi)}{n}-\frac{cos(n\pi)} {n^2} - \frac{0 sin(0)}{n}+ \frac {cos(0)} {n^2}=\frac {1-(-1)^n}{n^2}[/tex]

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

[tex] \pi b_n=\int_{-\pi}^\pi f(x)sin(nx)dx=\int_{-\pi}^0 0 \cdot sin(nx)dx+\int_0^\pi xsin(nx)dx=\left. \left[-\frac{xcos(nx)}{n}-\frac{sin(nx)}{n^2}\right] \right|_0^\pi=-\frac{\pi (-1)^n}{n}[/tex]

[tex] b_n=-\frac{(-1)^n}{n}[/tex]


WolframAlpha suggests that I wrongly calculated the integral, however I used well know theorem:
[tex]\int p(x)f(x)dx=p \cdot F_1+p' \cdot F_2...[/tex]
You can also see the same on this picture:
0.jpeg
 
Last edited:
Physics news on Phys.org
estro said:
[tex] \pi a_n=\int_{-\pi}^\pi f(x)cos(nx)dx=\int_{-\pi}^0 0 \cdot cos(nx)dx+\int_0^\pi xcos(nx)dx=\left.\left[\frac{xsin(nx)}{n}-\frac{cos(nx)} {n^2}\right]\right|_0^\pi[/tex]

That last minus should be a plus; that's all that is wrong.
 
LCKurtz said:
That last minus should be a plus; that's all that is wrong.

Sorry but I don't understand why.

if p(x) is polynomial and f(x) is continues in I then:
[tex]\int p(x)f(x)dx=p(x)F_1+p'(x)F_2[/tex] where F_1 is integral of f(x) and F_2 is the integral of the integral of f(x)

p(x)=x, p'(x)=1
f(x)=cos(nx)
[tex]\int f(x)=F_1=\frac{sin(nx)}{n}[/tex]
[tex]\int F_1=F_2=\frac{-cos(nx)}{n^2}[/tex]

Thus: [tex]\int xcos(nx)=\frac{sin(nx)}{n}-\frac{cos(nx)}{n^2}[/tex]
 
estro said:
Sorry but I don't understand why.

if p(x) is polynomial and f(x) is continues in I then:
[tex]\int p(x)f(x)dx=p(x)F_1+p'(x)F_2[/tex] where F_1 is integral of f(x) and F_2 is the integral of the integral of f(x)

That formula is incorrect. That + should be a -.
 
LCKurtz said:
That formula is incorrect. That + should be a -.

Actually, there is more than that wrong with it. If F(x) is an antiderivative of f(x):

[tex]\int p(x)f(x)\, dx = p(x)F(x) -\int p'(x)F(x)\, dx[/tex]
 
Last edited:
Oh this is embarrassing mistake...

Thanks [again]!
 

Similar threads

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