This question already has an answer here:

Using Mathematica to make a plot, I noticed that the interval it's defined over must be changed in order to do the Fourier series. How do I change the interval to be on an interval of $[-{\cal l}, {\cal l}]$?

enter image description here


marked as duplicate by MarcoB, Bob Hanlon, m_goldberg, Jens, dr.blochwave Jun 20 '15 at 8:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Have you tried anything ? $\endgroup$ – Sektor Jun 19 '15 at 20:13
  • $\begingroup$ Yes, I went ahead and did the odd expansion which came out to be f(x) = {x^2+2: -1=<x=<0, -3-x: -3<x<1}. Changing the interval over to [-l,l] has been a problem though. Resulting in: f(x)={-3-x: -3/2<x<-1, x^2+2: -1=<x=<0, -3-x: 0<x<3/2}. The last piecewise part doesn't work though. $\endgroup$ – Kay Jun 19 '15 at 20:19
  • $\begingroup$ Answer to (d): yes, at x=1, where there is a discontinuity. $\endgroup$ – bill s Jun 19 '15 at 23:32
  • $\begingroup$ @bills. Isn't the discontinuity at x = 0? $\endgroup$ – m_goldberg Jun 19 '15 at 23:58

Why do you need to change the interval?

f-odd-extention (fox)

fox[x_] := 
    {-3 - x, x < -1}, {-x^2 - 1, -1 <= x < 0}, 
    {x^2 + 1, 0 <= x <= 1}, {3 - x, 1 < x}

which looks this

Plot[fox[x], {x, -3, 3}]


The Fourier series approximation to fox can be computed for 20 terns with

fs[x_] = FourierSeries[f[x], x, 20];

and it looks like this over the interval $[-3,\,3]$

Plot[fs[x], {x, -3, 3}]


and clearly shows a Gibb's effect at $x=0$

  • $\begingroup$ That is true, but my teacher has us set them up with integrals from [-l,l] $\endgroup$ – Kay Jun 20 '15 at 1:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.