# How to take limits in Fourier series?

I have a Fourier series which produces an impulse train of period j+1. In principle, it is given by

f[x_, j_] := (-1 + E^(2*I*Pi*x))/((-1 + E^((2*I*Pi*x)/(1 + j)))*(1 + j))


However, this produces 1/0 at integer values of x - the limiting value needs to be taken at these points, as the following tables demonstrate:

f[x_, j_] := (-1 + E^(2*I*Pi*x))/((-1 + E^((2*I*Pi*x)/(1 + j)))*(1 + j));

Table[f[x, j], {x, 1, 5}, {j, 0, 5}]


{{Indeterminate, 0, 0, 0, 0, 0}, {Indeterminate, Indeterminate, 0, 0, 0, 0}, {Indeterminate, 0, Indeterminate, 0, 0, 0}, {Indeterminate, Indeterminate, 0, Indeterminate, 0, 0}, {Indeterminate, 0, 0, 0, Indeterminate, 0}}

At present, I get round this by using Piecewise:

Clear["Global*"];
f[x_, j_] :=
Piecewise[{{(-1 + E^(2*I*Pi*x))/((-1 + E^((2*I*Pi*x)/(1 + j)))*(1 + j)),
Mod[x, j + 1] != 0}, {1, Mod[x, j + 1] == 0}}];
Table[f[x, j], {x, 1, 5}, {j, 0, 5}]


{{1, 0, 0, 0, 0, 0}, {1, 1, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 0}, {1, 1, 0, 1, 0, 0}, {1, 0, 0, 0, 1, 0}}

This piecewise definition is clunky, and it gets messy when I start playing around with the function (for example, using Integrate - which produces a function that I have have to redefine piecewise).

Ideally, I'd like to define the function (the tables are only there as examples) by instructing Mathematica to take the limit at integer x. How do I do this?

The following will do the job:

f[x_, j_] :=
Limit[(-1 + E^(2*I Pi x0))/((-1 + E^((2*I Pi x0)/(1 + j)))*(1 + j)),
x0 -> x];
Table[f[x, j], {x, 1, 5}, {j, 0, 5}]


With this we get:

 {{1, 0, 0, 0, 0, 0}, {1, 1, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 0}, {1, 1, 0, 1, 0, 0}, {1, 0, 0, 0, 1, 0}}


Try:

Table[Limit[f[x, j], x -> x0], {x0, 1, 5}, {j, 0, 5}]

• Hi @Daniel Huber. thanks, but this isn't quite what I'm looking for. This would help in the case of the example table I gave, but It's the definition of the function that I'm looking to change. Commented Sep 3, 2020 at 13:59
• Simply define: f[x_, j_] := Limit[(-1 + E^(2*IPix0))/((-1 + E^((2*IPix)/(1 + j)))*(1 + j)), x0 -> x] Commented Sep 3, 2020 at 16:58
• Hi @Daniel Huber. Unfortunately, applying this to the example table above produces {{ComplexInfinity, 0, 0, 0, 0, 0}, {ComplexInfinity, ComplexInfinity, 0, 0, 0, 0}, {ComplexInfinity, 0, ComplexInfinity, 0, 0, 0}, {ComplexInfinity, ComplexInfinity, 0, ComplexInfinity, 0, 0}, {ComplexInfinity, 0, 0, 0, ComplexInfinity, 0}}`... Commented Sep 4, 2020 at 8:48
• There is a typo, the second x should read x0: f[x_, j_] := Limit[(-1 + E^(2*I Pi x0))/((-1 + E^((2*I Pi x0)/(1 + j)))*(1 + j)), x0 -> x];Table[f[x, j], {x, 1, 5}, {j, 0, 5}] ; With this we get from Table[f[x, j], {x, 1, 5}, {j, 0, 5}] the result: {{1, 0, 0, 0, 0, 0}, {1, 1, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 0}, {1, 1, 0, 1, 0, 0}, {1, 0, 0, 0, 1, 0}} Commented Sep 4, 2020 at 20:26
• Hi @Daniel Huber. Do you want to post this as an answer then, and I can mark it up for you? Commented Sep 5, 2020 at 8:44