# Partial Sums of Fourier Series [closed]

It does not want to plot anything? Please, help me understand why. Thank you

f = x – Pi
p = Pi
s[n_ , x_ ] := (1/2)*Integrate[ f , {x, -p, p} ]*(1/p) +
Sum[ (1/p)*Integrate[f*Cos (k*x) , {x, -p, p}]*Sin (k*x) + (1/p)*
Integrate[f*Sin (k*x) , {x, -p, p}]*Sin (k*x) , {k, 1, n} ]

partialsums = Table[s[n, x], {n, 1, 5}];
Plot[partialsums, {x, -4, 4}]

=================

=================

2

=================

Functions in Mathematica get square brackets (i.e. Sin[x]), not round brackets.

f = x – Pi
p = Pi
s[n_, x_] := (1/2)*Integrate[f, {x, -p, p}]*(1/p) +
Sum[(1/p)*Integrate[f*Cos [k*x], {x, -p, p}]*Sin [k*x] + (1/p)*
Integrate[f*Sin [k*x], {x, -p, p}]*Sin [k*x], {k, 1, n}]

partialsums = Table[s[n, x], {n, 1, 5}];
Plot[partialsums, {x, -4, 4}]

-Pi +x

Pi

Mathematica has FourierTrigSeries for this.

f = x – Pi;
partialsums = FourierTrigSeries[f, x, #] & /@ Range[5];
% // Column

Plot[partialsums, {x, -4, 4}]

Although interesting this doesn’t really address the question as to why no plot was being generated.
– Jack LaVigne
Jul 28 at 18:32