Explore the Fourier Series for a square wave

f (t) = (4/pi) Sum[(1/n) sin (2 pi (f (t))), {n, 1, Infinity}]

closed as off-topic by m_goldberg, corey979, bbgodfrey, Artes, J. M. is away Nov 1 '17 at 2:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, corey979, Artes, J. M. is away
If this question can be reworded to fit the rules in the help center, please edit the question.


Once you have the function and its Fourier representation, you can try with this:

f[t_] = (4/Pi) Sum[(1/n) Sin[2 Pi n t], {n, 1, \[Infinity], 2}];
fserf[t_,nmax_] := (4/Pi) Sum[(1/n) Sin[2 Pi n t], {n, 1, 2*nmax-1, 2}];
    Plot[{f[t], fserf[t, #]}, {t, 0, 3}, PlotLabel -> ToString[#] <> " Terms"] 
    &/@ {3, 5, 10, 20}, 2],
    ImageSize -> Large]

You can get your plots:

![enter image description here

Even use Manipulateto interactively see how the series works:

f[t_] = (4/Pi) Sum[(1/n) Sin[2 Pi n t], {n, 1, \[Infinity], 2}];
fserf[t_, nmax_] := (4/Pi) Sum[(1/n) Sin[2 Pi n t], {n, 1, 2*nmax-1, 2}];
   Plot[{f[t], fserf[t, nmax]}, {t, 0, scale},PlotLabel-> ToString[nmax] <> " Terms", PlotRange -> {-1.5, 1.5}], 
{{nmax, 1, "Nº of Terms"}, 1, 50, 1, Appearance -> "Labeled"},
{{scale, 1, "x-axis length"}, 1, 5, 1, Appearance -> "Labeled"}

enter image description here


First you need to learn the proper syntax for writing Mathematica expressions. When the sum is written properly as

f[t_] = (4/Pi) Sum[(1/n) Sin[2 Pi n t], {n, 1, ∞, 2}]

(2 I (ArcTanh[E^(-2 I π t)] - ArcTanh[E^(2 I π t)]))/π

then the plot is simple:

Plot[f[t], {t, 0, 3}]

plotenter image description here


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