Solving a Differential Equation with a Fourier Series

Click For Summary
SUMMARY

The discussion focuses on solving a differential equation using Fourier Series, specifically for the function defined piecewise as f(s) = {x^2 for -π < x < 0, 0 for 0 < x < π}. The coefficients derived include a_0 = π^3/3, a_n = 2(-1)^n/n^2, and b_n = (2/πn^3) + (π(-1)^n/n) - (2(-1)^n/πn^3). The participants confirm the correctness of these coefficients and discuss the integration process used to derive them, emphasizing the importance of sign accuracy in the calculations.

PREREQUISITES
  • Understanding of Fourier Series and their applications
  • Knowledge of integration techniques, particularly for piecewise functions
  • Familiarity with trigonometric identities and their implications in Fourier analysis
  • Experience with Mathematica or similar computational tools for plotting functions
NEXT STEPS
  • Study the derivation of Fourier coefficients in depth, focusing on piecewise functions
  • Learn about the convergence properties of Fourier Series
  • Explore the use of Mathematica for visualizing Fourier Series approximations
  • Investigate the applications of Fourier Series in solving differential equations
USEFUL FOR

Mathematics students, engineers, and anyone interested in applied mathematics, particularly in the fields of signal processing and differential equations.

VinnyCee
Messages
486
Reaction score
0
I am not sure I am doing this correctly, so here it is.

Problem:

Find the Fourier Series

f(s)\,=\,\left\{\begin{array}{ccc}x^2&amp;-\pi\,&lt;\,x\,&lt;\,0\\0 &amp;0\,&lt;x\,&lt;\,\pi \\}\end{array}\right

Answer(supposedly):

a_0\,=\,\frac{\pi^3}{3}

a_n\,=\,-\frac{2}{n^2}

b_n\,=\,\frac{4\,-\,n^2\,\pi^2}{n^3\,\pi}

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

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]

Is this the final answer?
 
Physics news on Phys.org
Can anyone type this into mathematica?

Please double check :biggrin:
 
Here is how I got the a0, an and bn factors

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

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

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}

Right? Then:

a_n\,=\,-\frac{2}{n^2}

Am I on the right track here? or am i completely missing something?
 
Last edited:
Or is this how to solve a_n?

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}

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]

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

Which one is correct?
 
I think I see several sign mistakes, with the last sign being wrong. Why not reduce the last expression n/n^3??
 
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
 
Is this the correct an then?

Is the term below right for an?

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}

Thanks again!
 
You got an extra negative. \cos{n\pi} = (-1)^n, which we can verify by noting that when n = 0, n\pi = 0, so \cos{n\pi} = 1. 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
 
So, the an is:

a_n\,=\,\frac{2\,(-1)^n}{n^2}

Right?
 
  • #10
Looks good. Now go have another look at those b coefficients.

--J

Just one final left... Yay me!
 
  • #11
Now for the bn!

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}

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

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

Does that look right also?

Good luck on the final! I feel for you man.
 
  • #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
 

Attachments

  • Fourier.JPG
    Fourier.JPG
    12.8 KB · Views: 521
  • #13
Awesome plots.

Thanks a lot for the help.
 

Similar threads

Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
Replies
2
Views
1K
Replies
3
Views
1K
Replies
28
Views
2K
Replies
8
Views
1K
  • · Replies 7 ·
Replies
7
Views
800
  • · Replies 12 ·
Replies
12
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K