# Fourier series of the odd extension of a function [duplicate]

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}]$?

## marked as duplicate by MarcoB, Bob Hanlon, m_goldberg, Jens, dr.blochwaveJun 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.

• Have you tried anything ? – Sektor Jun 19 '15 at 20:13
• 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. – Kay Jun 19 '15 at 20:19
• Answer to (d): yes, at x=1, where there is a discontinuity. – bill s Jun 19 '15 at 23:32
• @bills. Isn't the discontinuity at x = 0? – m_goldberg Jun 19 '15 at 23:58

## 1 Answer

Why do you need to change the interval?

f-odd-extention (fox)

fox[x_] :=
Piecewise[{
{-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$

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