Expanding Function f(x)= x^2+xcosx in Fourier Series

In summary, we discussed how to expand the function f(x)=x^2+xcosx in Fourier series by dividing it into separate parts and expanding it separately. We calculated the coefficients a_n and b_n using integration and the even and odd properties of the function. Finally, we used the double angle formula to solve for the second integral.
  • #1
rayman123
152
0
1. Homework Statement [/b
expand the function in Fourier series[tex]f(x)= x^2+xcosx[/tex]
I divided the function in separate part and try to expand it in Fourier series separately
i have started with
[tex]x^2[/tex]
[tex]a_{0}= \frac{1}{2\pi}\int_{-\infty}^{\infty}x^2dx=\frac{\pi^2}{3}[/tex]

[tex]a_{n}= \frac{2}{\pi}\int_{0}^{\pi}x^2cosnxdx=\frac{2}{\pi}[\frac{x^2}{n}sinnx-2\int_{0}^{\pi}x\frac{sinx}{n}]dx=\frac{2}{\pi}[\frac{2\pi(-1)^n}{n^2}]=4\cdot\frac{(-1)^n}{n^2}\Rightarrow x^2= 4 \sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}cosnx[/tex]
[tex]x^2[/tex] if even function then[tex]b_{n}=0[/tex]

function f(x)=x is an odd function [tex]a_{n}= 0[/tex]
[tex]b_{n}= \frac{2}{\pi}\int_{0}^{\pi}xsinnxdx=\frac{2}{\pi}[-\frac{x}{n}cosnx+\frac{1}{n}\int_{0}^{\pi}cosnxdx]=\frac{2}{\pi}[-\frac{\pi}{n}(-1)^n]=2 \sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}sinnx[/tex]
is this correct so far?
can someone help me and show me how to calculate the rest? I mean how to connect everything together with cosx?





Homework Equations





The Attempt at a Solution



 
Last edited:
Physics news on Phys.org
  • #2
It would be handy if you tell us what the period of that function needs to be. From the looks of it you want it to have a period of [itex]2\pi[/itex].

You're integrating the wrong function in every integral. You're supposed to integrate [itex]f(x)=x^2+x\cos x[/itex]. Secondly some of your integrands are odd, therefore you can't just say that evaluating the integral between -pi and pi is the same as 2 times the integral between 0 and pi.
 
  • #3
for [tex]|x|<\pi[/tex]
my teacher did it in almost the same way but at the end he did something else with the xcosx part...
 
  • #4
It doesn't matter what your teacher did. What does matter is that you're doing it wrong. I suspect that your teacher makes good use of his knowledge how even and odd functions behave when integrated over a symmetrical interval. It is not smart to try and copy a method that you don't understand.

For example you get the correct answer for [itex]a_0[/itex] by pure coincidence. In fact your integral for [itex]a_0[/itex] doesn't even converge.

This is the integral you should have calculated:

[tex]
a_0=\frac{1}{2 \pi}\int_{-\pi}^\pi f(x)dx[/tex]
 
  • #5
well i calculated this integral once again and i get [tex] \frac{\pi^2}{3}[/tex]
 
  • #6
That is correct, but you calculated a different integral in your OP, which had the same answer by coincidence.

This is why it gave the same answer.

[tex]
\begin{align*}
a_0 & =\frac{1}{2 \pi}\int_{-\pi}^\pi x^2+x \cos x dx \\
& = \underbrace{\frac{1}{2 \pi} \int_{-\pi}^\pi x^2 dx}_\text{even integrand}+\underbrace{\frac{1}{2 \pi}\int_{-\pi}^\pi x \cos x dx}_\text{odd integrand}
\end{align*}
[/tex]

The second integral goes to zero.
 
Last edited:
  • #7
okej, i see it now.
but how to calculate coefficients [tex] a_{n} , b_{n} [/tex] then?
the problem is that i am not able to say whether the function is odd or even...[tex] x^2[/tex] is even but [tex] xcosx[/tex] is odd...but the whole function?
 
  • #8
You can calculate the other coefficients in a similar way. Read post #6 again, because I just fixed the latex.

the problem is that i am not able to say whether the function is odd or even...LaTeX Code: x^2 is even but LaTeX Code: xcosx is odd...but the whole function?

If a function is even then [itex]f(-x)=f(x)[/itex]. If a function is odd then [itex]f(-x)=-f(x)[/itex]. You can use this to check that f(x) is neither even nor odd.
 
Last edited:
  • #9
okej
so i started with [tex] a_{n}=\frac{1}{\pi}\int_{-\pi}^{\pi}x^2cos(nx)dx+\frac{1}{\pi}\int_{-\pi}^{\pi}xcosxcos(nx)dx[/tex]

the first integral gave me
[tex] \frac{2}{n^2}[xcos(nx)]_{-\pi}^{\pi}]=\frac{4\pi}{n^2}(-1)^n[/tex] hope its correct
how would you calculate the second one?
 
  • #10
The [itex]\pi[/itex] shouldn't be there. As for the second integral. Is the integral even or odd?
 
  • #11
i would say the second integral is odd, should it give 0 then?
is the final substitution wrong in the first integral? whe [tex] \pi[/tex] should not be there?
 
  • #12
Correct. The integrand is odd, and the integration interval is symmetric therefore the integral is 0. You have a [itex]\pi[/itex] in there because you forgot the factor [itex]1/ \pi[/itex] in front of the integral.

Notice how you got the same answer again, this time however without luck.
 
  • #13
oh...again, right

[tex] \frac{2}{n^2}[xcos(nx)]_{-\pi}^{\pi}]=\frac{4\pi}{n^2}(-1)^n[/tex]

[tex] a_{n}=\frac{4}{n^2}(-1)^ncosnx[/tex]

[tex]b_{n}= \frac{1}{\pi}\int_{-\pi}^{\pi}x^2sin(nx)dx+ \frac{1}{\pi}\int_{-\pi}^{\pi}xsin(nx)cos(nx)=
\frac{1}{\pi}[-\frac{x^2}{n}cosnx+\frac{2x}{n^2}sinnx+\frac{2}{n^3}cosnx]_{-\pi}^{\pi}[/tex]
is this correct so far?
i get from the first integral 0...the second integrand is even so it will give 0
 
Last edited:
  • #14
Why did you suddenly put a cosine in your expression for [itex]a_n[/itex]? It shouldn't be there.

The first integral is zero yes, why? The second integral is even yes, but that does not mean the integral is zero.
 
  • #15
okej, I just got quite confused...I must admit that I am a real beginner when it comes to Fourier analysis...all this is quite difficult;)
i just calculated the value for the first integral
[tex]b_{n}= \frac{1}{\pi}[-\frac{x^2}{n}cosnx+\frac{2x}{n^2}sinnx+\frac{2}{n^ 3}cosnx]_{-\pi}^{\pi}=\frac{1}{\pi}[-\frac{\pi^2}{n}(-1)^n+\frac{2}{n^3}(-1)^n-(-\frac{\pi^2}{n}(-1)^n+\frac{2}{n^3}(-1)^n)]=}[-\frac{\pi^2}{n}(-1)^n+\frac{2}{n^3}(-1)^n+\frac{\pi^2}{n}(-1)^n-\frac{2}{n^3}(-1)^n=0[/tex]

you are right with the second integral, i mixed it up with an odd function and I assumpted it should give 0...
however i do not have any clue how do solve the 2nd integral...
 
  • #16
The first integral is odd so you could have set it to zero saving you a lot of trouble.

For the second integral use the well known double angle formula [itex]\sin 2x=2\sin x \cos x[/itex].
 
Last edited:
  • #17
okej, i used it and i got
[tex] \frac{1}{2\pi}\int_{-\pi}^{\pi}xsin(2nx)dx=\frac{1}{2\pi}[-\frac{x}{2n}cos(2nx)+\frac{1}{4n^2}sin(2nx)]_{-\pi}^{\pi}=\frac{1}{2\pi}[-\frac{\pi}{2n}(1)^n-\frac{\pi}{2n}(-1)^n][/tex]
 
  • #18
You're almost there.

[tex] \frac{1}{2\pi}\int_{-\pi}^{\pi}xsin(2nx)dx
=
\underbrace{\frac{1}{2\pi}[-\frac{x}{2n}cos(2nx)+\frac{1}{4n^2}sin(2nx)]_{-\pi}^{\pi}}_\text{correct}
=\underbrace{\frac{1}{2\pi}[-\frac{\pi}{2n}(1)^n}_\text{missing a factor}-\underbrace{\frac{\pi}{2n}(-1)^n}_\text{wrong}][/tex]

Also [itex]1^n=...[/itex]?
 
  • #19
should it be [tex] 2n[/tex]
hm...the term with sin2nx will give 0 right?
for the rest i get :
[tex]{\frac{1}{2\pi}[-\frac{\pi}{2n}(1)^{2n}+\frac{\pi}{2n}(-1)^{2n}][/tex]
but according to what you have written it is still wrong,
 
  • #20
You found the correct primitive. Now all you have to do is plug in the limits of integration. You're nearly there, but don't get sloppy with simple arithmetic.

Yes the [itex]\sin 2 n \pi [/itex] term is zero for every [itex]n \in \mathbb{Z}[/itex]. Don't forget to answer my question in post #18.
 
Last edited:
  • #21
well i am not being sloppy, i am just very tired, have been studying all day long and i have still much left.
Right now i really do not se any other solution, maybe my head is just too tired. Will try to recalculate it again and find a correct answer.
your question in post #18 [tex] 1^{n}=? [/tex] the value depends on the factor n i suppose
 
  • #22
Plug in some numbers for n and see what you get.

I suggest you take a little break after you finish this problem!
 
  • #23
in fact i am not going to calculate any problems tonight, will continue tomorrow because i start making really stupid mistakes. Thank you very much for you help anyway, you have been very helpful.
I will continue with the problem tomorrow.
 
  • #24
[tex]={\frac{1}{2\pi} \left[-\frac{\pi}{2n}+\frac{-\pi}{2n}\right] = \frac{-1}{2n}[/tex]

made correction here

[tex] \frac{\pi^2}{3}+\sum_{n=1}^{\infty}[\frac{4}{n^2}(-1)^ncos(nx)+\frac{-1}{2n}sin(nx)][/tex]
 
Last edited:
  • #25
It is almost correct.

[tex]
={\frac{1}{2\pi} \left[-\frac{\pi}{2n}+\frac{-\pi}{2n}\right] = \frac{-1}{2n}
[/tex]

The part between brackets is zero, this should not be the case.

The [itex]x^2/3[/itex] in front of the sum isn't correct either, it should be [itex]a_0[/itex] instead.
 
  • #26
yes you are right it was a stupid mistake [tex] a_{0}[/tex] should be[tex] a_{0}=\frac{\pi^2}{3}[/tex]
[tex] \frac{\pi^2}{3}+\sum_{n=1}^{\infty}[\frac{4}{n^2}(-1)^ncos(nx)][/tex]
is it now correct?

are you sure that the part between the brackets is zero?
 
  • #27
No sorry about that. It is not zero and your result in post #24 is correct if you replace [itex]x^2/3[/itex] with [itex]a_0[/itex]. Don't reply when you just got out of bed!

To clear it up:

[itex]b_n=-\frac{1}{2n}[/itex]
 
  • #28
great:) Thank you very much. You relly helped me to understand the idea of this problem
 

1. What is a Fourier series?

A Fourier series is a mathematical representation of a periodic function using a combination of sine and cosine waves. It can be used to approximate any periodic function, including the expanding function f(x) = x^2 + xcosx.

2. How do you expand a function into a Fourier series?

To expand a function f(x) into a Fourier series, you need to calculate its Fourier coefficients. These coefficients can be found by integrating the function over one period and dividing by the period. The resulting series is a sum of sine and cosine terms, where each term is multiplied by its corresponding Fourier coefficient.

3. How accurate is the Fourier series expansion of f(x) = x^2 + xcosx?

The accuracy of the Fourier series expansion of f(x) = x^2 + xcosx depends on the number of terms used in the series. The more terms that are included, the closer the approximation will be to the original function. It is possible to achieve a very accurate approximation with enough terms, but it may not be an exact representation of the function.

4. What is the period of the expanding function f(x) = x^2 + xcosx?

The period of the expanding function f(x) = x^2 + xcosx is 2π, as it is a combination of a periodic function (cosx) and a non-periodic function (x^2).

5. Can a Fourier series expansion be used to represent non-periodic functions?

No, a Fourier series expansion can only accurately represent periodic functions. For non-periodic functions, other mathematical techniques such as Taylor series or power series may be more suitable for approximation.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
201
  • Calculus and Beyond Homework Help
Replies
3
Views
409
  • Calculus and Beyond Homework Help
Replies
1
Views
532
  • Calculus and Beyond Homework Help
Replies
16
Views
556
  • Calculus and Beyond Homework Help
Replies
1
Views
335
  • Calculus and Beyond Homework Help
Replies
5
Views
342
  • Calculus and Beyond Homework Help
Replies
3
Views
272
  • Calculus and Beyond Homework Help
Replies
6
Views
2K
  • Calculus and Beyond Homework Help
Replies
2
Views
707
  • Calculus and Beyond Homework Help
Replies
2
Views
178
Back
Top