## FourierSeries(f(x), x, [n], [mode])

f(x)
The function definition should be given as an array.
[ [f(t1), t1, t2] , [f(t2), t2, t3] , ...[f(tn), tn, tn+1] ]

Where...
f(t1) is the function definition for t1 < t < t2
f(t2) is the function definition for t2 < t < t3

Total period of the function is given by [ tn+1 - t1 ]

[n]
This parameter indicates what to return.
n > 0 returns the indicated number of coefficients (from 0 to n for trigonometric series and from -n to +n for complex form).
n <= 0 returns only the single coefficient with number n (or +n and -n for complex form).

[mode]
This optional parameter indicates if the result should be given as a trigonometric series or in complex form.
mode = 0 returns trigonometric series. This is the default mode.
mode = 1 returns the complex form.

## Description

Creates the Fourier series of a given function.

## Trigonometric Series

FourierSeries([[-1, -@pi, 0], [1, 0, @pi]], x, 8)
FourierSeries([[-x, -@pi, 0], [1, 0, @pi]], x, 6)
FourierSeries([-1, -@pi, @pi], x, 6)
FourierSeries([-1, 0, 2@pi], x, 6)
FourierSeries([sin(z), 0, @pi], z, 6)
FourierSeries([[0, -@pi, 0], [@pi, 0, @pi]], x, 10)
FourierSeries([x^2, -@pi, @pi], x, 6)
FourierSeries([[-cos(z), -@pi, 0], [cos(z), 0, @pi]], z, 10)

## Complex Form

FourierSeries([[-1, -@pi, 0], [1, 0, @pi]], x, 6, 1)
FourierSeries([[-x, -@pi, 0], [x, 0, @pi]], x, 6, 1)
FourierSeries([[x, -@pi, @pi]], x, 4, 1)
FourierSeries([[t, 0, 2@pi]], t, 4, 1)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, 6, 1)
FourierSeries([[cos(z), -@pi/2, @pi/2], [0, @pi/2, 3@pi/2]], z, 6, 1)

## Single Coefficient

FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, 0, 1)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -1, 1)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -2, 1)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -3, 1)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -4, 1)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -5, 1)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, 0, 0)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -1, 0)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -2, 0)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -3, 0)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -4, 0)
FourierSeries([[sin(z), 0, @pi], [0, @pi, 2@pi]], z, -5, 0)

## Graphs

Slider(n, 1, 30, 1, 20) Plot(FourierSeries([[-1, -@pi, 0], [1, 0, @pi]], x, n), color=red)
Slider(n, 1, 30, 1, 20) Plot(FourierSeries([x, -@pi, @pi], x, n))
Plot(FourierSeries([[-x, -@pi, 0], [x, 0, @pi]], x, 10), color=blue)
Plot(FourierSeries([x*(@pi-x)(@pi+x), -@pi, @pi], x, 10), color=red)
Plot(FourierSeries([x^2, -@pi, @pi], x, 20), color=blue)

## References

http://mathworld.wolfram.com/FourierSeries.html
http://en.wikipedia.org/wiki/Fourier_series

## Related Functions

FourierCos, FourierSin