What is the Fourier series for f(x) = |x|?

In summary, the conversation is about finding the Fourier-series for the function f(x) = |x|. The original poster is having trouble with part 1 of the problem and has attempted a solution, but is unsure of the limits for the integral. They receive help from another user who provides a plan of action for solving the problem. The original poster provides their attempt at the solution and realizes their a_n was incorrect. They then ask for help in writing the sum in the Fourier-series. Another user provides guidance and the original poster is able to write the sum for the Fourier-series.
  • #1
Niles
1,866
0
[SOLVED] Fourier series

Homework Statement


Hi.

Please take a look at:

https://www.physicsforums.com/showthread.php?t=104306

It is part 1 (finding the Fourier-series for f(x) = |x|) I am having trouble with.

The Attempt at a Solution


Ok, I can write f(x) = |x| for -pi =< x < pi as:

f(x) = x for 0 =< x < pi and
f(x) = -x for -pi =< x =< 0.

The function has period T=2.

I want to find a_n = int[f(x)*cos(n*pi*x)]dx with limits -1 .. 1. I split this integral up in two:

a_0 = int[-x}dx + ... but what are the limits? Are they -pi..0 or -1..0? The way I see it, neither of the limits work since a_0 must be pi.
 
Last edited:
Physics news on Phys.org
  • #2
Ehh, on wikipedia they define a_n = (1/Pi)*int[f(x)*cos(nx)]dx, but in my book they don't use 1/pi, but 2/T where T is the period?
 
  • #3
Do'h my period is all wrong. It's not 2, but 2*pi.
 
  • #4
Ok, I'm stuck finding a_n. This is the expression for a_n:

(int(-x*cos(n*Pi*x), x = -Pi .. 0))/Pi+(int(x*cos(n*Pi*x), x = 0 .. Pi))/Pi

This I get to be:

(2*(cos(Pi^2*n)+sin(Pi^2*n)*n*Pi^2-1))/(Pi^3*n^2),

which does not make sense at all. Can you guys help?
 
  • #5
Ehh ok, my a_n was wrong!

The correct a_n is:

(2*(cos(n*Pi)+sin(n*Pi)*n*Pi-1))/(Pi*n^2). This is zero for even n. Now I just need to write it as they ask me to. How to do that?
 
  • #6
okay so you want the Fourier coefficients of f(x) = |x|. I haven't read all because I find it difficult to read when it's not in tex. Here's what I would take as plan of campaign though:

what you do is say [tex] c_{k} = \frac{1}{2\pi} {\int^{\pi}_{-\pi} |x| e^{-ikx} dx [/tex]

this integral is not too hard, I imagine it's either something with partial integration, or else just straightforward, maybe cut something up in two pieces or something ;)

after that you say the Fourier series is [tex] \sum_{k} c_{k} e^{ikx} [/tex]
 
Last edited:
  • #7
I have found this for a_0 = Pi.

I have found this for b_n = 0.

I have found this for a_n = [tex]2\,{\frac {\cos \left( n\pi \right) +\sin \left( n\pi \right) n\pi -
1}{\pi \,{n}^{2}}}
[/tex].

Now I want to write it as they want to me - with the sum, but I can't see how I should do that?
 
  • #8
a0 = pi/2

for the other part you should just check your calculations and use wolfram integrator (search google) to see if you did everything correct. Also mathematica if you have it.

It would be as much work for me as you to find the error.

Sorry, maybe someone else will help you out.
 
  • #9
What is the value of the following functions:

[tex]sin(n\pi)[/tex]

and

[tex]cos(n\pi)[/tex]

for n=1,2,3,...
 
  • #10
the integral gives [tex]- \frac{2}{\pi} \frac{coskx}{k^{2}}[/tex]

where my k is his 2m

now you take the infinite summation and take back the sum one step :)
 
  • #11
Niles said:
I have found this for a_0 = Pi.

I have found this for b_n = 0.

I have found this for a_n = [tex]2\,{\frac {\cos \left( n\pi \right) +\sin \left( n\pi \right) n\pi -
1}{\pi \,{n}^{2}}}
[/tex].

Now I want to write it as they want to me - with the sum, but I can't see how I should do that?

For a_0, it depends on the way you use the Fourier series. There are several ways going around for calculating the coefficients. The formula I use it is the following:

[tex]f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n\cdot cos\left(\frac{2\pi nx}{T} \right) + b_n\cdot sin\left(\frac{2\pi nx}{T} \right) \right)[/tex]

With:

[tex]a_n=\frac{2}{T}\int_{0}^{T}f(x)\cdot cos\left(\frac{2\pi nx}{T} \right)dx[/tex]
[tex]b_n=\frac{2}{T}\int_{0}^{T}f(x)\cdot sin\left(\frac{2\pi nx}{T} \right)dx[/tex]

In which T the period of the function. This can be shifted for the interval of the integral. But it is the complete period. Sometimes you see it used as an interval of 0 to 2 pi or -pi to pi, etc. This causes confusion. So, a_o=pi might be correct in your integral. The result in the Fourier series has to be pi/2.

jacobrhcp said:
a0 = pi/2

for the other part you should just check your calculations and use wolfram integrator (search google) to see if you did everything correct. Also mathematica if you have it.

It would be as much work for me as you to find the error.

Sorry, maybe someone else will help you out.

Mmmm, using code for these basic integrals... The result is at -first sight- correct. As I posted before, calculate

[tex]sin(n\pi)[/tex]

it is always 0 and the cos function needs to be split up in even and odd n. You will arrive at the result you are seeking for.
 
  • #12
I used Maple to find the integrals.

I agree with what you wrote coomast - I used those "versions" as well. For n being even, a_n is 0. When n is odd, a_n is different from 0.

From these things I have to write the sum. This is where I am stuck.

EDIT: I read your post again, and noted what you said about sin(n*pi). I'll look at it and return.
 
  • #13
Ok, since sin(n*Pi) = 0 for all n, I get the expression for a_n:

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

I must multiply this with cos(n*x) (actually it's cos(2xnpi/L), but L=2pi). This gives me the following sum in the Fourier-series:

[tex]2\,{\frac { \left( \cos \left( \pi \,n \right) -1 \right) \cos \left(
{\it nx} \right) }{\pi \,{n}^{2}}}[/tex].

For n being even a_n = b_n = 0. For n being odd I get:

[tex]-4\,{\frac {\cos \left( {\it nx} \right) }{\pi \,{n}^{2}}}[/tex]. This isn't quite what we want?
 
Last edited:
  • #14
You are almost at the result. The function:

[tex]cos(n\pi)-1=0 \qquad \forall n \qquad even[/tex]

For odd this is:

[tex]cos(n\pi)-1=-2 \qquad \forall n \qquad odd[/tex]

Instead of writing odd and even, you can say that:

[tex]n \qquad odd \rightarrow n=2k+1 \qquad for \qquad k=0,1,2,...[/tex]

Thus in the Fourier series you have only those terms left in n which are odd or if you change n by 2k+1 you get the final result. In case this in unclear please post, I'm going to be online for a while.
 
  • #15
Sorry, but I am a little unclear of what you wrote. I can't see why I should substitute with n = 2k+1? And if I do substitute, the it is cos((2k+1)*x), not cos(2k+1)*x as they want to me get.

Thanks for all your help so far.

EDIT: Oh, I see :-) But still, when substituting, x is inside cos(...) and not outside?
 
  • #16
I think you have it :-)

The x has to be part of the argument of the cos function. This is an error in the use of the brackets. This can also cause a lot of confusion.

Anyway, glad you found it.

best regards, Coomast
 
  • #17
Thanks so much for your patience.
 
  • #18
You're welcome :-)
 

Related to What is the Fourier series for f(x) = |x|?

What is a Fourier Series?

A Fourier Series is a mathematical representation of a periodic function as a sum of sine and cosine functions with different amplitudes and frequencies. It is named after French mathematician Joseph Fourier and is commonly used in signal processing, data analysis, and other fields.

What is the purpose of a Fourier Series?

The purpose of a Fourier Series is to provide a way to decompose a complex periodic function into simpler and more manageable components. This allows for easier analysis and manipulation of the function.

How is a Fourier Series calculated?

A Fourier Series is calculated by using a technique called Fourier analysis, which involves breaking down a function into its individual sine and cosine components using Fourier coefficients. These coefficients can be determined using integration or other mathematical methods.

What are some real-world applications of Fourier Series?

Fourier Series have numerous real-world applications, including signal processing, image and sound compression, medical imaging, and climate modeling. They are also used in music theory and acoustics to analyze and synthesize different sounds and music.

Are there any limitations to Fourier Series?

While Fourier Series are a powerful tool for analyzing periodic functions, they do have some limitations. They can only be used for functions that are periodic, meaning that they repeat themselves over and over again. They also may not accurately represent functions that have sharp discontinuities or highly irregular patterns.

Similar threads

  • Calculus and Beyond Homework Help
Replies
3
Views
438
  • Calculus and Beyond Homework Help
Replies
1
Views
467
  • Calculus and Beyond Homework Help
Replies
1
Views
343
  • Calculus and Beyond Homework Help
Replies
2
Views
456
  • Calculus and Beyond Homework Help
Replies
1
Views
638
  • Calculus and Beyond Homework Help
Replies
3
Views
558
  • Calculus and Beyond Homework Help
Replies
6
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
498
  • Calculus and Beyond Homework Help
Replies
16
Views
695
  • Calculus and Beyond Homework Help
Replies
5
Views
568
Back
Top