# Partial Sums of Fourier Series [on hold]

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}] `
```

Replay

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}]
```
```

Category: fourier analysis Time: 2016-07-28 Views: 0

## Related post

### server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.148 (s). 12 q(s)