• Support PF! Buy your school textbooks, materials and every day products Here!

Fourier Series assistance

  • Thread starter ProPatto16
  • Start date
  • #1
326
0

Homework Statement



Given the function f(x) = Acos(∏x/L), find its Fourier series

Homework Equations



Okay so, f(x) is even, so the fourier series is given by:

f(x) = a0 + [itex]\sum[/itex]ancos(nx)

where a0 = 1/∏[itex]\int[/itex] f(x).dx with bounds ∏ and -∏

and an = 1/∏[itex]\int[/itex] f(x)cos(nx).dx with bounds ∏ and -∏

The Attempt at a Solution



okay, with range L

a0 = 2/L[itex]\int[/itex]f(x).dx with bounds L to 0

and an = 2/L[itex]\int[/itex]f(x)cos(n∏x/L).dx with bounds L to 0

starting with a0:

a0 = 2/L[itex]\int[/itex]f(x).dx with bounds L to 0

a0 = 2A/L[itex]\int[/itex]cos(∏x/L).dx

integrates to a sin, first sub in L gives sin∏ which = 0 and then sub the 0 gives sin0 which = 0 so therefore a0 = 0

now an:

and an = 2/L[itex]\int[/itex]f(x)cos(n∏x/L).dx with bounds L to 0

an = 2A/L[itex]\int[/itex]cos(∏x/L)cos(n∏x/L).dx

an = 2A/L[itex]\int[/itex]cos2(n∏x/L).dx

integral of cos2x = x/2 + (1/4)sin2x

so : an = 2A/L[n∏x/2L + (1/4)sin(2n∏x/L)] between L and 0

sub in 0 gives 0 + sin0, so only need to sub L,

an = 2A/L[n∏/2 + (1/4)sin(2n∏)]

an = An∏/L + (2A/L)sin(2n∏)

so then subbing back into expression for fourier series with a0 = 0 gives:

f(x) = [itex]\sum[/itex] [An∏/L + (2A/L)sin(2n∏)](cos(nx))

doing this course by distance education and theres no textbook, and the online notes are fairly vague. so i just wanna check im on the right track or at least the right method of solving etc. sorry about the latex. not the best at that. thanks.
 

Answers and Replies

  • #2
gabbagabbahey
Homework Helper
Gold Member
5,002
6


I haven't checked the rest of your solution, but [itex]\cos \left( \frac{\pi x}{L} \right)\cos \left( \frac{n \pi x}{L} \right) \neq \cos^2 \left( \frac{n \pi x}{L} \right)[/itex]
 
  • #3
LCKurtz
Science Advisor
Homework Helper
Insights Author
Gold Member
9,508
730


Homework Statement



Given the function f(x) = Acos(∏x/L), find its Fourier series

Homework Equations



Okay so, f(x) is even, so the fourier series is given by:

f(x) = a0 + [itex]\sum[/itex]ancos(nx)
That wouldn't be the natural FS to use. Your function ##A\cos(\frac {\pi x}{L})## has period ##2L## so you would normally expand it like this$$
A\cos(\frac{\pi x}{L}) = a_0 +\sum_{n=1}^\infty \left( a_n\cos(\frac{n\pi x}{L})+b_n\sin(\frac{n\pi x}{L})\right)$$used for a function of period ##2L## instead of ##2\pi##. And the formulas for ##a_n## and ##b_n## change accordingly.

Alert: There is also a very quick shortcut for calculating the ##a_n## and ##b_n## which you might notice if you look carefully at the FS and function you are expanding.
 
Last edited:
  • #4
uart
Science Advisor
2,776
9


Given the function f(x) = Acos(∏x/L), find its Fourier series

Okay so, f(x) is even,
Hi ProPat, I haven't read all of your solution, but just make sure you are totally clear about what function you are working with before you start.

All Fourier series require that the function be periodic. This is ideally stated explicitly in the function definition, but can be sometimes be implied by the domain you're given to work with. In this example if that domain was [0..2L] then answer would be trivial (and obtained by inspection). Given however that you appear to be working on [0..L], then your function is just a piece of that cosine wave (not a full cycle), repeated with period L.

This function is not "even", so I suspect you are missing something here from the get-go. Try making a sketch of the function before you begin.
 
Last edited:
  • #5
100
0


You should give people time to edit their posts... Though no offense taken. I made a mistake when I clicked "post" on that one instead of "preview post", so it's technically my mistake. Though I fixed the error and erased my post temporarily within a minute or so until I had finished, so your timing is especially impeccable.

As far as working the problem for the poster, I used my discretion when working the problem simply because he hinted that he possibly didn't have the required training to work the problem. I did it for pedagogical reasons which I feel will feel should always trump the rules.
 
Last edited:
  • #6
George Jones
Staff Emeritus
Science Advisor
Gold Member
7,259
790


As far as working the problem for the poster, I used my discretion when working the problem simply because he hinted that he possibly didn't have the required training to work the problem.
The original poster actually wrote:
doing this course by distance education and theres no textbook, and the online notes are fairly vague.
This makes it clear the original post was homework.
I did it for pedagogical reasons which I feel will feel should always trump the rules.
No. Physics Forums Rules state
Homework Help Guidelines ...

Under no circumstances should complete solutions be provided to a questioner, whether or not an attempt has been made.
Everyone agrees to the Physics Forums Rules when they register.

Your help is welcome, but try a give help one step/hint (or a small number of steps/hints) at a time.
 
  • #7
berkeman
Mentor
56,474
6,378


You should give people time to edit their posts... Though no offense taken. I made a mistake when I clicked "post" on that one instead of "preview post", so it's technically my mistake. Though I fixed the error and erased my post temporarily within a minute or so until I had finished, so your timing is especially impeccable.

As far as working the problem for the poster, I used my discretion when working the problem simply because he hinted that he possibly didn't have the required training to work the problem. I did it for pedagogical reasons which I feel will feel should always trump the rules.
No, it does not trump the rules. Do not do students' schoolwork for them.


EDIT -- George beat me to it!
 
  • #8
326
0


∫hey guys,

LCKurtz:

in my attempt at a solution part i defined

an = 2/L ∫ f(x)cos(n∏x/L)... is that not correct?

i can see the relationship there between the FS definition and an bn, and i assumed the period was L. im pretty sure the lecture notes and the assignment questions are from two completely different places, because all through the lecture notes "D" is used as "repeats" and theres not an L in sight, so im not entirely sure how to relate L and D inside the different forms of the FS. like i said, ambiguous study notes, pretty much re-teaching myself from internet resources.

gabbagabbahey: we meet again :) hah

like 2 minutes after i originally posted i realised that sweet screw up haha.

∫cos(n∏x/L .dx = -1/n*sin(n∏x/L)

if i take ∫cos(∏x/L)cos(n∏x/L) .dx and try integrate by parts its never ending.
i plugged it into an online integral caclulator and its a massive result so im assuming im missing something somewhere.

can someone please elaborate on the relationship between L and D and ill have a go from there. using the FS definition that LCKurtz posted, which is what i was using in the end, but i am using it with range L, so bounds 0 > L.

in my study notes is this definition

f(x) = A0/2 + Ʃ ancos(2∏nx/D) + Ʃ bnsin(2∏nx/D)

A0 = 2/D ∫ f(x).dx

an = 2/D ∫ f(x)cos(2∏nx/D).dx

bn = 2/D ∫ f(x)sin(2∏nx/D).dx

so from the given equation and that definition, D = 2L yes? does L have a meaning? D is the period i thought. is L just another way to define the range?

so if thats the case, as "uart" posted (sorry if thats not the full username, some appears to have not loaded on my browser) the answer should be obtainable by inspection using the exponential FS?

the original problem statement posted is all im given by the way.

thanks guys
 
Last edited:
  • #9
gabbagabbahey
Homework Helper
Gold Member
5,002
6


if i take ∫cos(∏x/L)cos(n∏x/L) .dx and try integrate by parts its never ending.
i plugged it into an online integral caclulator and its a massive result so im assuming im missing something somewhere.
Use a trig identity instead of integration by parts; [itex]\cos u \cos v = \cos (u+v) + \cos (u-v) [/itex], and be very careful to break this into two cases: [itex]n=1[/itex] and [itex]n \neq 1[/itex] before integrating.

in my study notes is this definition

f(x) = A0/2 + Ʃ ancos(2∏nx/D) + Ʃ bnsin(2∏nx/D)

A0 = 2/D ∫ f(x).dx

an = 2/D ∫ f(x)cos(2∏nx/D).dx

bn = 2/D ∫ f(x)sin(2∏nx/D).dx

so from the given equation and that definition, D = 2L yes? does L have a meaning? D is the period i thought. is L just another way to define the range?

so if thats the case, as "uart" posted (sorry if thats not the full username, some appears to have not loaded on my browser) the answer should be obtainable by inspection using the exponential FS?

the original problem statement posted is all im given by the way.

thanks guys
Let's give this a little more rigour first:

The Fourier series of a periodic function [itex]f[/itex], with period [itex]D[/itex] on the entire [itex]x[/itex] axis, which is piecewise smooth on the interval [itex] - \frac{D}{2} < x < \frac{D}{2} [/itex], and defined at each point [itex]x[/itex] where it is discontinuous as the mean value of the one-sided limits [itex]f(x+)[/itex] and [itex]f(x-)[/itex], valid for each [itex]x \in (-\infty, \infty)[/itex] is given by:

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

where

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

[tex]b_n = \frac{2}{D} \int_{ - \frac{D}{2} }^{ \frac{D}{2} } f(x) \sin \frac{2n \pi x}{D} dx \quad ( n = 1,2, \ldots )[/tex]

Does this definition agree with the one in your notes/textbook? If so, does [itex]f(x) = \cos \frac{ \pi x }{L} \quad 0 < x < L[/itex] (and [itex]f(x) = 0[/itex] elsewhere!) satisfy the conditions given in the above definition? If so, what is [itex]D[/itex] in this case?
 
  • #10
326
0


okay so this is the integral i got


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

but now if i take bounds L and 0 and sub them in all sin terms become sin(∏(n-1)) and any integer multiple of sin∏ = 0 so an = 0
 
  • #11
LCKurtz
Science Advisor
Homework Helper
Insights Author
Gold Member
9,508
730


okay so this is the integral i got


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

but now if i take bounds L and 0 and sub them in all sin terms become sin(∏(n-1)) and any integer multiple of sin∏ = 0 so an = 0
You are assuming that the period is ##2L## with this formula. That is also what I would assume. But notice that your answer doesn't work when ##n=1## because it gives ##\frac 0 0##. You have to do that case separately. Write out that integral separately and use a different method on it. You should wind up with ##a_1=A##. Then you might look again at the "Alert" hint in my first post.

I am also going to comment on your other post.
 
  • #12
LCKurtz
Science Advisor
Homework Helper
Insights Author
Gold Member
9,508
730


∫hey guys,

LCKurtz:

in my attempt at a solution part i defined

an = 2/L ∫ f(x)cos(n∏x/L)... is that not correct?

i can see the relationship there between the FS definition and an bn, and i assumed the period was L.
No. The period is ##2L## for that formula and it is pretty standard to use it that way.

im pretty sure the lecture notes and the assignment questions are from two completely different places, because all through the lecture notes "D" is used as "repeats" and theres not an L in sight, so im not entirely sure how to relate L and D inside the different forms of the FS. like i said, ambiguous study notes, pretty much re-teaching myself from internet resources.

gabbagabbahey: we meet again :) hah

like 2 minutes after i originally posted i realised that sweet screw up haha.

∫cos(n∏x/L .dx = -1/n*sin(n∏x/L)

if i take ∫cos(∏x/L)cos(n∏x/L) .dx and try integrate by parts its never ending.
i plugged it into an online integral caclulator and its a massive result so im assuming im missing something somewhere.

can someone please elaborate on the relationship between L and D and ill have a go from there. using the FS definition that LCKurtz posted, which is what i was using in the end, but i am using it with range L, so bounds 0 > L.

in my study notes is this definition

f(x) = A0/2 + Ʃ ancos(2∏nx/D) + Ʃ bnsin(2∏nx/D)

A0 = 2/D ∫ f(x).dx

an = 2/D ∫ f(x)cos(2∏nx/D).dx

bn = 2/D ∫ f(x)sin(2∏nx/D).dx

so from the given equation and that definition, D = 2L yes? does L have a meaning? D is the period i thought. is L just another way to define the range?
In those formulas ##D## is the full period so, yes, ##D=2L##. I must say I have never seen a text that expressed the formulas in terms of the full period ##D## that way. If you put ##D=2L## in those formulas you will get the standard formulas given in most texts. In fact, it is quite common to denote the full period by ##P## and use ##P=2p## in the formulas.
 
  • #13
326
0


yeah i noticed that you get 0/0 but then sin0 is just zero anyway ? same as the rest.

with the splitting of the integral,

do i take the integral

[tex] \int \cos \frac{ \pi x}{L} \cos \frac{n \pi x}{L} dx [/tex]

and then evaluate it with n = 1 and then n = everything else.

so the integral i did was n = everything else which is all zero, then integrate the integral with n = 1 so it becomes

[tex] \int \cos \frac{ \pi x}{L} \cos \frac{ \pi x}{L} dx [/tex]

and then integrating that, this is what i got


[tex] \frac{ \sin \frac{2 \pi x}{L}L + 2 \pi x }{4 \pi} [/tex]

then subbing in L there, the sin term becomes sin2∏ which is 0, so its 2∏L/4∏ = L/2 and the subbing in of the 0 just results in a 0.

so an = 2A/L(L/2) and there it is, = A

so now work through bn the same way and i should get a good result. that will take some time.
 
  • #14
326
0


i found this as a general formula with bounds [a,b]

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

where L = (b-a)/2 and the co-efficients are :

[tex]a_n = \frac{1}{L} \int_{ a }^{ b } f(x) \cos \frac{n \pi x}{L} dx [/tex]

[tex]b_n = \frac{1}{L} \int_{ a }^{ b } f(x) \sin \frac{n \pi x}{L} dx [/tex]


is that a good general formula?
 
  • #15
LCKurtz
Science Advisor
Homework Helper
Insights Author
Gold Member
9,508
730


i found this as a general formula with bounds [a,b]

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

where L = (b-a)/2 and the co-efficients are :

[tex]a_n = \frac{1}{L} \int_{ a }^{ b } f(x) \cos \frac{n \pi x}{L} dx [/tex]

[tex]b_n = \frac{1}{L} \int_{ a }^{ b } f(x) \sin \frac{n \pi x}{L} dx [/tex]


is that a good general formula?
Yes. But almost always you will find you use [a,b] = [-L,L] or [a,b] = [0,2L]. But you can always integrate over any period since if ##f(x)## has period ##P## then$$
\int_0^Pf(x)dx = \int_a^{a+P}f(x)dx$$for any ##a##.
 
  • #16
LCKurtz
Science Advisor
Homework Helper
Insights Author
Gold Member
9,508
730


integrate the integral with n = 1 so it becomes

[tex] \int \cos \frac{ \pi x}{L} \cos \frac{ \pi x}{L} dx [/tex]

and then integrating that, this is what i got


[tex] \frac{ \sin \frac{2 \pi x}{L}L + 2 \pi x }{4 \pi} [/tex]

then subbing in L there, the sin term becomes sin2∏ which is 0, so its 2∏L/4∏ = L/2 and the subbing in of the 0 just results in a 0.

so an = 2A/L(L/2) and there it is, = A

so now work through bn the same way and i should get a good result. that will take some time.
You mean ##a_1=A##, not ##a_n=A##. Now look back at my post #3. Do you see why you could have concluded ##a_1=A## and all the other coefficients are zero immediately?
 
  • #17
gabbagabbahey
Homework Helper
Gold Member
5,002
6
What is the exact wording on the question as given to you? In particular, is the function [itex]f(x)=\cos \left( \frac{\pi x}{L} \right)[/itex] everywhere, or just for [itex]0 < x <L[/itex] (and presumably zero elsewhere except, perhaps at [itex]x=L[/itex] and [itex]x=0[/itex]), because the answer is very different in the two cases.
 
  • #18
326
0
LCKurts:

yeah i see, for n = 1, Acos(∏x/L) = ancos(∏x/L) and all sin terms are zero since any integer multiple of sin∏ is zero. so for n = 1, A = a1

what about for the rest of n? theyre all zero right? so when expressing the answer i dont specify its a1?

gabba: the problem statement originally posted is all i have.

the exact complete question is this:

Given the function f(x) = Acos(∏x/L), determine its Fourier series.

there is nothing else, no domain specified or anything.

so does that mean ive done everything wrong so far? or right? is a0 = A/L and an = A. or is that not all there is to ann? just trying to summarise.

thanks guys
 
  • #19
gabbagabbahey
Homework Helper
Gold Member
5,002
6
LCKurts:

yeah i see, for n = 1, Acos(∏x/L) = ancos(∏x/L) and all sin terms are zero since any integer multiple of sin∏ is zero. so for n = 1, A = a1

what about for the rest of n? theyre all zero right? so when expressing the answer i dont specify its a1?

gabba: the problem statement originally posted is all i have.

the exact complete question is this:

Given the function f(x) = Acos(∏x/L), determine its Fourier series.

there is nothing else, no domain specified or anything.

so does that mean ive done everything wrong so far? or right? is a0 = A/L and an = A. or is that not all there is to ann? just trying to summarise.

thanks guys
In that case, your response to LCKurts is correct, a1=A and all other coefficients are zero... what does that make the Fourier Series? (don't be too shocked! There's a reason the answer is what it is...can you see it?:wink:)

If instead you were told, for example, that

[tex]f(x)=\left\{ \begin{array}{lr} A \cos \frac{\pi x}{L} & 0 < x < L \\ 0 & x<0 \;\text{or} \; x >L \end{array} \right.[/tex]

with [itex]f(0)=\frac{A}{2}[/itex] and [itex]f(L)=-\frac{A}{2}[/itex] and asked to find the Fourier series over the interval [itex](-\infty, \infty)[/itex] (which is a very typical problem on Fourier series), you would have found a very different result (the sine terms wouldn't be zero ... do you see why?)
 
Last edited:
  • #20
326
0
[tex] a_0 = 0 [/tex]

[tex] a_n = A [/tex]

[tex] b_n = 0 [/tex]

So the whole Fourier series is:

f(x) = Sum (Acos(pi*x/L))
??
The same as the original formula? Is that the trick?

And so the series only iterates once since n = 1 then after that is zero?

Dunno if the latex will work I'm on my iPhone
 
  • #21
326
0
And yeah if the domain was specified, as f(0) = A/2 then the sine terms would not be a whole integer multiple, and so then wouldn't all be 0
 
  • #22
gabbagabbahey
Homework Helper
Gold Member
5,002
6
[tex] a_0 = 0 [/tex]

[tex] a_n = A [/tex]

[tex] b_n = 0 [/tex]

So the whole Fourier series is:

f(x) = Sum (Acos(pi*x/L))
??


The same as the original formula? Is that the trick?

And so the series only iterates once since n = 1 then after that is zero?
Be careful here. From your integration, you found that [itex]a_n=0[/itex] except for [itex]n=1[/itex], and [itex]a_1=A[/itex]. So, the only nonzero term in the sum [itex]\sum_{ n =1 }^{ \infty } a_n \cos \frac{\pi x}{L}[/itex] is the [itex]n=1[/itex] term and so the sum is just equal to [itex]a_1 \cos \frac{\pi x}{L} = A \cos \frac{\pi x}{L}[/itex].

And yes, the Fourier series of [itex]A \cos \frac{ \pi x }{L} [/itex] is just [itex]A \cos \frac{ \pi x }{L} [/itex], but this is no mathematical trick, there's a reason for it. Think about what a Fourier series really is, and that reason should become clear.
 
  • #23
gabbagabbahey
Homework Helper
Gold Member
5,002
6
And yeah if the domain was specified, as f(0) = A/2 then the sine terms would not be a whole integer multiple, and so then wouldn't all be 0
To be clear, the sine terms I was referring to were the [itex]b_n \sin \frac{\pi x}{L}[/itex] terms. The reason the coefficients [itex]b_n[/itex] were zero for your problem was that your function was even. Would the function as defined in my previous (or I guess previous previous) post still be even?
 
  • #24
326
0
Well a Fourier series is the sum of trigonometric functions ,possibly infinite, to approximate a Periodic function. So take a square function, it takes roughly an n=4 Fourier series to start to see how the Fourier series approaches the square function using only sin and cosine functions. So instead of the square function here I'm given a cos function. So for a Fourier series to match a cos function it only takes the first summation of the Fourier series, because the first summation is exactly equal to the given function, it's not an approximation as n get large.
 
  • #25
326
0
I thought this function in this question was even. An even function is symmetrical around the y axis. If 0 < x < L then obviously there's no symmetry therefore it wouldn't be even right ? So then the sin terms would need to be evaluated.
 
Last edited:

Related Threads for: Fourier Series assistance

  • Last Post
Replies
1
Views
1K
Replies
5
Views
9K
  • Last Post
Replies
21
Views
1K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
7
Views
592
  • Last Post
Replies
12
Views
1K
Top